public class BatchTableEnvironment extends BatchTableEnvironment
TableEnvironment
for a Scala batch DataSet
ExecutionEnvironment
.
A TableEnvironment can be used to:
- convert a DataSet
to a Table
- register a DataSet
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 DataSet
- explain the AST and execution plan of a Table
param: execEnv The Scala batch ExecutionEnvironment
of the TableEnvironment.
param: config The configuration of the TableEnvironment.
Constructor and Description |
---|
BatchTableEnvironment(ExecutionEnvironment execEnv,
TableConfig config) |
Modifier and Type | Method and Description |
---|---|
<T> Table |
fromDataSet(DataSet<T> dataSet)
Converts the given
DataSet into a Table . |
<T> Table |
fromDataSet(DataSet<T> dataSet,
scala.collection.Seq<Expression> fields)
Converts the given
DataSet into a Table with specified field names. |
<T> void |
registerDataSet(String name,
DataSet<T> dataSet)
Registers the given
DataSet as table in the
TableEnvironment 's catalog. |
<T> void |
registerDataSet(String name,
DataSet<T> dataSet,
scala.collection.Seq<Expression> fields)
Registers the given
DataSet as table with specified field names in the
TableEnvironment 's catalog. |
<T,ACC> void |
registerFunction(String name,
AggregateFunction<T,ACC> f,
TypeInformation<T> evidence$3)
Registers an
AggregateFunction under a unique name 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> DataSet<T> |
toDataSet(Table table,
TypeInformation<T> evidence$1)
Converts the given
Table into a DataSet of a specified type. |
checkValidTableName, createUniqueTableName, execEnv, explain, explain, getBuiltInNormRuleSet, getBuiltInPhysicalOptRuleSet, getConversionMapper, optimize, registerDataSetInternal, registerDataSetInternal, registerTableSource, translate, translate, 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 BatchTableEnvironment(ExecutionEnvironment execEnv, TableConfig config)
public <T> Table fromDataSet(DataSet<T> dataSet)
DataSet
into a Table
.
The field names of the Table
are automatically derived from the type of the DataSet
.
dataSet
- The DataSet
to be converted.Table
.public <T> Table fromDataSet(DataSet<T> dataSet, scala.collection.Seq<Expression> fields)
DataSet
into a Table
with specified field names.
Example:
val set: DataSet[(String, Long)] = ...
val tab: Table = tableEnv.fromDataSet(set, 'a, 'b)
dataSet
- The DataSet
to be converted.fields
- The field names of the resulting Table
.Table
.public <T> void registerDataSet(String name, DataSet<T> dataSet)
DataSet
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 DataSet
.
name
- The name under which the DataSet
is registered in the catalog.dataSet
- The DataSet
to register.public <T> void registerDataSet(String name, DataSet<T> dataSet, scala.collection.Seq<Expression> fields)
DataSet
as table with specified field names in the
TableEnvironment
's catalog.
Registered tables can be referenced in SQL queries.
Example:
val set: DataSet[(String, Long)] = ...
tableEnv.registerDataSet("myTable", set, 'a, 'b)
name
- The name under which the DataSet
is registered in the catalog.dataSet
- The DataSet
to register.fields
- The field names of the registered table.public <T> DataSet<T> toDataSet(Table table, TypeInformation<T> evidence$1)
Table
into a DataSet
of a specified type.
The fields of the Table
are mapped to DataSet
fields as follows:
- Row
and Tuple
types: Fields are mapped by position, field types must match.
- POJO DataSet
types: Fields are mapped by field name, field types must match.
table
- The Table
to convert.evidence$1
- (undocumented)DataSet
.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 Table API and SQL queries.
name
- The name under which the function is registered.tf
- The TableFunction to register.evidence$2
- (undocumented)public <T,ACC> void registerFunction(String name, AggregateFunction<T,ACC> f, TypeInformation<T> evidence$3)
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$3
- (undocumented)Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.