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

    https://github.com/apache/flink/pull/3829#discussion_r139471292
  
    --- Diff: docs/dev/table/sql.md ---
    @@ -49,15 +49,29 @@ DataStream<Tuple3<Long, String, Integer>> ds = 
env.addSource(...);
     
     // SQL query with an inlined (unregistered) table
     Table table = tableEnv.toTable(ds, "user, product, amount");
    -Table result = tableEnv.sql(
    +Table result = tableEnv.sqlQuery(
       "SELECT SUM(amount) FROM " + table + " WHERE product LIKE '%Rubber%'");
     
     // SQL query with a registered table
     // register the DataStream as table "Orders"
     tableEnv.registerDataStream("Orders", ds, "user, product, amount");
     // run a SQL query on the Table and retrieve the result as a new Table
    -Table result2 = tableEnv.sql(
    +Table result2 = tableEnv.sqlQuery(
       "SELECT product, amount FROM Orders WHERE product LIKE '%Rubber%'");
    +
    +// SQL update with a registered table
    +// register the DataStream as table "Orders"
    +tableEnv.registerDataStream("Orders", ds, "user, product, amount");
    +// create a TableSink
    +TableSink csvSink = new CsvTableSink("/path/to/file", ...);
    +// define the field names and types
    +String[] fieldNames = {"id", "product", "amount"};
    --- End diff --
    
    fix schema of result table to query result


---

Reply via email to