我正在使用同事最近迁移到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)
根据这些信息,是否有人知道上面包含的代码可能会出现什么问题?如果我在其他人发表评论之前自己找到答案,我一定会为未来的开发人员更新这个问题。
答案 0 :(得分:1)
查看Google Cloud Dataflow: Specifying TempLocation via Command Line Argument上的游戏(如6号之后)。
您需要确保存储类位于类路径中。否则,系统不知道如何解释GCP文件名并尝试将其作为本地文件系统查找。