Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. We propose to deprecate the following methods:

    • TableEnvironment.sqlUpdate(String)

    • TableEnvironment.insertInto(String, Table)
    • TableEnvironment.execute(String)
    • TableEnvironment.explain(boolean)
    • TableEnvironment.fromTableSource(TableSource<?>)
    • Table.insertInto(String)

  2. meanwhile, we propose to introduce the following new methods:

    Code Block
    languagejava
    titleNew methods in TableEnvironment
    :
    New methods in Table:
    interface TableResult {
        // synchronously execute the given single statement immediately, and return the execution result.
    	TableResult executeSql(String statement) throw Exception;
        
        // get the AST and the execution plan for the given single statement (DQL, DML)
        String explainSql(String statement, ExplainDetail... extraDetails);
    
        // create a StatementSet instance which can add DML statements or Tables to the set and explain or execute them as a batch.
        StatementSet createStatementSet();
    }


    New methods in TableEnvironment:

    • TableResult executeSql(String statement) throw Exception;
      synchronously execute the given single statement immediately, and return the execution result.

    • String explainSql(String statement, ExplainDetail... extraDetails);
      get the AST and the execution plan for the given single statement (DQL, DML)
    • StatementSet createStatementSet()
      create a StatementSet instance which can add DML statements or Tables to the set and explain or execute them as a batch.

      New methods in Table:
    • TableResult executeInsert(String tablePath);
      synchronously write the Table to a TableSink that was registered under the specified path.

    • TableResult executeInsert(String tablePath, boolean overwrite);
      synchronously write the Table to a TableSink that was registered under the specified path.

    • String explain(ExplainDetail... details);
      returns the AST and the execution plan to compute the result of the current Table.

    • TableResult execute() throw Exception;
       get the data of the current table.

      Code Block
      languagejava
      titleTableResult
      collapsetrue
      interface TableResult {
          // return the schema of the result
      	TableSchema getTableSchema();
          
          // return the ResultKind which can avoid custom parsing of
          // an "OK" row in programming
          ResultKind getResultKind();
      
          // get the row contents as an iterable rows
          Iterable<Row> collect();
      
          // print the result contents
          void print();
      
    • TableResult executeSql(String statement) throw Exception;
      synchronously execute the given single statement immediately, and return the execution result.
    • String explainSql(String statement, ExplainDetail... extraDetails);
      get the AST and the execution plan for the given single statement (DQL, DML)
    • StatementSet createStatementSet()
      create a StatementSet instance which can add DML statements or Tables to the set and explain or execute them as a batch.
      New methods in Table:interfaceDmlBatch{
          void addInsert(String insert);
          voidaddInsert(String targetPath, Table table);
          ResultTableexecute() throws Exception ;
          Stringexplain(boolean extended);
      }


      publicinterfaceResultTable {
          TableSchema getResultSchema();
          Iterable<Row> getResultRows();
      }

  3. For current messy Flink table program trigger point, we propose that: for TableEnvironment and StreamTableEnvironment, you must use `TableEnvironment.execute()` to trigger table program execution, once you convert the table program to a DataStream program (through `toAppendStream` or `toRetractStream` method), you must use `StreamExecutionEnvironment.execute` to trigger the DataStream program.

...