Develop U-SQL assemblies for Azure Data Lake Analytics jobs

Learn how to turn code-behind into assemblies to be used and reused in Data Lake Analytics jobs.

U-SQL makes it easy to add your own custom code in .Net languages, such as C#, VB.Net or F#. You can even deploy your own runtime to support other languages.

The easiest way to use custom code is to use the Data Lake Tools for Visual Studio’s code-behind capabilities. For more information, see Tutorial: develop U-SQL scripts using Data Lake Tools for Visual Studio. There are a few drawbacks of using code-behind:

  • The source code gets uploaded for every script submission.
  • code-behind cannot be shared with other jobs.

To address these drawbacks, you can turn code-behind into assemblies, and register the assemblies to the Data Lake Analytics catalog.

Prerequisites

Develop assemblies for U-SQL

To create and submit a U-SQL job

  1. From the File menu, click New, and then click Project.
  2. Expand Installed, Templates, Azure Data Lake, U-SQL(ADLA), select the Class Library (For U-SQL Application) template, and then click OK.
  3. Write your code in Class1.cs. The following is a code sample.

     using Microsoft.Analytics.Interfaces;
    
     namespace USQLApplication_codebehind
     {
         [SqlUserDefinedProcessor]
         public class MyProcessor : IProcessor
         {
             public override IRow Process(IRow input, IUpdatableRow output)
             {
                 output.Set(0, input.Get<string>(0));
                 output.Set(0, input.Get<string>(0));
                 return output.AsReadOnly();
             }
         }
     }
    
  4. Click the Build menu, and then click Build Solution to create the dll.

Register assemblies

See Use Data Lake Analytics(U-SQL) catalog.

Use the assemblies

See Use the Azure Data Lake Tools for Visual Studio Code.

See also