can not find toDataStresam in DataSet in apache flink
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.
原文地址: http://www.cveoy.top/t/topic/bfiT 著作权归作者所有。请勿转载和采集!