Github user sunjincheng121 commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4012#discussion_r118994301
  
    --- Diff: docs/dev/table/common.md ---
    @@ -22,43 +22,38 @@ specific language governing permissions and limitations
     under the License.
     -->
     
    -The Table API and SQL are integrated API and share many concepts and much 
of their API.
    -
    -**TODO: Extend**
    +The Table API and SQL are integrated in a joint API. The central concept 
of this API is a `Table` which serves as input and output of queries. This 
document shows the common structure of programs with Table API and SQL queries, 
how to register a `Table`, how to query a `Table`, and how to emit a `Table`.
     
     * This will be replaced by the TOC
     {:toc}
     
     Structure of Table API and SQL Programs
     ---------------------------------------
     
    -All Table API and SQL programs for batch and streaming have the same 
structure.
    +All Table API and SQL programs for batch and streaming inputs follow the 
same steps. The following code example shows the common structure of Table API 
and SQL programs.
     
     <div class="codetabs" markdown="1">
     <div data-lang="java" markdown="1">
     {% highlight java %}
    +// For batch programs use ExecutionEnvironment instead of 
StreamExecutionEnvironment
     StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
     
     // Create a TableEnvironment
    +// For batch programs use BatchTableEnvironment instead of 
StreamTableEnvironment
     StreamTableEnvironment tableEnv = 
TableEnvironment.getTableEnvironment(env);
     
     // Register a Table
    -tableEnv.registerTable("yourTable", ...)              // or
    -tableEnv.registerTableSource("yourTableSrc", ...);    // or
    -tableEnv.registerDataStream("yourTableStream", ...);  // or
    -tableEnv.registerDataSet("yourTableSet", ...);        // or 
    -tableEnv.registerExternalCatalog("yourCatalog", ...);
    -
    -// Create a table from a Table API query
    -Table tapiResult = tableEnv.scan("yourTableSrc").select(...);
    -// Or create a table from a SQL query
    -Table sqlResult  = tableEnv.sql("SELECT ... FROM yourTableSrc ... ");
    -
    -// Emit a Table to a TableSink / DataStream / DataSet
    -resultTable.writeToSink(...);     // or
    -resultTable.toAppendStream(...);  // or
    -resultTable.toRetractStream(...); // or
    -resultTable.toDataSet(...);
    +tableEnv.registerTable("table1", ...)            // or
    +tableEnv.registerTableSource("table2", ...);     // or
    +tableEnv.registerExternalCatalog("extCat", ...);
    +
    +// Create a Table from a Table API query
    +Table tapiResult = tableEnv.scan("table1").select(...);
    +// Create a Table from a SQL query
    +Table sqlResult  = tableEnv.sql("SELECT ... FROM table2 ... ");
    +
    +// Emit a Table to a TableSink
    +resultTable.writeToSink(...);
     
     // Execute
     env.execute("Your Query");
    --- End diff --
    
    I think change "Your Query" to " Your Query Name" is better. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to