Class | Description |
---|---|
JavaBatchTranslator | |
JavaStreamingTranslator |
PlanTranslator for creating Table s from Java DataStream s and
translating them back to Java DataStream s. |
TableEnvironment |
Environment for working with the Table API.
|
TableEnvironment
can be used to create a
Table
from a DataSet
or DataStream
.
This can be used to perform SQL-like queries on data. Please have
a look at Table
to see which operations are supported and
how query strings are written.
Example:
ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment();
DataSet<WC> input = env.fromElements(
new WC("Hello", 1),
new WC("Ciao", 1),
new WC("Hello", 1));
Table table = TableUtil.from(input);
Table filtered = table
.groupBy("word")
.select("word.count as count, word")
.filter("count = 2");
DataSet<WC> result = TableUtil.toSet(filtered, WC.class);
result.print();
env.execute();
As seen above, a Table
can be converted back to the
underlying API representation using TableEnvironment.toDataSet(org.apache.flink.api.table.Table, java.lang.Class)
or TableEnvironment.toDataStream(org.apache.flink.api.table.Table, java.lang.Class)
}.
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.