[jira] [Created] (FLINK-16361) FLIP-84: Improve & Refactor API of TableEnvironment

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-16361) FLIP-84: Improve & Refactor API of TableEnvironment

Shang Yuanchun (Jira)
godfrey he created FLINK-16361:
----------------------------------

             Summary: FLIP-84: Improve & Refactor API of TableEnvironment
                 Key: FLINK-16361
                 URL: https://issues.apache.org/jira/browse/FLINK-16361
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / API
            Reporter: godfrey he
             Fix For: 1.11.0


as the [FLIP-84|https://cwiki.apache.org/confluence/display/FLINK/FLIP-84%3A+Improve+%26+Refactor+API+of+TableEnvironment] document described,

We propose to deprecate the following methods in TableEnvironment:
{code:java}
void sqlUpdate(String sql)
void insertInto(String targetPath, Table table)
void execute(String jobName)
String explain(boolean extended)
Table fromTableSource(TableSource<?> source)
{code}

meanwhile, we propose to introduce the following new methods in TableEnvironment:

{code:java}
// synchronously execute the given single statement immediately, and return the execution result.
ResultTable executeStatement(String statement)

public interface ResultTable {
    TableSchema getResultSchema();
    Iterable<Row> getResultRows();
}

// create a DmlBatch instance which can add dml statements or Tables to the batch and explain or execute them as a batch.
DmlBatch createDmlBatch()

interface DmlBatch {
    void addInsert(String insert);
    void addInsert(String targetPath, Table table);
    ResultTable execute() throws Exception ;
    String explain(boolean extended);
}
{code}


We unify the Flink table program trigger point, and 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)