[
https://issues.apache.org/jira/browse/FLINK-10487?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bowen Li updated FLINK-10487:
-----------------------------
Description:
On https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql.html ,
the example is :
{code:java}
StreamExecutionEnvironment env =
StreamExecutionEnvironment.getExecutionEnvironment();
StreamTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);
// ingest a DataStream from an external source
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.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.sqlQuery(
"SELECT product, amount FROM Orders WHERE product LIKE '%Rubber%'");
...
{code}
But there's no APIs like {{toTable()}} in StreamTableEnvironment
cc [[email protected]]
was:
On https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql.html ,
the example is :
{code:java}
StreamExecutionEnvironment env =
StreamExecutionEnvironment.getExecutionEnvironment();
StreamTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);
// ingest a DataStream from an external source
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.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.sqlQuery(
"SELECT product, amount FROM Orders WHERE product LIKE '%Rubber%'");
...
{code}
But there's no APIs like {{toTable()}} in StreamTableEnvironment
> fix invalid Flink SQL example
> -----------------------------
>
> Key: FLINK-10487
> URL: https://issues.apache.org/jira/browse/FLINK-10487
> Project: Flink
> Issue Type: Bug
> Components: Documentation, Table API & SQL
> Affects Versions: 1.6.0, 1.6.1, 1.7.0
> Reporter: Bowen Li
> Assignee: Bowen Li
> Priority: Major
> Fix For: 1.7.0
>
>
> On https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql.html
> , the example is :
> {code:java}
> StreamExecutionEnvironment env =
> StreamExecutionEnvironment.getExecutionEnvironment();
> StreamTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);
> // ingest a DataStream from an external source
> 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.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.sqlQuery(
> "SELECT product, amount FROM Orders WHERE product LIKE '%Rubber%'");
> ...
> {code}
> But there's no APIs like {{toTable()}} in StreamTableEnvironment
> cc [[email protected]]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)