Package org.apache.flink.table.sources
Class CsvTableSource.Builder
java.lang.Object
org.apache.flink.table.sources.CsvTableSource.Builder
- Enclosing class:
- CsvTableSource
A builder for creating CsvTableSource instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Apply the current values and constructs a newly-created CsvTableSource.commentPrefix(String prefix) Sets a prefix to indicate comments, null by default.Treat empty column as null, false by default.Deprecated.This method will be removed in future versions as it uses the old type system.Adds a field with the field name and the data type.fieldDelimiter(String delim) Sets the field delimiter, "," by default.Ignore the first line.Skip records with parse error instead to fail.lineDelimiter(String delim) Sets the line delimiter, "\n" by default.Sets the path to the CSV file.quoteCharacter(Character quote) Sets a quote character for String values, null by default.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
path
Sets the path to the CSV file. Required.- Parameters:
path- the path to the CSV file
-
fieldDelimiter
Sets the field delimiter, "," by default.- Parameters:
delim- the field delimiter
-
lineDelimiter
Sets the line delimiter, "\n" by default.- Parameters:
delim- the line delimiter
-
field
public CsvTableSource.Builder field(String fieldName, org.apache.flink.table.types.DataType fieldType) Adds a field with the field name and the data type. Required. This method can be called multiple times. The call order of this method defines also the order of the fields in a row.- Parameters:
fieldName- the field namefieldType- the data type of the field
-
field
@Deprecated public CsvTableSource.Builder field(String fieldName, org.apache.flink.api.common.typeinfo.TypeInformation<?> fieldType) Deprecated.This method will be removed in future versions as it uses the old type system. It is recommended to usefield(String, DataType)instead which uses the new type system based onDataTypes. Please make sure to use either the old or the new type system consistently to avoid unintended behavior. See the website documentation for more information.Adds a field with the field name and the type information. Required. This method can be called multiple times. The call order of this method defines also the order of the fields in a row.- Parameters:
fieldName- the field namefieldType- the type information of the field
-
quoteCharacter
Sets a quote character for String values, null by default.- Parameters:
quote- the quote character
-
commentPrefix
Sets a prefix to indicate comments, null by default.- Parameters:
prefix- the prefix to indicate comments
-
ignoreFirstLine
Ignore the first line. Not skip the first line by default. -
ignoreParseErrors
Skip records with parse error instead to fail. Throw an exception by default. -
emptyColumnAsNull
Treat empty column as null, false by default. -
build
Apply the current values and constructs a newly-created CsvTableSource.- Returns:
- a newly-created CsvTableSource
-