Class CsvTableSource.Builder

  • Enclosing class:
    CsvTableSource

    @Internal
    public static class CsvTableSource.Builder
    extends Object
    A builder for creating CsvTableSource instances.
    • Constructor Detail

      • Builder

        public Builder()
    • 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 name
        fieldType - 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 use field(String, DataType) instead which uses the new type system based on DataTypes. 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 name
        fieldType - 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