go a jump in a lake - meetupfiles.meetup.com/14078322/go and jump in a lake.pdfanalytics service a...

55
Go a Jump in a Lake Andrew Fryer @deepfat

Upload: others

Post on 20-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Go a Jump in a Lake

Andrew Fryer @deepfat

Page 2: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the
Page 3: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the
Page 4: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the
Page 5: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the
Page 6: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the
Page 7: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the
Page 8: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Hard to hire

Lots of people involved to data

Massive and of data

Huge technical integration

Page 9: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Laser focused on measuring relevance

Empower everyone to explore (100x people)

Measure the rate of exploration

Page 10: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the
Page 11: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the
Page 12: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

We went through these

It is a

With you don’t have to

be the size of Bing to solve the problem

It requires a lot of and

to get it right

Page 13: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Cortana Intelligence Suite

Intelligence

Dashboards &

Visualizations

Information

Management

Big Data Stores Machine Learning

and Analytics

CortanaEvent HubsHDInsight

(Hadoop and

Spark)

Stream

Analytics

Data Intelligence Action

People

Automated Systems

Apps

Web

Mobile

Bots

Bot

FrameworkSQL Data

Warehouse

Data

CatalogData Lake

Analytics

Data

Factory Machine

Learning

Data Lake

StoreCognitive

Services

Power BI

Data

Sources

Apps

Sensors

and

devices

Page 14: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Data at Scale in CIS

Intelligence

Dashboards &

Visualizations

Information

Management

Big Data Stores Machine Learning

and Analytics

HDInsight

(Hadoop and

Spark)

SQL Data

Warehouse

Data Lake

Analytics

Data Lake Store

OR

Data

Factory

Data

Sources

manages

Power BI

Page 15: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Analytics

Storage

HDInsight(“managed clusters”)

Azure Data Lake Analytics

Azure Data Lake Storage

Azure Data Lake

Page 16: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

WebHDFS

YARN

U-SQL

Analytics Service HDInsight

(managed Hadoop Clusters)Analytics

Store

Azure Data Lake

Page 17: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Azure Data LakeStore & managed clusters

Cloud

Hadoop Cluster

HDFS/WebHDFS API

Azure Data Lake store

Azure Data Lake managed clusters

On-premises

Page 18: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Azure Data Lake Analytics Service

Page 19: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Azure Data Lake Analytics Service

A new distributed analytics service

Built on Apache YARN

Scales dynamically with the turn of a dial

Pay by the query

Supports Azure AD for access control, roles, and integration with on-premidentity systems

Built with U-SQL to unify the benefits of SQL with the power of C#

Processes data across Azure

19

Page 20: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Developing big data apps

Author, debug, & optimize big data apps in Visual Studio

Multiple LanguagesU-SQL, Hive, & Pig

Seamlessly integrate .NET

Page 21: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Analytics: Two form factors

HDInsightManaged Hadoop clusters

ADLA

Analytics service

HDInsight Cluster

n1 n2 n3 n4

Hive/Pig/etc. job

Lots of containers

U-SQL/Hive/Pig jobADLA Account

YARN Layer

StorageBlobs or ADLS Input Output

Page 22: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Azure Data Lake U-SQL

Page 23: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

What is

U-SQL?

A hyper-scalable, highly extensible

language for preparing, transforming

and analyzing all data

Allows users to focus on the what—

not the how—of business problems

Built on familiar languages (SQL and

C#) and supported by a fully integrated

development environment

Built for data developers & scientists

24

Page 24: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Next generation large-scale data processing

language combining

The declarative, optimizable and parallelizability of SQL

The extensibility, expressiveness and familiarity of C#

The Origins of U-SQL

High performance Scalable Affordable Easy to program Secure

25

HiveT-SQL

U-SQLSCOPE

Page 25: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

U-SQL PhilosophyAchieve the same programming experience in batch or interactive

Cook data for other users (LETS & Share)

As unstructured data

As structured data

Large-scale custom processing with custom code

Augment big data with high-value data from where it lives

Schematizing unstructured data

(Load-Extract-Transform-Store) for analysis

26

Page 26: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

U-SQL language philosophyDeclarative query and transformation language:• Uses SQL’s SELECT FROM WHERE with GROUP BY/aggregation, joins,

SQL Analytics functions

• Optimizable, scalable

Operates on unstructured & structured data• Schema on read over files

• Relational metadata objects (e.g. database, table)

Extensible from ground up:• Type system is based on C#

• Expression language is C#

21

User-defined functions (U-SQL and C#)

User-defined types (U-SQL/C#) (future)

User-defined aggregators (C#)

User-defined operators (UDO) (C#)

U-SQL provides the parallelization and scale-out framework for

usercode• EXTRACTOR, OUTPUTTER, PROCESSOR, REDUCER, COMBINERS

Expression-flow programming style:• Easy to use functional lambda composition

• Composable, globally optimizable

Federated query across distributed data sources (soon)

REFERENCE MyDB.MyAssembly;

CREATE TABLE T( cid int, first_order DateTime

, last_order DateTime, order_count int, order_amount float );

@o = EXTRACT oid int, cid int, odate DateTime, amount float

FROM "/input/orders.txt“

USING Extractors.Csv();

@c = EXTRACT cid int, name string, city string

FROM "/input/customers.txt“

USING Extractors.Csv();

@j = SELECT c.cid, MIN(o.odate) AS firstorder

, MAX(o.date) AS lastorder, COUNT(o.oid) AS ordercnt

, SUM(c.amount) AS totalamount

FROM @c AS c LEFT OUTER JOIN @o AS o ON c.cid == o.cid

WHERE c.city.StartsWith("New")

&& MyNamespace.MyFunction(o.odate) > 10

GROUP BY c.cid;

OUTPUT @j TO "/output/result.txt"USING new MyData.Write();

INSERT INTO T SELECT * FROM @j;

27

Page 27: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Automatic "in-lining" of SQLIP expressions – whole script leads to a single execution model

Execution plan that is optimized out-of-the-box and w/o user intervention

Per-job and user-driven parallelization

Detail visibility into execution steps, for debugging

Heat map functionality to identify performance bottlenecks

Expression-flow programming style

28

010010

100100

010101

Page 28: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

U-SQL overview

29

Page 29: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

E-commerce scenario: Before

Parse

Web server farm

Users

Transactional

database servers

CSV

Combined data

CSV

Custom

aggregationsReports

Customer purchase

records

30

Custom file

format

Server logs

Page 30: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Comma

separated list of

page IDs visited

Encrypted user ID Start time End time Region Comma separated list of pages

<A23XŞ%28J8> <2/15/2012 11:53:16 AM> <2/15/2012 11:58:16 AM> <en-us> <www.nachos.com; www.wikipedia.com; www.yelp.com> <6,8,22,33,34,66,37>

<B4332&8*ŞR> <2/15/2012 11:53:16 AM> <2/15/2012 11:58:32 AM> <EN-US> <en.wikipedia.org/wiki/Weight_loss;webmd.com/diet; exercise.about.com> <82,5,6,7,34,56,56,78>

<XY54#@asd9> <2/15/2012 11:54:16 AM> <2/15/2012 11:56:17 AM> <en-gb> <microsoft.com; Wikipedia.org/wiki/Microsoft; xbox.com;msn.com;www.yahoo.com;> <87,92,45,5,33,45,4,28>

<OSD934#*HH> <2/15/2012 11:54:16 AM> <2/15/2012 11:56:27 AM> <en-gb> <dominos.com;Wikipedia.org/wiki/Domino’s_Pizza;facebook.com/dominos> <1,3,5,81,18,35,3,5,56>

<MGD%Ş@78JH> <2/15/2012 11:55:16 AM> <2/15/2012 11:58:36 AM> <en-us> <skiresorts.com;ski-europe.com;www.travelersdigest.com/ski_resorts.htm> <2,45,56,4,6,9,65,98,24>

<OPO*&BSD%S> <2/15/2012 11:56:16 AM> <2/15/2012 11:59:45 AM> <en-fr> <running.about.com;ehow.com;go.com’nike.com;nfl.com> <1,8,72,34,89,34,27,48,67>

E-commerce scenario: Sample web log data

Field separators

31

Page 31: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

E-commerce scenario: Sample transactional data

User ID Time Product IDs Total amount ($)

78229021 2/15/2012 11:53:16 AM SR27821, CO98241, HG4214 214.50

999645224 2/15/2012 11:53:16 AMSRT242421, VFG3243, TR3253, BET353, OPB236,

FE4365, KL5634, HI4634, MI46344,213.78

397633634 2/15/2012 11:54:16 AM A3256 58.67

8342834114 2/15/2012 11:54:16 AM A8427 44.42

248219412 2/15/2012 11:55:16 AMB242V421, GH324342, YT325352, RT35325,

RE2352351,241.50

2421412 2/15/2012 11:56:16 AM LW04682, MJ54655 305.75

32

Unique user ID

(not encrypted)

Comma separated list of

products in the order

Page 32: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Data Volume

Qu

ery

Tim

e

E-commerce scenario: Challenges beforeNeeded a future-proof storage solution to hold many PBs

33

Even with scale out, reporting time

increases as data volume increases

Home-grown scale-out frameworks are

difficult to develop and maintain

Open Source big data analytics

tools have a steep learning curve

Page 33: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Customer purchase

records

E-Commerce scenario: After

U-SQL

analytic app

34

Users

Web server farm

Transactional

database servers

Azure Data Lake

Custom file

format

Server logs

Azure SQL DB

Azure Data Lake Analytics

U-SQL

analytic app

U-SQL

analytic app

ReportsCustom aggregations

Page 34: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Why would you use it?

35

Store unlimited

data

Store virtually

unlimited data in

Azure Data Lake

Scale-out

automatically

Scale-out and

parallelize U-SQL

scripts automatically

010010

100100

010101

Reuse

code

Easily reuse existing

.NET code

Visual Studio

integration

Develop, debug,

submit jobs, fine-tune

performance

Reduce

learning curve

U-SQL is based on

SQL and C#

Page 35: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Anatomy of a U-SQL query

REFERENCE ASSEMBLY WebLogExtASM;

@rs =EXTRACT

UserID string,Start DateTime,End DatetTime,Region string,SitesVisited string,PagesVisited string

FROM "swebhdfs://Logs/WebLogRecords.txt"USING WebLogExtractor();

@result = SELECT UserID,(End.Subtract(Start)).TotalSeconds AS DurationFROM @rs ORDER BY Duration DESC FETCH 10;

OUTPUT @result TO "swebhdfs://Logs/Results/top10.txt"USING Outputter.Tsv();

• U-SQL types are the same as

C# types

• The structure (schema) is first

imposed when the data is first

extracted/read from the file

(schema-on-read)

10 log records by Duration (End time minus Start time). Sort rows in descending order of Duration.

Query 1

36

Input is read from this file in ADL

Custom function to read from

input file

C# Expression

Output is stored in this file in ADL

Built-in function that writes the output

in TSV format

Rowset: Conceptually is like

an intermediate table…

is how U-SQL passes data

between statements

Page 36: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Numeric

byte, byte?

sbyte, sbyte?

int, int?

uint, unint?

long, long?

decimal, decimal?

short, short?

ushort, ushort?

ulong, unlong?

float, float?

double, double?

Textchar, char?

string

ComplexMAP<K>

ARRAY<K,T>

Temporal DateTime, DateTime?

Other

bool, bool?

Guid, Guid?

Byte[]

U-SQL data types

Note: Nullable types have to be declared with a question mark ‘?’

Category Types

37

Page 37: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

U-SQL Complex Type: Array

Desired Output

A$A892 12

HG54#A 29

YSD78@ 14

JADI899 45

YCPB(%U 30

HADS46$ 18

MVDRY79% 12

TYUSPS67 14

Use ARRAY type to hold the list of pages visited

@rs1 =SELECT UserId,

new ARRAY<string>(PagesVisited.Split( new[] { ';' } )) AS

VisitedPagesArrayFROM @rs;

@rs2 =SELECT UserId AS Users,

VisitedPagesArray.Count AS VisitedPagesFROM @rs1WHERE VisitedPagesArray.Count > 10;

OUTPUT @rs2 TO @"results.tsv" USINGOutputters.Tsv();

Select the list of users who have visited more than 10 pages

Query 2

38

Page 38: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Reading files with custom formatsUse built-in extractors to read CSV and TSV files,

or create custom extractors for different formats

Upload and Register Assembly

2

CREATE ASSEMBLY WebLogExtAsmFROM @”/WebLogExtAsm.dll" WITH PERMISSION_SET = RESTRICTED;

CREATE EXTRACTOR WebLogExtractorEXTERNAL NAME WebLogExtractor;

Implement IExtractor Interface

using Microsoft.SCOPE.Interfaces;

public WebLogExtractor:IExtractor{

public override IEnumerable<IRow> Extract(…){

…}…

}

1

REFERENCE ASSEMBLY WebLogExtAsm;

//now just use it like a built-in extractorSELECT * FROM @“swebhdfs://Logs/WebRecords.txt”USING WebLogExtractor();

Reference the Assembly and Use

3

39

Page 39: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

WebLogExtractor: Implementation

using System.Collections.Generic;using System.IO;using System.Text.RegularExpressions;namespace Demo{

[SqlUserDefinedExtractor]public class MyExtractor : IExtractor {

public override IEnumerable<IRow> Extract(IUnstructuredReader input, IUpdatableRowoutput) {

string line;Regex ItemRegex = new Regex(@"\<(.*?)\>", RegexOptions.Compiled);string[] tokens = { "UserId", "Start", "End", "Region", "SitesVisited",

"PagesVisited" };var reader = new StreamReader(input.BaseStream);while ((line = reader.ReadLine()) != null) {

int i = 0;foreach (Match ItemMatch in ItemRegex.Matches(line)){

output.set(tokens[i], ItemMatch.Groups[1]);i++;

}yield return output.AsReadOnly();

}}

}}

Custom extractor for

WebLogRecords.txt

file with this format

40

Page 40: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Aggregation functions

Can be extended with custom

aggregation functions

NumUsers Region TotalDuration AvgDuration MaxDuration MinDuration

1 1 “en-ca” 24 24 24 24

2 1 “en-ch” 10 10 10 10

3 1 “en-fr” 241 241 241 241

4 2 “en-gb” 688 344 614 74

5 1 “en-gr” 305 305 305 305

6 1 “en-mx” 422 422 422 422

7 16 “en-us” 8291 518 1270 30

Built-in aggregation functions

• AVG

• ARRAY_AGG

• COUNT

• FIRST

• LAST

• MAP_AGG

• MAX

• MIN

• STDEV

• SUM

• VAR

@tmp1 = SELECT Region, (End.Subtract(Start)).TotalSecondsAS Duration FROM @rs;

@rs1 = SELECTCOUNT() AS NumUsers,Region,SUM (Duration) AS TotalDuration,AVG (Duration) AS AvgDuration,MAX (Duration) AS MaxDuration,MIN (Duration) AS MinDuration

FROM @tmp1GROUP BY Region;

Count users per region and the AVG, MAX, MIN and total duration

Query 3

41

Page 41: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Improve performance with TABLEs

WebLogRecords.txt

INSERT INTO LogRecordsTableSELECT UserId, Start, End , RegionFROM @rs;

Populate the table

Select only required fields

@result =

SELECT UserID, (End.Subtract(Start)).TotalSeconds ASDuration

FROM LogRecordsTable ORDER BY Duration DESC FETCH 10;

OUTPUT @result TO “swebhdfs://Logs/Results/Top10.Tsv”USING Outputters.Tsv();

Top10.TsvRun query directly

against the table

CREATE TABLE LogRecordsTable(UserId int, Start DateTime, End Datetime, Region stringINDEX idx CLUSTERED (Region ASC) PARTITIONED BY HASH (Region));

Improve performance of Query1!

Query 4

42

Azure Data Lake

Page 42: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Partitioned tables: Improve performance

<><><><>

<><><><>

<><><><>

<><><><>

<><><><>

<><><><>

Extent 1

Region = “en-us”

<><><><>

<><><><>

<><><><>

<><><><>

<><><><>

<><><><>

Extent 2

Region = “en-gb”

<><><><>

<><><><>

<><><><>

<><><><>

<><><><>

<><><><>

Extent 3

Region = “en-fr”CREATE TABLELogRecordsTable (UserId int,Start DateTime, Region string,INDEX idx CLUSTERED (Region ASC)PARTITIONED BY HASH(Region));

During insertion

records are hash

distributed among

the 3 extents based

on value of ‘Region’

column

INSERT INTO LogRecordsTableSELECT UserId, Start, End, Region FROM @rs

Partition

elimination

@rs = SELECT * FROM LogRecordsTableWHERE Region == “en-gb”

1

2

3

43

Page 43: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Table: Clustered indexesImprove performance by eliminating ‘cross-extent shuffling’

Full agg

Table clustered by Region

Read Read Read Read

Full agg Full agg Partial agg Partial agg

Extent 1 Extent 2 Extent 3 Extent 4

Sort Sort

Top 100 Top 100 Sort

Top 100

Top 100

Read Read Read Read

Unstructured Data

Partial agg Partial agg Partial agg Partial agg

Full agg Full agg Full agg

Sort Sort Sort

Top 100 Top 100 Top 100

Extent 1 Extent 2 Extent 3 Extent 4

Partition Partition Partition Partition

@rs1 = SELECT Region, COUNT() AS TotalFROM @rsGROUP BY Region;

@rs2 = SELECT TOP 100 Region, TotalFROM @rs1ORDER BY Total;

44

EXPENSIVE

Page 44: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Table valued functions Functions that return a TABLE object

Parameterized “view”—they are in-lined (parameterized lambdas)

Can contain U-SQL expressions except OUTPUT and DDL/DML

Benefits:

– Eliminates unnecessary repetition of

code

– Enables sharing of code

– Makes scripts more manageable

//create the TVFDROP FUNCTION IF EXISTS SearchLogView; //DDL statementCREATE FUNCTION WebLogView ( )

RETURNS @result TABLE (UserId int, Start DateTime, End DateTime, Region string,SiteVisited string, PagesVisited string)AS BEGIN

@result =EXTRACTUserId int, Start DateTime, End DateTime, Region string,SiteVisited string, PagesVisited stringFROM “swebhdfs://Logs/WebRecords.txt"USING WebLogExtractor();

RETURN;END;

//now use the TVF@searchlog = WebLogView();

OUTPUT @searchlog TO “swebhdfs://Logs/WebRecords_copy.tsv"

USING Outputters.Tsv();

45

Page 45: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

U-SQL extensibilityExtend U-SQL with C#/.NET

Built-in operators,

function, aggregates

C# expressions (in SELECT statements)

User-defined aggregates (UDAGGs)

User-defined functions (UDFs)

User-defined operators (UDOs)

46

Page 46: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Types of user-defined operators

User defined

operators

Outputters [Called with Output syntax]

Processors [Called with Process syntax]

Appliers [Called with Apply syntax]

Reducers [Called with Reduce syntax]

Combiners [Called with Combine syntax]

49

Extractors [Called with Extract syntax]

Page 47: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Federated queries: Query data where it livesEasily query data in multiple Azure data stores without moving it to a single store

Benefits

Avoid moving large amounts of data across the network between stores

Single view of data irrespective of physical location

Minimize data proliferation issues caused by maintaining multiple copies

Single query language for all data

Each data store maintains its own sovereignty

Design choices based on the need

U-SQL

QueryResult

Query

57

Azure

Storage Blobs

Azure SQL

in VMs

Azure

SQL DB

Azure Data

Lake Analytics

Page 48: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Azure Portal integration

Create a new Big Data Analytics Account

Author U-SQL scripts

Submit U-SQL jobs

Cancel running jobs

Provision users who can submit jobs

Visualize usage stats (compute hours)

Visualize job management chart

62

Page 49: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Visual Studio integration

Page 50: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

What can you do with Visual Studio?

Visualize and

replay progress

of job

Fine-tune query

performance

Visualize physical

plan of U-SQL

query

Browse metadata

catalog

Author U-SQL

scripts (with

C# code)

Create metadata

objects

Submit and cancel

U-SQL Jobs

Debug U-SQL and

C# code

74

Page 51: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

“Data read” playback (video)

For performance

tuning, identify

bottlenecks and

debugging, you can

playback the job

execution graph

83

Page 52: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

ADL AnalyticsGetting started

Developing big data apps

Works across cloud data

Simplified management and admin

115

Page 53: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Get started

Log in to Azure Create an ADLA account

Write and submit an ADLA job with U-SQL (or Hive/Pig)

The job reads and writes data from storage

1 2 3 4

30 seconds

ADLS

Azure Blobs

Azure DB

Page 54: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

Azure Data Lake Pricing

Page 55: Go a Jump in a Lake - Meetupfiles.meetup.com/14078322/Go and jump in a Lake.pdfAnalytics Service A new distributed analytics service Built on Apache YARN Scales dynamically with the

ADLA billing

Accounts are FREE!

Pay for the compute resources you want for your queries

Pay for storage separately

(query_minutes * parallelism * parallelism_cost_per_minute)+ per_job_charge