public static class CsvTableSource.Builder extends Object
CsvTableSource
instances.
For example:
val source: CsvTableSource = new CsvTableSource.builder()
.path("/path/to/your/file.csv")
.field("myfield", Types.STRING)
.field("myfield2", Types.INT)
.build()
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and 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 |
field(String fieldName,
TypeInformation<?> fieldType)
Adds a field with the field name and the type information.
|
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.
|
public CsvTableSource.Builder path(String path)
path
- the path to the CSV filepublic CsvTableSource.Builder fieldDelimiter(String delim)
delim
- the field delimiterpublic CsvTableSource.Builder lineDelimiter(String delim)
delim
- the line delimiterpublic CsvTableSource.Builder field(String fieldName, TypeInformation<?> fieldType)
fieldName
- the field namefieldType
- the type information of the fieldpublic CsvTableSource.Builder quoteCharacter(Character quote)
quote
- the quote characterpublic CsvTableSource.Builder commentPrefix(String prefix)
prefix
- the prefix to indicate commentspublic CsvTableSource.Builder ignoreFirstLine()
public CsvTableSource.Builder ignoreParseErrors()
public CsvTableSource build()
CsvTableSource
.
CsvTableSource
.Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.