Package org.apache.flink.table.sources
Class CsvTableSource.Builder
- java.lang.Object
-
- org.apache.flink.table.sources.CsvTableSource.Builder
-
- Enclosing class:
- CsvTableSource
@Internal public static class CsvTableSource.Builder extends Object
A builder for creating CsvTableSource instances.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CsvTableSource
build()
Apply the current values and constructs a newly-created CsvTableSource.CsvTableSource.Builder
commentPrefix(String prefix)
Sets a prefix to indicate comments, null by default.CsvTableSource.Builder
emptyColumnAsNull()
Treat empty column as null, false by default.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.CsvTableSource.Builder
field(String fieldName, org.apache.flink.table.types.DataType fieldType)
Adds a field with the field name and the data type.CsvTableSource.Builder
fieldDelimiter(String delim)
Sets the field delimiter, "," by default.CsvTableSource.Builder
ignoreFirstLine()
Ignore the first line.CsvTableSource.Builder
ignoreParseErrors()
Skip records with parse error instead to fail.CsvTableSource.Builder
lineDelimiter(String delim)
Sets the line delimiter, "\n" by default.CsvTableSource.Builder
path(String path)
Sets the path to the CSV file.CsvTableSource.Builder
quoteCharacter(Character quote)
Sets a quote character for String values, null by default.
-
-
-
Method Detail
-
path
public CsvTableSource.Builder path(String path)
Sets the path to the CSV file. Required.- Parameters:
path
- the path to the CSV file
-
fieldDelimiter
public CsvTableSource.Builder fieldDelimiter(String delim)
Sets the field delimiter, "," by default.- Parameters:
delim
- the field delimiter
-
lineDelimiter
public CsvTableSource.Builder lineDelimiter(String delim)
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
public CsvTableSource.Builder quoteCharacter(Character quote)
Sets a quote character for String values, null by default.- Parameters:
quote
- the quote character
-
commentPrefix
public CsvTableSource.Builder commentPrefix(String prefix)
Sets a prefix to indicate comments, null by default.- Parameters:
prefix
- the prefix to indicate comments
-
ignoreFirstLine
public CsvTableSource.Builder ignoreFirstLine()
Ignore the first line. Not skip the first line by default.
-
ignoreParseErrors
public CsvTableSource.Builder ignoreParseErrors()
Skip records with parse error instead to fail. Throw an exception by default.
-
emptyColumnAsNull
public CsvTableSource.Builder emptyColumnAsNull()
Treat empty column as null, false by default.
-
build
public CsvTableSource build()
Apply the current values and constructs a newly-created CsvTableSource.- Returns:
- a newly-created CsvTableSource
-
-