I am using the Table API on Flink 1.4.0. I have some Table
objects to be convert to a DataSet
of type Row
. The project was built using Maven and imported on IntelliJ. I have the following code and the IDE cannot resolve the method tableenv.toDataSet()
method. Please help me out. Thank you.
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
BatchTableEnvironment tableEnvironment = TableEnvironment.getTableEnvironment(env);
...
tableEnvironment.registerTableSource("table1",csvSource);
Table table1 = tableEnvironment.scan("table1");
DataSet<Row> result = tableEnvironment.toDataSet(table1, Row.class);
The last statement causes an error
"Cannot resolve toDataSet() method"
You might not import the right BatchTableEnvironment
.
Please check that you import org.apache.flink.table.api.java.BatchTableEnvironment
instead of org.apache.flink.table.api.BatchTableEnvironment
. The former is the common base class for the Java and Scala variants.