How to generate dynamic path in dataset during the output method

邮差的信 提交于 2019-12-11 18:44:00

问题


Is there a way to create a dynamic DataSink output path in Flink?

DataSet has data type as Tuple2<String, String>

When we tried using stream I had a way to generate dynamic bath using custom Bucketer like below

@Override
    public Path getBucketPath(Clock clock, Path basePath, Tuple2<String, String> element) {
        return new Path(basePath + "/schema=" + element.f0.toLowerCase().trim() + "/");
    }

I would like to know is there a similar way to handle in DataSet for generating the custom path.


回答1:


I poked around a bit, and didn't find anything similar for batch processing. Which means I think you'd have to create your own OutputFormat class that wraps a regular FileOutputFormat and does bucketing, using the same Bucketer interface.



来源:https://stackoverflow.com/questions/54690095/how-to-generate-dynamic-path-in-dataset-during-the-output-method

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!