U-sql-定义输入文件模式时出错

时间:2019-06-19 14:10:16

标签: azure azure-data-lake u-sql

在Azure数据工厂管道调用的U-SQL脚本中,我具有以下语句来为我的过程定义输入文件: DECLARE @inputpattern_csv string = "/FOLDER/" + @year.ToString() + @month.ToString().PadLeft(2, '0') + "{daynum:}_ex1.csv";

该过程一直有效,但是现在当我运行它时,它将返回此错误: E_CSC_USER_INVALIDFILESETPATTERN: Invalid file set pattern 'daynum:' in 'adl://**************.azuredatalakestore.net/FOLDER/201904{daynum:}_ex1.csv'

Azure数据工厂上的错误输出如下:

{
"errorCode": "2703",
"message": "Error Id: E_CSC_USER_INVALIDFILESETPATTERN, Error Message: Invalid file set pattern 'daynum:' in 'adl://**************.azuredatalakestore.net/FOLDER/201904{daynum:}_ex1.csv'.. ",
"failureType": "UserError",
"target": "U-sql Activity"
}

是对Azure Data Lake Storage Gen2进行更新的结果吗? 我该怎么解决?

谢谢

1 个答案:

答案 0 :(得分:-1)

似乎您是在指定日期范围内定义列表文件,对吗? 如果正确,则下面的代码可能会对您有所帮助。

您可以参考MS的文档here

DECLARE @File_Set_Pattern = "/sample/{Virtual_Col_Name:yyyy}/{Virtual_Col_Name:MM}/{Virtual_Col_Name:dd}.csv; 

DECLARE @From_Date = new DateTime(2019,01,01); 
DECLARE @To_Date = new DateTime(2019,01,28); 

@N = EXTRACT 
        Column_Names string, //define list columns and datatype here
        Virtual_Col_Name DateTime from @File_Set_Pattern //this is virtual column name
USING Extractors.Csv(); //replace by extractor you are using

OUTPUT( SELECT * FROM @N WHERE Virtual_Col_Name BETWEEN @From_Date AND @To_Date ) TO "/sample/outputfile.csv USING Outputters.Csv;