[ 
https://issues.apache.org/jira/browse/FLINK-16366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kurt Young closed FLINK-16366.
------------------------------
    Resolution: Fixed

master: e0d2db7e2015aad73a1eda092a600cf92c78bb43

> Introduce executeSql method in TableEnvironment
> -----------------------------------------------
>
>                 Key: FLINK-16366
>                 URL: https://issues.apache.org/jira/browse/FLINK-16366
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API
>            Reporter: godfrey he
>            Assignee: godfrey he
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.11.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> This issue aims to introduce {{executeSql}} which can execute the given 
> single statement, and returns the execution result. 
> This method only supports executing a single statement which can be DDL, DML, 
> DQL, SHOW, DESCRIBE, EXPLAIN and USE.  For DML and DQL, this method returns 
> TableResult once the job has been submitted. For DDL and DCL statements, 
> TableResult is returned once the operation has finished.
> {code:java}
> interface TableEnvironment {
>      /**
>       * Execute the given single statement and
>       * the statement can be DDL/DML/DQL/SHOW/DESCRIBE/EXPLAIN/USE.
>       *
>       * If the statement is translated to a Flink job (DML/DQL),
>       * the TableResult will be returned until the job is submitted, and
>       * contains a JobClient instance to associate the job.
>       * Else, the TableResult will be returned until the statement
>       * execution is finished, does not contain a JobClient instance.
>       *
>       * @return result for DQL/SHOW/DESCRIBE/EXPLAIN, the affected row count
>       * for `DML` (-1 means unknown),or a string message ("OK") for other 
>       * statements.
>       */
>     TableResult executeSql(String statement);
> }
> /**
>  * A TableResult is the representation of the statement execution result.
>  */
> interface TableResult {
>    /**
>     * return JobClient if a Flink job is submitted
>     * (for DML/DQL statement), else return empty (e.g. DDL).
>     */
>    Optional<JobClient> getJobClient();
>  
>    /** 
>     * Get the schema of result. 
>     */
>     TableSchema getTableSchema();
>      
>     /**
>      * return the ResultKind which can avoid custom parsing of
>      * an "OK" row in programming
>      */
>     ResultKind getResultKind();
>  
>      /**
>       * Get the result contents as an iterable rows.
>       */
>     Iterator<Row> collect();
>  
>     /**
>      * Print the result contents.
>      */
>     void print();
> }
> /**
>  * ResultKind defines the types of the result.
>  */
> public enum ResultKind {
>     // for DDL, DCL and statements with a simple "OK"
>     SUCCESS,
>  
>     // rows with important content are available (DML, DQL)
>     SUCCESS_WITH_CONTENT
> }
> {code}



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

Reply via email to