Scope Language Introduction
Scope Language Introduction
Introduction to SCOPE
Cosmos is Microsoft's internal Big Data system and SCOPE is its query language.
A scripting language
Easy to use: SQL-like syntax
Build and submit the scripts on Cosmos
U-SQL scripts are used (U-SQL is a language that combines declarative SQL with imperative
C# to let you process data at any scale)
To compile, Right click on the script and select on “Build Script”
To submit it on the cosmos cluster for execution(Run), Right click on the script and select
“Submit”
IMPORT
EXTRACT
UETGoalMap =
EXTRACT CustomerId, AccountId
FROM @UETGoalMapFile
USING CSVFileExtractor("UETGoalMap_Stripe.dsv", "UETGoalMap_Stripe",
@CsvExtractorArgs);
Output To
JoinedData =
SELECT ClickData.*
FROM ClickData
LEFT JOIN ConversionData
ON ClickData.ClickId == ConversionData.ClickId;
OUTPUT TO SSTREAM@JoinedData WITH STREAMEXPIRY "60";
Basic Aggregations in SCOPE
SCOPE supports basic aggregation functions like SUM, MAX, Min etc.
But SCOPE does not support subqueries such as:
Clusters Overview:
iSCOPE
In iSCOPE, we just execute the queries which take less than 5 Min
It is used as Quick Check (QC)
To run the script for 5 Min following query is written: [SCRIPT: MAXDOP=0]
If the above query is not written, the script here will run only for 30 Sec
To Execute the script, Right click on the script and click on ‘Execute Script’
Enter your credentials, select ‘Custom Runtime User’ and enter ‘iscope_beta’
Ones the details are verified, it will execute the file and display the last query output which
can be saved by clicking on the “Save to File” which appears on the top right corner of the
output table
C# functions does not work in iSCOPE
Here Output to function is also not mandatory. Data is only used to display and only if
output to function is mentioned is then data is saved in specific file.