??????
      
????????????????????StreamTableEnvironment.from("")??????????????????????????????????????????????????????????????????????????datagen??table??????????????????????????????????????????


??????????????
package org.apache.flink.playgrounds.spendreport;


import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.EnvironmentSettings;
import org.apache.flink.table.api.Table;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;


import java.util.Arrays;


public class Test2 {


    public static void main(String[] args) {
        StreamExecutionEnvironment bsEnv = 
StreamExecutionEnvironment.getExecutionEnvironment();
        EnvironmentSettings bsSettings = 
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build();
        StreamTableEnvironment bsTableEnv = 
StreamTableEnvironment.create(bsEnv, bsSettings);


        String sourceDDL = "CREATE TABLE datagen ( " +
                " f_random INT," +
                " f_random_str STRING " 
+
                " ) WITH ( " +
                " 'connector' = 
'datagen', " +
                " 
'rows-per-second'='10'," +
                " 
'fields.f_random.min'='1', " +
                " 
'fields.f_random.max'='10', " +
                " 
'fields.f_random_str.length'='10' " +
                " ) ";
        bsTableEnv.executeSql(sourceDDL);
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i < 10; i++) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Table datagen = 
bsTableEnv.from("datagen");
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(datagen);
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println("-----------------" + 
Arrays.toString(bsTableEnv.listTables()));


&nbsp; &nbsp; }


}


????????
UnnamedTable$0
UnnamedTable$1
UnnamedTable$2
UnnamedTable$3
UnnamedTable$4
UnnamedTable$5
UnnamedTable$6
UnnamedTable$7
UnnamedTable$8
UnnamedTable$9
-----------------[UnnamedTable$0, UnnamedTable$1, UnnamedTable$2, 
UnnamedTable$3, UnnamedTable$4, UnnamedTable$5, UnnamedTable$6, UnnamedTable$7, 
UnnamedTable$8, UnnamedTable$9, datagen]

回复