how to convert DataSet to DataStream in apache flink
To convert a DataSet to a DataStream in Apache Flink, you can use the .toDataStream() method provided by the DataSet API. Here is an example code snippet:
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<String> dataSet = env.fromElements("hello", "world", "apache", "flink");
DataStream<String> dataStream = dataSet.toDataStream();
In this example, we first create an instance of the ExecutionEnvironment and then create a DataSet of strings. We then use the toDataStream() method to convert the DataSet to a DataStream. The resulting DataStream will have the same elements as the original DataSet.
原文地址: https://www.cveoy.top/t/topic/bfj1 著作权归作者所有。请勿转载和采集!