【发布时间】:2021-07-26 18:08:55
【问题描述】:
我正在使用 Apache Beam 管道将 csv 文件从一个容器传输到 Azure 存储中的另一个容器,并且能够成功传输文件,但目标文件中的记录不是按顺序排列的。下面是我用来传输文件的代码。
String format = LocalDateTime.now().format(DateTimeFormatter.ofPattern("YYYY_MM_DD_HH_MM_SS3")).toString();
String connectionString = "<<AZURE_STORAGE_CONNECTION_STRING>>";
PipelineOptions options = PipelineOptionsFactory.create();
options.as(BlobstoreOptions.class).setAzureConnectionString(connectionString);
Pipeline p = Pipeline.create(options);
p.apply(TextIO.read().from("azfs://storageaccountname/containername/CSVSample.csv"))
.apply("",FileIO.<String>write().to("azfs://storageaccountname/containername/"+format+"/").withNumShards(1).withSuffix(".csv")
.via(TextIO.sink()));
p.run().waitUntilFinish();
【问题讨论】:
标签: azure-blob-storage google-cloud-dataflow apache-beam dataflow apache-beam-io