SELECT queries are specified with the
method of the
returns the result of the
SELECT query as a
Table can be used for subsequent SQL and Table API queries, to be converted
DataStream, and to be written to a
TableSink. SQL and Table API queries can be seamlessly mixed, and
are holistically optimized and translated into a single program.
Tablein a SQL query, it must be registered in the
Tablecan be registered from the following ways:
Alternatively, users can also register catalogs in a
specify the location of the data sources.
DataStream<Tuple2<String, Integer>> transactionStream = ... tEnv.createTemporaryView("Transactions", transactionStream, "account, amount"); Table balance = tEnv.sqlQuery( "SELECT account, sum(amount) as balance FROM Transactions GROUP BY account" ); DataStream<Tuple2<Boolean, Row>> balanceStream = tEnv.toRetractStream(balance, Row.class);
For the detailed documentation and the example code for the different query types, see the Apache Flink documentation.