簡體   English   中英

使用Azure Data Lake Store的MsConcat功能合並CSV文件時,可以跳過標題行嗎?

[英]Can I skip header row while merging CSV files using MsConcat function of Azure Data Lake Store?

是我正在使用的功能:

public static void MsConcat (this Microsoft.Azure.Management.DataLake.Store.IFileSystemOperations operations,
                             string accountName,
                             string msConcatDestinationPath,
                             System.IO.Stream streamContents,
                             Nullable<bool> deleteSourceDirectory = null);

使用MsConcat時,無法跳過標題行。 MsConcat在文件級別運行,沒有“行”的概念。 它僅以字節級別連接文件的內容。

僅當使用U-SQL或Scala之類的文件解釋文件的內容時,行概念才會出現。 因此,您可以找到跳過標題行的結構。

要從U-SQL的角度詳細闡述Amit的答案,請執行以下操作:內置的Extractors.Csv()提供了跳過前幾行的選項,並且輸出程序可以添加新的標題行。 如果您的數據格式與此相對應,這是一個偽代碼示例:

@data = EXTRACT a int, b string // ... or whatever your CSV schema is
        FROM "/filestobeconcatenated/{*}" // provide the file set to the files you want to concat
        USING Extractors.Csv(skipFirstNRows:1); // skip header row. Maybe add other parameters

OUTPUT @data 
TO "/concatenated.csv"
USING Outputters.Csv(outputHeader:true);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM