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
param: execEnv The Scala StreamExecutionEnvironment
of the TableEnvironment.
param: config The configuration of the TableEnvironment.
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,ACC> void |
registerFunction(String name,
AggregateFunction<T,ACC> f,
TypeInformation<T> evidence$8)
Registers an
AggregateFunction under a unique name in the TableEnvironment's catalog. |
<T> void |
registerFunction(String name,
TableFunction<T> tf,
TypeInformation<T> evidence$7)
Registers a
TableFunction under a unique name in the TableEnvironment's catalog. |
<T> DataStream<T> |
toAppendStream(Table table,
StreamQueryConfig queryConfig,
TypeInformation<T> evidence$4)
Converts the given
Table into an append DataStream of a specified type. |
<T> DataStream<T> |
toAppendStream(Table table,
TypeInformation<T> evidence$3)
Converts the given
Table into an append DataStream of a specified type. |
<T> DataStream<T> |
toDataStream(Table table,
StreamQueryConfig queryConfig,
TypeInformation<T> evidence$2)
Deprecated.
This method only supports conversion of append-only tables. In order to make this more explicit in the future, please use toAppendStream() instead. Since .
|
<T> DataStream<T> |
toDataStream(Table table,
TypeInformation<T> evidence$1)
Deprecated.
This method only supports conversion of append-only tables. In order to make this more explicit in the future, please use toAppendStream() instead. Since .
|
<T> DataStream<scala.Tuple2<Object,T>> |
toRetractStream(Table table,
StreamQueryConfig queryConfig,
TypeInformation<T> evidence$6)
Converts the given
Table into a DataStream of add and retract messages. |
<T> DataStream<scala.Tuple2<Object,T>> |
toRetractStream(Table table,
TypeInformation<T> evidence$5)
Converts the given
Table into a DataStream of add and retract messages. |
checkValidTableName, createUniqueTableName, execEnv, explain, getBuiltInDecoRuleSet, getBuiltInNormRuleSet, getBuiltInPhysicalOptRuleSet, getConversionMapper, getDecoRuleSet, getUniqueKeyFields, isAppendOnly, optimize, queryConfig, registerDataStreamInternal, registerDataStreamInternal, registerTableSource, translate, translate, translateToCRow, writeToSink
attrNameCntr, config, createUniqueAttributeName, DEFAULT_PROCTIME_ATTRIBUTE, DEFAULT_ROWTIME_ATTRIBUTE, functionCatalog, generateRowConverterFunction, getBuiltInLogicalOptRuleSet, getConfig, getFieldIndices, getFieldIndices, getFieldInfo, getFieldInfo, getFieldNames, getFieldNames, getFieldTypes, getFrameworkConfig, getFunctionCatalog, getLogicalOptRuleSet, getNormRuleSet, getPhysicalOptRuleSet, getPlanner, getRegisteredExternalCatalog, getRelBuilder, getRowType, getSqlOperatorTable, getSqlParserConfig, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTypeFactory, isRegistered, registerAggregateFunctionInternal, registerExternalCatalog, registerFunction, registerTable, registerTableFunctionInternal, registerTableInternal, relBuilder, replaceRegisteredTable, runHepPlanner, runVolcanoPlanner, scan, scan, sql, 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 an append DataStream
of a specified type.
The Table
must only have insert (append) changes. If the Table
is also modified
by update or delete changes, the conversion will fail.
The fields of the Table
are mapped to DataStream
fields as follows:
- Row
and Scala Tuple types: Fields are mapped by position, field
types must match.
- POJO DataStream
types: Fields are mapped by field name, field types must match.
NOTE: This method only supports conversion of append-only tables. In order to make this
more explicit in the future, please use toAppendStream()
instead.
If add and retract messages are required, use toRetractStream()
.
table
- The Table
to convert.evidence$1
- (undocumented)DataStream
.public <T> DataStream<T> toDataStream(Table table, StreamQueryConfig queryConfig, TypeInformation<T> evidence$2)
Table
into an append DataStream
of a specified type.
The Table
must only have insert (append) changes. If the Table
is also modified
by update or delete changes, the conversion will fail.
The fields of the Table
are mapped to DataStream
fields as follows:
- Row
and Scala Tuple types: Fields are mapped by position, field
types must match.
- POJO DataStream
types: Fields are mapped by field name, field types must match.
NOTE: This method only supports conversion of append-only tables. In order to make this
more explicit in the future, please use toAppendStream()
instead.
If add and retract messages are required, use toRetractStream()
.
table
- The Table
to convert.queryConfig
- The configuration of the query to generate.evidence$2
- (undocumented)DataStream
.public <T> DataStream<T> toAppendStream(Table table, TypeInformation<T> evidence$3)
Table
into an append DataStream
of a specified type.
The Table
must only have insert (append) changes. If the Table
is also modified
by update or delete changes, the conversion will fail.
The fields of the Table
are mapped to DataStream
fields as follows:
- Row
and Scala 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.evidence$3
- (undocumented)DataStream
.public <T> DataStream<T> toAppendStream(Table table, StreamQueryConfig queryConfig, TypeInformation<T> evidence$4)
Table
into an append DataStream
of a specified type.
The Table
must only have insert (append) changes. If the Table
is also modified
by update or delete changes, the conversion will fail.
The fields of the Table
are mapped to DataStream
fields as follows:
- Row
and Scala 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.queryConfig
- The configuration of the query to generate.evidence$4
- (undocumented)DataStream
.public <T> DataStream<scala.Tuple2<Object,T>> toRetractStream(Table table, TypeInformation<T> evidence$5)
Table
into a DataStream
of add and retract messages.
The message will be encoded as Tuple2
. The first field is a Boolean
flag,
the second field holds the record of the specified type T
.
A true Boolean
flag indicates an add message, a false flag indicates a retract message.
table
- The Table
to convert.evidence$5
- (undocumented)DataStream
.public <T> DataStream<scala.Tuple2<Object,T>> toRetractStream(Table table, StreamQueryConfig queryConfig, TypeInformation<T> evidence$6)
Table
into a DataStream
of add and retract messages.
The message will be encoded as Tuple2
. The first field is a Boolean
flag,
the second field holds the record of the specified type T
.
A true Boolean
flag indicates an add message, a false flag indicates a retract message.
table
- The Table
to convert.queryConfig
- The configuration of the query to generate.evidence$6
- (undocumented)DataStream
.public <T> void registerFunction(String name, TableFunction<T> tf, TypeInformation<T> evidence$7)
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 registerevidence$7
- (undocumented)public <T,ACC> void registerFunction(String name, AggregateFunction<T,ACC> f, TypeInformation<T> evidence$8)
AggregateFunction
under a unique name in the TableEnvironment's catalog.
Registered functions can be referenced in Table API and SQL queries.
name
- The name under which the function is registered.f
- The AggregateFunction to register.evidence$8
- (undocumented)Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.