The correct method name is writeAsText() instead of toDataStream() in Apache Flink's DataSet API. This method writes the DataSet to a text file or a text stream.

Example usage:

DataSet<String> input = env.fromElements("hello", "world");
input.writeAsText("output.txt");

This will write the contents of the DataSet to a text file named "output.txt".

Alternatively, you can also use print() method to print the contents of the DataSet to the console:

DataSet<String> input = env.fromElements("hello", "world");
input.print();

This will print the contents of the DataSet to the console.

can not find toDataStresam in DataSet in apache flink

原文地址: http://www.cveoy.top/t/topic/bfiT 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录