Search code examples
azure-data-lakeu-sql

U-SQL error in Azure Data Lake Analytics


I'm trying to execute a simple pipeline in azure data lake analytics, but I'm having some trouble with U-SQL. I was wondering if someone can give a helping hand.

My Query:

DECLARE @log_file string = "/datalake/valores.tsv";
DECLARE @summary_file string = "/datalake/output.tsv";

@log = EXTRACT valor string from @log_file USING Extractors.Tsv(); 

@summary = select sum(int.valor) as somavalor from @log;OUTPUT @summary 
TO @summary_file USING Outputters.Tsv();

Error: Erro

Other general doubts: 1. When I deploy a new pipeline to ADF sometimes it doesn't appear in the activity window and sometime it does. I didn't get the logic. (I'm using the OneTime pipeline mode) 2. There is a better way to create new pipeline (other than manipulate raw Json files?) 3.There is any U-SQL parser? What is the easiest way to teste my query?

Thanks a lot.


Solution

  • U-SQL is case-sensitive so your U-SQL should look more like this:

    DECLARE @log_file string = "/datalake/valores.tsv";
    DECLARE @summary_file string = "/datalake/output.tsv";
    
    @log =
        EXTRACT valor int
        FROM @log_file
        USING Extractors.Tsv();
    
    @summary =
        SELECT SUM(valor) AS somavalor
        FROM @log;
    
    OUTPUT @summary 
    TO @summary_file USING Outputters.Tsv();
    

    I have assumed your input file has only a single column of type int.

    Use Visual Studio U-SQL projects, VS Code U-SQL add-in to ensure you write valid U-SQL. You can also submit U-SQL jobs via the portal.