如何将 List_File_Path 传递给 Azure 数据工厂 U-SQL activity?
How do you pass a List_File_Path to an Azure Data Factory U-SQL activity?
Input Files (U-SQL) 声明输入路径可以采用以下任何形式:
Input_File_Path :=
Single_File_Path
| List_File_Path
| File_Set_Path.
作为 List_File_Path 的示例,他们提供:
@searchLog =
EXTRACT UserId int
, Start DateTime
, Region string
, Query string
, Duration int
, Urls string
, ClickedUrls string
FROM "/Samples/Outputs/ExampleA.csv",
"/Samples/Outputs/ExampleB.csv"
USING Extractors.Csv();
我有以下代码:
DECLARE EXTERNAL @FileList string = "ListOfFiles.txt";
@searchLog =
EXTRACT UserId int
, Start DateTime
, Region string
, Query string
, Duration int
, Urls string
, ClickedUrls string
FROM @FileList
USING Extractors.Csv();
如果我将参数 FileList 作为 @variables('FileList')
传递,其中 FileList 是一个数组,我得到以下错误:
Error Id: E_STORE_USER_FAILURE_83090017, Error Message: Invalid pathname Cosmos Path:
它将 FileList 视为:"System.Collections.Generic.List
1[System.Object]"`
如果我将参数 FileList 传递为 @join(variables('FileList'),',')
如果将 FileList 视为:"Dir/File1.txt,Dir/File2.txt"
也就是说,就好像它是单个文件名一样。
我也试过用 @join(variables('FileList'),',')
来做这个:
DECLARE EXTERNAL @FileList string = "ListOfFiles.txt";
@searchLog =
EXTRACT UserId int
, Start DateTime
, Region string
, Query string
, Duration int
, Urls string
, ClickedUrls string
FROM @FileList.Split(',')
USING Extractors.Csv();
但这会产生以下错误:C# error CS0029: Cannot implicitly convert type 'string[]' to 'string'
有办法解决这个问题吗?
请试试这个:
U-SQL:
DECLARE EXTERNAL @FileList1 string = "ListOfFiles.txt";
DECLARE EXTERNAL @FileList2 string = "ListOfFiles.txt";
@searchLog =
EXTRACT UserId int
, Start DateTime
, Region string
, Query string
, Duration int
, Urls string
, ClickedUrls string
FROM @FileList1,@FileList2
USING Extractors.Csv();
OUTPUT @searchLog
TO "/output/exampleD.csv"
USING Outputters.Csv();
参数:
Input Files (U-SQL) 声明输入路径可以采用以下任何形式:
Input_File_Path :=
Single_File_Path
| List_File_Path
| File_Set_Path.
作为 List_File_Path 的示例,他们提供:
@searchLog =
EXTRACT UserId int
, Start DateTime
, Region string
, Query string
, Duration int
, Urls string
, ClickedUrls string
FROM "/Samples/Outputs/ExampleA.csv",
"/Samples/Outputs/ExampleB.csv"
USING Extractors.Csv();
我有以下代码:
DECLARE EXTERNAL @FileList string = "ListOfFiles.txt";
@searchLog =
EXTRACT UserId int
, Start DateTime
, Region string
, Query string
, Duration int
, Urls string
, ClickedUrls string
FROM @FileList
USING Extractors.Csv();
如果我将参数 FileList 作为 @variables('FileList')
传递,其中 FileList 是一个数组,我得到以下错误:
Error Id: E_STORE_USER_FAILURE_83090017, Error Message: Invalid pathname Cosmos Path:
它将 FileList 视为:"System.Collections.Generic.List
1[System.Object]"`
如果我将参数 FileList 传递为 @join(variables('FileList'),',')
如果将 FileList 视为:"Dir/File1.txt,Dir/File2.txt"
也就是说,就好像它是单个文件名一样。
我也试过用 @join(variables('FileList'),',')
来做这个:
DECLARE EXTERNAL @FileList string = "ListOfFiles.txt";
@searchLog =
EXTRACT UserId int
, Start DateTime
, Region string
, Query string
, Duration int
, Urls string
, ClickedUrls string
FROM @FileList.Split(',')
USING Extractors.Csv();
但这会产生以下错误:C# error CS0029: Cannot implicitly convert type 'string[]' to 'string'
有办法解决这个问题吗?
请试试这个:
U-SQL:
DECLARE EXTERNAL @FileList1 string = "ListOfFiles.txt";
DECLARE EXTERNAL @FileList2 string = "ListOfFiles.txt";
@searchLog =
EXTRACT UserId int
, Start DateTime
, Region string
, Query string
, Duration int
, Urls string
, ClickedUrls string
FROM @FileList1,@FileList2
USING Extractors.Csv();
OUTPUT @searchLog
TO "/output/exampleD.csv"
USING Outputters.Csv();
参数: