public class OrcTableSource extends Object implements org.apache.flink.table.sources.BatchTableSource<Row>, ProjectableTableSource<Row>, org.apache.flink.table.sources.FilterableTableSource<Row>
The OrcTableSource
supports projection and filter push-down.
An OrcTableSource
is used as shown in the example below.
OrcTableSource orcSrc = OrcTableSource.builder()
.path("file:///my/data/file.orc")
.forOrcSchema("struct<col1:boolean,col2:tinyint,col3:smallint,col4:int>")
.build();
tEnv.registerTableSource("orcTable", orcSrc);
Table res = tableEnv.sqlQuery("SELECT * FROM orcTable");
Modifier and Type | Class and Description |
---|---|
static class |
OrcTableSource.Builder
Constructs an
OrcTableSource . |
Modifier and Type | Method and Description |
---|---|
TableSource<Row> |
applyPredicate(List<org.apache.flink.table.expressions.Expression> predicates) |
static OrcTableSource.Builder |
builder() |
protected OrcRowInputFormat |
buildOrcInputFormat() |
String |
explainSource()
Describes the table source.
|
DataSet<Row> |
getDataSet(ExecutionEnvironment execEnv) |
TypeInformation<Row> |
getReturnType()
Returns the
TypeInformation for the return type of the TableSource . |
TableSchema |
getTableSchema()
Returns the schema of the produced table.
|
boolean |
isFilterPushedDown() |
TableSource<Row> |
projectFields(int[] selectedFields)
Creates a copy of the
TableSource that projects its output to the given field indexes. |
public DataSet<Row> getDataSet(ExecutionEnvironment execEnv)
getDataSet
in interface org.apache.flink.table.sources.BatchTableSource<Row>
@VisibleForTesting protected OrcRowInputFormat buildOrcInputFormat()
public TypeInformation<Row> getReturnType()
TableSource
TypeInformation
for the return type of the TableSource
.
The fields of the return type are mapped to the table schema based on their name.getReturnType
in interface TableSource<Row>
DataSet
or DataStream
.public TableSchema getTableSchema()
TableSource
getTableSchema
in interface TableSource<Row>
TableSchema
of the produced table.public TableSource<Row> projectFields(int[] selectedFields)
ProjectableTableSource
TableSource
that projects its output to the given field indexes.
The field indexes relate to the physical return type (TableSource.getReturnType()
) and not
to the table schema (TableSource.getTableSchema()
of the TableSource
.
The table schema (TableSource.getTableSchema()
of the TableSource
copy must not be
modified by this method, but only the return type (TableSource.getReturnType()
) and the
produced DataSet
(BatchTableSource#getDataSet(
) or DataStream
(StreamTableSource#getDataStream
).
If the TableSource
implements the DefinedFieldMapping
interface, it might
be necessary to adjust the mapping as well.
IMPORTANT: This method must return a true copy and must not modify the original table source object.
projectFields
in interface ProjectableTableSource<Row>
selectedFields
- The indexes of the fields to return.TableSource
that projects its output.public TableSource<Row> applyPredicate(List<org.apache.flink.table.expressions.Expression> predicates)
applyPredicate
in interface org.apache.flink.table.sources.FilterableTableSource<Row>
public boolean isFilterPushedDown()
isFilterPushedDown
in interface org.apache.flink.table.sources.FilterableTableSource<Row>
public String explainSource()
TableSource
explainSource
in interface TableSource<Row>
TableSource
.public static OrcTableSource.Builder builder()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.