public class StreamTableEnvironment extends StreamTableEnvironment
TableEnvironment
for a Scala StreamExecutionEnvironment
.
A TableEnvironment can be used to:
- convert a DataStream
to a Table
- register a DataStream
in the TableEnvironment
's catalog
- register a Table
in the TableEnvironment
's catalog
- scan a registered table to obtain a Table
- specify a SQL query on registered tables to obtain a Table
- convert a Table
into a DataStream
- explain the AST and execution plan of a Table
Constructor and Description |
---|
StreamTableEnvironment(StreamExecutionEnvironment execEnv,
TableConfig config) |
Modifier and Type | Method and Description |
---|---|
<T> Table |
fromDataStream(DataStream<T> dataStream)
Converts the given
DataStream into a Table . |
<T> Table |
fromDataStream(DataStream<T> dataStream,
scala.collection.Seq<Expression> fields)
Converts the given
DataStream into a Table with specified field names. |
<T> void |
registerDataStream(String name,
DataStream<T> dataStream)
Registers the given
DataStream as table in the
TableEnvironment 's catalog. |
<T> void |
registerDataStream(String name,
DataStream<T> dataStream,
scala.collection.Seq<Expression> fields)
Registers the given
DataStream as table with specified field names in the
TableEnvironment 's catalog. |
<T> void |
registerFunction(String name,
TableFunction<T> tf,
TypeInformation<T> evidence$2)
Registers a
TableFunction under a unique name in the TableEnvironment's catalog. |
<T> DataStream<T> |
toDataStream(Table table,
TypeInformation<T> evidence$1)
Converts the given
Table into a DataStream of a specified type. |
checkValidTableName, createUniqueTableName, execEnv, explain, getBuiltInRuleSet, getFieldInfo, getFieldInfo, ingest, optimize, registerDataStreamInternal, registerDataStreamInternal, registerTableSource, sql, translate, translate, writeToSink
config, createUniqueAttributeName, getConfig, getFieldIndices, getFieldIndices, getFieldNames, getFieldNames, getFieldTypes, getFrameworkConfig, getFunctionCatalog, getPlanner, getRelBuilder, getRowType, getRuleSet, getSqlOperatorTable, getSqlParserConfig, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTypeFactory, isRegistered, registerFunction, registerTable, registerTableFunctionInternal, registerTableInternal, relBuilder, replaceRegisteredTable, validateType
public StreamTableEnvironment(StreamExecutionEnvironment execEnv, TableConfig config)
public <T> Table fromDataStream(DataStream<T> dataStream)
DataStream
into a Table
.
The field names of the Table
are automatically derived from the type of the
DataStream
.
dataStream
- The DataStream
to be converted.Table
.public <T> Table fromDataStream(DataStream<T> dataStream, scala.collection.Seq<Expression> fields)
DataStream
into a Table
with specified field names.
Example:
val stream: DataStream[(String, Long)] = ...
val tab: Table = tableEnv.fromDataStream(stream, 'a, 'b)
dataStream
- The DataStream
to be converted.fields
- The field names of the resulting Table
.Table
.public <T> void registerDataStream(String name, DataStream<T> dataStream)
DataStream
as table in the
TableEnvironment
's catalog.
Registered tables can be referenced in SQL queries.
The field names of the Table
are automatically derived
from the type of the DataStream
.
name
- The name under which the DataStream
is registered in the catalog.dataStream
- The DataStream
to register.public <T> void registerDataStream(String name, DataStream<T> dataStream, scala.collection.Seq<Expression> fields)
DataStream
as table with specified field names in the
TableEnvironment
's catalog.
Registered tables can be referenced in SQL queries.
Example:
val set: DataStream[(String, Long)] = ...
tableEnv.registerDataStream("myTable", set, 'a, 'b)
name
- The name under which the DataStream
is registered in the catalog.dataStream
- The DataStream
to register.fields
- The field names of the registered table.public <T> DataStream<T> toDataStream(Table table, TypeInformation<T> evidence$1)
Table
into a DataStream
of a specified type.
The fields of the Table
are mapped to DataStream
fields as follows:
- Row
and Tuple
types: Fields are mapped by position, field types must match.
- POJO DataStream
types: Fields are mapped by field name, field types must match.
table
- The Table
to convert.DataStream
.public <T> void registerFunction(String name, TableFunction<T> tf, TypeInformation<T> evidence$2)
TableFunction
under a unique name in the TableEnvironment's catalog.
Registered functions can be referenced in SQL queries.
name
- The name under which the function is registered.tf
- The TableFunction to registerCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.