[
https://issues.apache.org/jira/browse/FLINK-5714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15860488#comment-15860488
]
ASF GitHub Bot commented on FLINK-5714:
---------------------------------------
Github user KurtYoung commented on a diff in the pull request:
https://github.com/apache/flink/pull/3273#discussion_r100452526
--- Diff: docs/dev/table_api.md ---
@@ -253,56 +253,51 @@ Table result =
tableEnvironment.ingest("kafka-source");
The `CsvTableSource` is already included in `flink-table` without
additional dependecies.
-It can be configured with the following properties:
-
- - `path` The path to the CSV file, required.
- - `fieldNames` The names of the table fields, required.
- - `fieldTypes` The types of the table fields, required.
- - `fieldDelim` The field delimiter, `","` by default.
- - `rowDelim` 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.
+It can be created by `CsvTableSource.builder()`, the builder has the
following methods to configure properties:
+
+ - `path(String path)` Sets the path to the CSV file, required.
+ - `field(String fieldName, TypeInformation<?> fieldType)` Adds a field
with the field name and field type information, required.
+ - `fieldDelimiter(String delim)` Sets the field delimiter, `","` by
default.
+ - `lineDelimiter(String delim)` Sets the line delimiter, `"\n"` by
default.
+ - `quoteCharacter(Character quote)` Sets the quote character for String
values, `null` by default.
+ - `commentPrefix(String prefix)` Sets a prefix to indicate comments, null
by default.
--- End diff --
Shall we change to null to `null` to keep consistency
> Use a builder pattern for creating CsvTableSource
> -------------------------------------------------
>
> Key: FLINK-5714
> URL: https://issues.apache.org/jira/browse/FLINK-5714
> Project: Flink
> Issue Type: Improvement
> Components: Table API & SQL
> Reporter: Timo Walther
> Assignee: Jark Wu
>
> Right now, the constructor of the CsvTableSource can have up to 9 parameters.
> In Scala this might not be a problem because of default values, but Java
> doesn't have this functionality.
> I propose to have a builder pattern here:
> {code}
> CsvTableSource
> .builder()
> .field("myfield", Types.STRING)
> .field("myfield2", Types.INT)
> .quoteCharacter(';')
> .build()
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)