- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的 apache beam 2.2.0 管道中有代码负责将 json 文件写入 Google Cloud Storage。代码如下:
results.apply(ParDo.of(new TableRowToString()))
.apply("WriteProfile", TextIO.write().to(outputBucket)
.withWritableByteChannelFactory(FileBasedSink.CompressionType.GZIP)
.withNumShards(numChunks));
在查看 Eclipse 中的代码时,我注意到它在文本 FileBasedSink.CompressionType.GZIP 上给我警告:
The field FileBasedSink.CompressionType.GZIP is deprecated
将 gzip 文件写入 GCS 的推荐方法是什么,如果在其他地方(apache beam 文档,SO)有记录,该文档的链接是什么?
最佳答案
对于 beam 2.2.0,我不知道还有其他方法可以将压缩数据写入 Google Cloud Storage。
在 Beam 2.3.0+ 中,他们建议使用更新的 FileIO
API。
有了新的FileIO
API 就像附加 withCompression
一样简单调用你的FileIO
链。
FileIO.write().to("gs://bucket/path").withCompression(Compression.GZIP);
如果您无法更新并且真的想要避免弃用您可以自己实现工厂,但这正是FileBasedSink.CompressionType.GZIP
已经这样做了。
TextIO.write().to("gs://bucket/path").withWritableByteChannelFactory(new FileBasedSink.WritableByteChannelFactory() {
@Override
public WritableByteChannel create(final WritableByteChannel channel) throws IOException {
return Compression.GZIP.writeCompressed(channel);
}
@Nullable
@Override
public String getMimeType() {
return MimeTypes.BINARY;
}
@Nullable
@Override
public String getSuggestedFilenameSuffix() {
return Compression.GZIP.getSuggestedSuffix();
}
});
关于java - Apache beam、FileBasedSink.CompressionType.GZIP 已弃用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49737625/
我的 apache beam 2.2.0 管道中有代码负责将 json 文件写入 Google Cloud Storage。代码如下: results.apply(ParDo.of(new Table
在设备上构建和运行我的应用程序时一切都很好。问题是在归档 xcode 的最后总是给出这个错误。你能至少帮我调试一下这个错误吗?因为每次我都需要 20 分钟才能看到它是否再次失败。 获得的调试信息:当我
我是一名优秀的程序员,十分优秀!