gpt4 book ai didi

java - 为什么 Apache Beam 2.2 写入 GCS 失败?

转载 作者:行者123 更新时间:2023-12-02 11:31:17 27 4
gpt4 key购买 nike

我正在使用一个同事最近迁移到版本 2.2.0 的数据流管道。管道中引发错误的相关步骤如下:

domainOutputBucket = "gs://output/partner/20180311/raw/DomainBatch20180311_"

output.get(domainsOut)
.setCoder(StringUtf8Coder.of())
.apply("WriteDomain" + description, TextIO.write()
.to(domainOutputBucket).withSuffix(".csv") // <-- line 109
.withWritableByteChannelFactory(FileBasedSink.CompressionType.GZIP)
.withNumShards(numChunksCustom));

但是,当编译此代码时,会出现以下错误和堆栈跟踪:

Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 2: gs://output/partner/20180311/raw/DomainBatch20180311_
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.nio.file.Paths.get(Paths.java:84)
at org.apache.beam.sdk.io.LocalFileSystem.matchNewResource(LocalFileSystem.java:196)
at org.apache.beam.sdk.io.LocalFileSystem.matchNewResource(LocalFileSystem.java:78)
at org.apache.beam.sdk.io.FileSystems.matchNewResource(FileSystems.java:544)
at org.apache.beam.sdk.io.FileBasedSink.convertToFileResourceIfPossible(FileBasedSink.java:213)
at org.apache.beam.sdk.io.TextIO$TypedWrite.to(TextIO.java:679)
at org.apache.beam.sdk.io.TextIO$Write.to(TextIO.java:997)
at com.package.output.Partner.partnerPipeline(Partner.java:109)
at com.package.output.Output.Export(Output.java:285)
at com.package.output.Output.main(Output.java:254)

根据此信息,有人知道我上面包含的代码可能存在什么问题吗?如果我在其他人发表评论之前自己找到答案,我一定会为 future 的开发人员更新这个问题。

最佳答案

看看 Google Cloud Dataflow: Specifying TempLocation via Command Line Argument 上的评论(如数字 6 之后)。

您需要确保存储类位于您的类路径上。否则,系统不知道如何解释 GCP 文件名,并尝试将其查找为本地文件系统。

关于java - 为什么 Apache Beam 2.2 写入 GCS 失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49288328/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com