public class CsvTableSource extends Object implements StreamTableSource<org.apache.flink.types.Row>, BatchTableSource<org.apache.flink.types.Row>, org.apache.flink.table.sources.LookupableTableSource<org.apache.flink.types.Row>, org.apache.flink.table.sources.ProjectableTableSource<org.apache.flink.types.Row>
StreamTableSource and BatchTableSource for simple CSV files with a (logically)
unlimited number of fields.| Modifier and Type | Class and Description |
|---|---|
static class |
CsvTableSource.Builder
A builder for creating CsvTableSource instances.
|
static class |
CsvTableSource.CsvLookupFunction
LookupFunction to support lookup in CsvTableSource.
|
| Constructor and Description |
|---|
CsvTableSource(String path,
String[] fieldNames,
org.apache.flink.api.common.typeinfo.TypeInformation<?>[] fieldTypes)
A
InputFormatTableSource and LookupableTableSource for simple CSV files with
a (logically) unlimited number of fields. |
CsvTableSource(String path,
String[] fieldNames,
org.apache.flink.api.common.typeinfo.TypeInformation<?>[] fieldTypes,
int[] selectedFields,
String fieldDelim,
String lineDelim,
Character quoteCharacter,
boolean ignoreFirstLine,
String ignoreComments,
boolean lenient)
A
InputFormatTableSource and LookupableTableSource for simple CSV files with
a (logically) unlimited number of fields. |
CsvTableSource(String path,
String[] fieldNames,
org.apache.flink.api.common.typeinfo.TypeInformation<?>[] fieldTypes,
String fieldDelim,
String lineDelim,
Character quoteCharacter,
boolean ignoreFirstLine,
String ignoreComments,
boolean lenient)
A
InputFormatTableSource and LookupableTableSource for simple CSV files with
a (logically) unlimited number of fields. |
| Modifier and Type | Method and Description |
|---|---|
static CsvTableSource.Builder |
builder()
Return a new builder that builds a CsvTableSource.
|
boolean |
equals(Object o) |
String |
explainSource() |
org.apache.flink.table.functions.AsyncTableFunction<org.apache.flink.types.Row> |
getAsyncLookupFunction(String[] lookupKeys) |
org.apache.flink.api.java.DataSet<org.apache.flink.types.Row> |
getDataSet(org.apache.flink.api.java.ExecutionEnvironment execEnv)
Returns the data of the table as a
DataSet. |
org.apache.flink.streaming.api.datastream.DataStream<org.apache.flink.types.Row> |
getDataStream(org.apache.flink.streaming.api.environment.StreamExecutionEnvironment execEnv)
Returns the data of the table as a
DataStream. |
org.apache.flink.table.functions.TableFunction<org.apache.flink.types.Row> |
getLookupFunction(String[] lookupKeys) |
org.apache.flink.table.types.DataType |
getProducedDataType() |
org.apache.flink.table.api.TableSchema |
getTableSchema() |
int |
hashCode() |
boolean |
isAsyncEnabled() |
boolean |
isBounded()
Returns true if this is a bounded source, false if this is an unbounded source.
|
CsvTableSource |
projectFields(int[] fields) |
public CsvTableSource(String path, String[] fieldNames, org.apache.flink.api.common.typeinfo.TypeInformation<?>[] fieldTypes)
InputFormatTableSource and LookupableTableSource for simple CSV files with
a (logically) unlimited number of fields.path - The path to the CSV file.fieldNames - The names of the table fields.fieldTypes - The types of the table fields.public CsvTableSource(String path, String[] fieldNames, org.apache.flink.api.common.typeinfo.TypeInformation<?>[] fieldTypes, String fieldDelim, String lineDelim, Character quoteCharacter, boolean ignoreFirstLine, String ignoreComments, boolean lenient)
InputFormatTableSource and LookupableTableSource for simple CSV files with
a (logically) unlimited number of fields.path - The path to the CSV file.fieldNames - The names of the table fields.fieldTypes - The types of the table fields.fieldDelim - The field delimiter, "," by default.lineDelim - The row delimiter, "\n" by default.quoteCharacter - An optional quote character for String values, null by default.ignoreFirstLine - Flag to ignore the first line, false by default.ignoreComments - An optional prefix to indicate comments, null by default.lenient - Flag to skip records with parse error instead to fail, false by default.public CsvTableSource(String path, String[] fieldNames, org.apache.flink.api.common.typeinfo.TypeInformation<?>[] fieldTypes, int[] selectedFields, String fieldDelim, String lineDelim, Character quoteCharacter, boolean ignoreFirstLine, String ignoreComments, boolean lenient)
InputFormatTableSource and LookupableTableSource for simple CSV files with
a (logically) unlimited number of fields.path - The path to the CSV file.fieldNames - The names of the table fields.fieldTypes - The types of the table fields.selectedFields - The fields which will be read and returned by the table source. If
None, all fields are returned.fieldDelim - The field delimiter, "," by default.lineDelim - The row delimiter, "\n" by default.quoteCharacter - An optional quote character for String values, null by default.ignoreFirstLine - Flag to ignore the first line, false by default.ignoreComments - An optional prefix to indicate comments, null by default.lenient - Flag to skip records with parse error instead to fail, false by default.public static CsvTableSource.Builder builder()
CsvTableSource source = new CsvTableSource.builder()
.path("/path/to/your/file.csv")
.field("myfield", Types.STRING)
.field("myfield2", Types.INT)
.build();
public org.apache.flink.table.types.DataType getProducedDataType()
getProducedDataType in interface org.apache.flink.table.sources.TableSource<org.apache.flink.types.Row>public org.apache.flink.table.api.TableSchema getTableSchema()
getTableSchema in interface org.apache.flink.table.sources.TableSource<org.apache.flink.types.Row>public CsvTableSource projectFields(int[] fields)
projectFields in interface org.apache.flink.table.sources.ProjectableTableSource<org.apache.flink.types.Row>public boolean isBounded()
StreamTableSourceisBounded in interface StreamTableSource<org.apache.flink.types.Row>public org.apache.flink.streaming.api.datastream.DataStream<org.apache.flink.types.Row> getDataStream(org.apache.flink.streaming.api.environment.StreamExecutionEnvironment execEnv)
StreamTableSourceDataStream.
NOTE: This method is for internal use only for defining a TableSource. Do not use
it in Table API programs.
getDataStream in interface StreamTableSource<org.apache.flink.types.Row>public org.apache.flink.api.java.DataSet<org.apache.flink.types.Row> getDataSet(org.apache.flink.api.java.ExecutionEnvironment execEnv)
BatchTableSourceDataSet.
NOTE: This method is for internal use only for defining a TableSource. Do not use
it in Table API programs.
getDataSet in interface BatchTableSource<org.apache.flink.types.Row>public org.apache.flink.table.functions.TableFunction<org.apache.flink.types.Row> getLookupFunction(String[] lookupKeys)
getLookupFunction in interface org.apache.flink.table.sources.LookupableTableSource<org.apache.flink.types.Row>public org.apache.flink.table.functions.AsyncTableFunction<org.apache.flink.types.Row> getAsyncLookupFunction(String[] lookupKeys)
getAsyncLookupFunction in interface org.apache.flink.table.sources.LookupableTableSource<org.apache.flink.types.Row>public boolean isAsyncEnabled()
isAsyncEnabled in interface org.apache.flink.table.sources.LookupableTableSource<org.apache.flink.types.Row>public String explainSource()
explainSource in interface org.apache.flink.table.sources.TableSource<org.apache.flink.types.Row>Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.