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
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> 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, registerDataSetInternal, registerDataSetInternal, registerTableSource, scan, sql, translate, writeToSink
config, createUniqueAttributeName, getConfig, getFieldInfo, getFieldInfo, getFrameworkConfig, getFunctionCatalog, getPlanner, getRelBuilder, getRowType, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTableEnvironment, getTypeFactory, isRegistered, registerTable, registerTableInternal, relBuilder, replaceRegisteredTable
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.DataSet
.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.