Class CsvOutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>

  • All Implemented Interfaces:
    Serializable, org.apache.flink.api.common.io.CleanupWhenUnsuccessful, org.apache.flink.api.common.io.InitializeOnMaster, org.apache.flink.api.common.io.OutputFormat<T>, org.apache.flink.api.java.typeutils.InputTypeConfigurable

    @Deprecated
    @PublicEvolving
    public class CsvOutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>
    extends org.apache.flink.api.common.io.FileOutputFormat<T>
    implements org.apache.flink.api.java.typeutils.InputTypeConfigurable
    Deprecated.
    All Flink DataSet APIs are deprecated since Flink 1.18 and will be removed in a future Flink major version. You can still build your application in DataSet, but you should move to either the DataStream and/or Table API.
    This is an OutputFormat to serialize Tuples to text. The output is structured by record delimiters and field delimiters as common in CSV files. Record delimiter separate records from each other ('\n' is common). Field delimiters separate fields within a record.
    See Also:
    FLIP-131: Consolidate the user-facing Dataflow SDKs/APIs (and deprecate the DataSet API, Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.flink.api.common.io.FileOutputFormat

        org.apache.flink.api.common.io.FileOutputFormat.OutputDirectoryMode
      • Nested classes/interfaces inherited from interface org.apache.flink.api.common.io.OutputFormat

        org.apache.flink.api.common.io.OutputFormat.InitializationContext
    • Constructor Summary

      Constructors 
      Constructor Description
      CsvOutputFormat​(org.apache.flink.core.fs.Path outputPath)
      Deprecated.
      Creates an instance of CsvOutputFormat.
      CsvOutputFormat​(org.apache.flink.core.fs.Path outputPath, String fieldDelimiter)
      Deprecated.
      Creates an instance of CsvOutputFormat.
      CsvOutputFormat​(org.apache.flink.core.fs.Path outputPath, String recordDelimiter, String fieldDelimiter)
      Deprecated.
      Creates an instance of CsvOutputFormat.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void close()
      Deprecated.
       
      void open​(int taskNumber, int numTasks)
      Deprecated.
       
      void setAllowNullValues​(boolean allowNulls)
      Deprecated.
      Configures the format to either allow null values (writing an empty field), or to throw an exception when encountering a null field.
      void setCharsetName​(String charsetName)
      Deprecated.
      Sets the charset with which the CSV strings are written to the file.
      void setInputType​(org.apache.flink.api.common.typeinfo.TypeInformation<?> type, org.apache.flink.api.common.ExecutionConfig executionConfig)
      Deprecated.
      The purpose of this method is solely to check whether the data type to be processed is in fact a tuple type.
      void setQuoteStrings​(boolean quoteStrings)
      Deprecated.
      Configures whether the output format should quote string values.
      String toString()
      Deprecated.
       
      void writeRecord​(T element)
      Deprecated.
       
      • Methods inherited from class org.apache.flink.api.common.io.FileOutputFormat

        configure, getDirectoryFileName, getOutputDirectoryMode, getOutputFilePath, getWriteMode, initDefaultsFromConfiguration, initializeGlobal, setOutputDirectoryMode, setOutputFilePath, setWriteMode, tryCleanupOnError
      • Methods inherited from class org.apache.flink.api.common.io.RichOutputFormat

        getRuntimeContext, setRuntimeContext
      • Methods inherited from interface org.apache.flink.api.common.io.OutputFormat

        open
    • Field Detail

      • DEFAULT_FIELD_DELIMITER

        public static final String DEFAULT_FIELD_DELIMITER
        Deprecated.
    • Constructor Detail

      • CsvOutputFormat

        public CsvOutputFormat​(org.apache.flink.core.fs.Path outputPath)
        Deprecated.
        Creates an instance of CsvOutputFormat. Lines are separated by the newline character '\n', fields are separated by ','.
        Parameters:
        outputPath - The path where the CSV file is written.
      • CsvOutputFormat

        public CsvOutputFormat​(org.apache.flink.core.fs.Path outputPath,
                               String fieldDelimiter)
        Deprecated.
        Creates an instance of CsvOutputFormat. Lines are separated by the newline character '\n', fields by the given field delimiter.
        Parameters:
        outputPath - The path where the CSV file is written.
        fieldDelimiter - The delimiter that is used to separate fields in a tuple.
      • CsvOutputFormat

        public CsvOutputFormat​(org.apache.flink.core.fs.Path outputPath,
                               String recordDelimiter,
                               String fieldDelimiter)
        Deprecated.
        Creates an instance of CsvOutputFormat.
        Parameters:
        outputPath - The path where the CSV file is written.
        recordDelimiter - The delimiter that is used to separate the tuples.
        fieldDelimiter - The delimiter that is used to separate fields in a tuple.
    • Method Detail

      • setAllowNullValues

        public void setAllowNullValues​(boolean allowNulls)
        Deprecated.
        Configures the format to either allow null values (writing an empty field), or to throw an exception when encountering a null field.

        by default, null values are disallowed.

        Parameters:
        allowNulls - Flag to indicate whether the output format should accept null values.
      • setCharsetName

        public void setCharsetName​(String charsetName)
        Deprecated.
        Sets the charset with which the CSV strings are written to the file. If not specified, the output format uses the systems default character encoding.
        Parameters:
        charsetName - The name of charset to use for encoding the output.
      • setQuoteStrings

        public void setQuoteStrings​(boolean quoteStrings)
        Deprecated.
        Configures whether the output format should quote string values. String values are fields of type String and StringValue, as well as all subclasses of the latter.

        By default, strings are not quoted.

        Parameters:
        quoteStrings - Flag indicating whether string fields should be quoted.
      • open

        public void open​(int taskNumber,
                         int numTasks)
                  throws IOException
        Deprecated.
        Specified by:
        open in interface org.apache.flink.api.common.io.OutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>
        Overrides:
        open in class org.apache.flink.api.common.io.FileOutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>
        Throws:
        IOException
      • close

        public void close()
                   throws IOException
        Deprecated.
        Specified by:
        close in interface org.apache.flink.api.common.io.OutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>
        Overrides:
        close in class org.apache.flink.api.common.io.FileOutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>
        Throws:
        IOException
      • writeRecord

        public void writeRecord​(T element)
                         throws IOException
        Deprecated.
        Specified by:
        writeRecord in interface org.apache.flink.api.common.io.OutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>
        Throws:
        IOException
      • setInputType

        public void setInputType​(org.apache.flink.api.common.typeinfo.TypeInformation<?> type,
                                 org.apache.flink.api.common.ExecutionConfig executionConfig)
        Deprecated.
        The purpose of this method is solely to check whether the data type to be processed is in fact a tuple type.
        Specified by:
        setInputType in interface org.apache.flink.api.java.typeutils.InputTypeConfigurable