U-SQL连接失败

时间:2018-11-27 11:56:58

标签: azure-data-factory u-sql

嗨,我正在尝试使用U-SQL进行连接,并且三个输入文件是文本文件,现在出现错误。我是新手。 当我尝试加入时,它抛出以下错误。我已经尝试过:使用Extractors.Csv(encoding:System.Text.Encoding.GetEncoding("Windows-1252"));,但存在相同的错误。 您能否帮助解决该错误:

{
    "errorCode": "2703",
    "message": "Error Id: E_CSC_USER_SYNTAXERROR, Error Message: syntax error. Expected one of: identifier quoted-identifier variable . Error Id: E_CSC_USER_RESERVEDKEYWORDASIDENTIFIER, Error Message: Reserved keyword FROM is used as an identifier.. Error Id: E_CSC_USER_SYNTAXERROR, Error Message: syntax error. Expected one of: '(' ANTISEMIJOIN BROADCASTLEFT BROADCASTRIGHT CROSS EXCEPT FULL FULLCROSS GROUP HASH HAVING INDEXLOOKUP INNER INTERSECT JOIN LEFT LOOP MERGE ON OPTION ORDER OUTER OUTER UNION PAIR PIVOT PRESORT RIGHT SAMPLE SEMIJOIN SERIAL UNION UNPIVOT WHERE WITH ';' ')' ',' . ",
    "failureType": "UserError",
    "target": "U-SQL1"
}

U-SQL脚本

@customerData = EXTRACT 
    Customerid string,
    Name string,
    City string,
    State string,
    Country string,
    Account_Created string
FROM "/a_test/customer_data/[dbo].[customerData].txt"
USING Extractors.Csv(skipFirstNRows:1);


@productData = EXTRACT 
    Product string,
    Price string,
FROM "/a_test/product_data/[dbo].[productData].txt"
USING Extractors.Csv(skipFirstNRows:1);


@transactionData = EXTRACT 
    Transaction_date string,
    Product string,
    Payment_Type string,
    Customerid string,
    Name string,
    City string,
    Account_Created string,
    Last_Login string,
    Latitude string,
    Longitude string
FROM "/a_test/transaction_data/[dbo].[transactionData].txt"
USING Extractors.Csv(skipFirstNRows:1);

@result = 
SELECT 
    t.Customerid,
    t.Transaction_date,
    t.Product,
    t.Payment_Type,
    t.Name,
    t.City,
    c.State,
    c.Country,
    p.Price,
    t.Latitude,
    t.Longitude
  FROM @transactionData AS t
  INNER JOIN @productData AS p on t.Product = p.Product
  INNER JOIN @customerData AS c on t.Customerid = c.Customerid
  order by t.Customerid;

OUTPUT @result TO "/a_test/final_output"
USING Outputters.Csv();

1 个答案:

答案 0 :(得分:1)

@productData = EXTRACT 
Product string,
Price string,
FROM "/a_test/product_data/[dbo].[productData].txt"
USING Extractors.Csv(skipFirstNRows:1);

“价格”字符串列后有一个逗号(,),应删除该逗号。