Class CsvTableSource
- java.lang.Object
-
- org.apache.flink.table.sources.CsvTableSource
-
- All Implemented Interfaces:
StreamTableSource<Row>
,LookupableTableSource<Row>
,ProjectableTableSource<Row>
,TableSource<Row>
@Internal @Deprecated public class CsvTableSource extends Object implements StreamTableSource<Row>, LookupableTableSource<Row>, ProjectableTableSource<Row>
Deprecated.The legacy CSV connector has been replaced byFileSource
. It is kept only to support tests for the legacy connector stack.AStreamTableSource
for simple CSV files with a (logically) unlimited number of fields.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CsvTableSource.Builder
Deprecated.A builder for creating CsvTableSource instances.static class
CsvTableSource.CsvLookupFunction
Deprecated.LookupFunction to support lookup in CsvTableSource.
-
Constructor Summary
Constructors Constructor Description CsvTableSource(String path, String[] fieldNames, TypeInformation<?>[] fieldTypes)
Deprecated.AInputFormatTableSource
andLookupableTableSource
for simple CSV files with a (logically) unlimited number of fields.CsvTableSource(String path, String[] fieldNames, TypeInformation<?>[] fieldTypes, int[] selectedFields, String fieldDelim, String lineDelim, Character quoteCharacter, boolean ignoreFirstLine, String ignoreComments, boolean lenient)
Deprecated.AInputFormatTableSource
andLookupableTableSource
for simple CSV files with a (logically) unlimited number of fields.CsvTableSource(String path, String[] fieldNames, TypeInformation<?>[] fieldTypes, String fieldDelim, String lineDelim, Character quoteCharacter, boolean ignoreFirstLine, String ignoreComments, boolean lenient)
Deprecated.AInputFormatTableSource
andLookupableTableSource
for simple CSV files with a (logically) unlimited number of fields.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static CsvTableSource.Builder
builder()
Deprecated.Return a new builder that builds a CsvTableSource.boolean
equals(Object o)
Deprecated.String
explainSource()
Deprecated.Describes the table source.AsyncTableFunction<Row>
getAsyncLookupFunction(String[] lookupKeys)
Deprecated.Gets theAsyncTableFunction
which supports async lookup one key at a time.DataStream<Row>
getDataStream(StreamExecutionEnvironment execEnv)
Deprecated.Returns the data of the table as aDataStream
.TableFunction<Row>
getLookupFunction(String[] lookupKeys)
Deprecated.Gets theTableFunction
which supports lookup one key at a time.DataType
getProducedDataType()
Deprecated.Returns theDataType
for the produced data of theTableSource
.TableSchema
getTableSchema()
Deprecated.Returns the schema of the produced table.int
hashCode()
Deprecated.boolean
isAsyncEnabled()
Deprecated.Returns true if async lookup is enabled.boolean
isBounded()
Deprecated.Returns true if this is a bounded source, false if this is an unbounded source.CsvTableSource
projectFields(int[] fields)
Deprecated.Creates a copy of theTableSource
that projects its output to the given field indexes.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.table.legacy.sources.TableSource
getReturnType
-
-
-
-
Constructor Detail
-
CsvTableSource
public CsvTableSource(String path, String[] fieldNames, TypeInformation<?>[] fieldTypes)
Deprecated.AInputFormatTableSource
andLookupableTableSource
for simple CSV files with a (logically) unlimited number of fields.- Parameters:
path
- The path to the CSV file.fieldNames
- The names of the table fields.fieldTypes
- The types of the table fields.
-
CsvTableSource
public CsvTableSource(String path, String[] fieldNames, TypeInformation<?>[] fieldTypes, String fieldDelim, String lineDelim, Character quoteCharacter, boolean ignoreFirstLine, String ignoreComments, boolean lenient)
Deprecated.AInputFormatTableSource
andLookupableTableSource
for simple CSV files with a (logically) unlimited number of fields.- Parameters:
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.
-
CsvTableSource
public CsvTableSource(String path, String[] fieldNames, TypeInformation<?>[] fieldTypes, int[] selectedFields, String fieldDelim, String lineDelim, Character quoteCharacter, boolean ignoreFirstLine, String ignoreComments, boolean lenient)
Deprecated.AInputFormatTableSource
andLookupableTableSource
for simple CSV files with a (logically) unlimited number of fields.- Parameters:
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.
-
-
Method Detail
-
builder
public static CsvTableSource.Builder builder()
Deprecated.Return a new builder that builds a CsvTableSource. For example:CsvTableSource source = new CsvTableSource.builder() .path("/path/to/your/file.csv") .field("myfield", Types.STRING) .field("myfield2", Types.INT) .build();
- Returns:
- a new builder to build a CsvTableSource
-
getProducedDataType
public DataType getProducedDataType()
Deprecated.Description copied from interface:TableSource
Returns theDataType
for the produced data of theTableSource
.- Specified by:
getProducedDataType
in interfaceTableSource<Row>
- Returns:
- The data type of the returned
DataStream
.
-
getTableSchema
public TableSchema getTableSchema()
Deprecated.Description copied from interface:TableSource
Returns the schema of the produced table.- Specified by:
getTableSchema
in interfaceTableSource<Row>
- Returns:
- The
TableSchema
of the produced table.
-
projectFields
public CsvTableSource projectFields(int[] fields)
Deprecated.Description copied from interface:ProjectableTableSource
Creates a copy of theTableSource
that projects its output to the given field indexes. The field indexes relate to the physical produced data type (TableSource.getProducedDataType()
) and not to the table schema (TableSource.getTableSchema()
of theTableSource
.The table schema (
TableSource.getTableSchema()
of theTableSource
copy must not be modified by this method, but only the produced data type (TableSource.getProducedDataType()
) and the producedDataStream
(StreamTableSource#getDataStream
).If the
TableSource
implements theDefinedFieldMapping
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.
- Specified by:
projectFields
in interfaceProjectableTableSource<Row>
- Parameters:
fields
- The indexes of the fields to return.- Returns:
- A copy of the
TableSource
that projects its output.
-
isBounded
public boolean isBounded()
Deprecated.Description copied from interface:StreamTableSource
Returns true if this is a bounded source, false if this is an unbounded source. Default is unbounded for compatibility.- Specified by:
isBounded
in interfaceStreamTableSource<Row>
-
getDataStream
public DataStream<Row> getDataStream(StreamExecutionEnvironment execEnv)
Deprecated.Description copied from interface:StreamTableSource
Returns the data of the table as aDataStream
.NOTE: This method is for internal use only for defining a
TableSource
. Do not use it in Table API programs.- Specified by:
getDataStream
in interfaceStreamTableSource<Row>
-
getLookupFunction
public TableFunction<Row> getLookupFunction(String[] lookupKeys)
Deprecated.Description copied from interface:LookupableTableSource
Gets theTableFunction
which supports lookup one key at a time.- Specified by:
getLookupFunction
in interfaceLookupableTableSource<Row>
- Parameters:
lookupKeys
- the chosen field names as lookup keys, it is in the defined order
-
getAsyncLookupFunction
public AsyncTableFunction<Row> getAsyncLookupFunction(String[] lookupKeys)
Deprecated.Description copied from interface:LookupableTableSource
Gets theAsyncTableFunction
which supports async lookup one key at a time.- Specified by:
getAsyncLookupFunction
in interfaceLookupableTableSource<Row>
- Parameters:
lookupKeys
- the chosen field names as lookup keys, it is in the defined order
-
isAsyncEnabled
public boolean isAsyncEnabled()
Deprecated.Description copied from interface:LookupableTableSource
Returns true if async lookup is enabled.The lookup function returned by
LookupableTableSource.getAsyncLookupFunction(String[])
will be used if returns true. Otherwise, the lookup function returned byLookupableTableSource.getLookupFunction(String[])
will be used.- Specified by:
isAsyncEnabled
in interfaceLookupableTableSource<Row>
-
explainSource
public String explainSource()
Deprecated.Description copied from interface:TableSource
Describes the table source.- Specified by:
explainSource
in interfaceTableSource<Row>
- Returns:
- A String explaining the
TableSource
.
-
-