Package org.apache.flink.api.java.io
Class CsvOutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>
- java.lang.Object
-
- org.apache.flink.api.common.io.RichOutputFormat<IT>
-
- org.apache.flink.api.common.io.FileOutputFormat<T>
-
- org.apache.flink.api.java.io.CsvOutputFormat<T>
-
- 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 serializeTuples 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.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_FIELD_DELIMITERDeprecated.static StringDEFAULT_LINE_DELIMITERDeprecated.
-
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 voidclose()Deprecated.voidopen(int taskNumber, int numTasks)Deprecated.voidsetAllowNullValues(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.voidsetCharsetName(String charsetName)Deprecated.Sets the charset with which the CSV strings are written to the file.voidsetInputType(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.voidsetQuoteStrings(boolean quoteStrings)Deprecated.Configures whether the output format should quote string values.StringtoString()Deprecated.voidwriteRecord(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
-
-
-
-
Field Detail
-
DEFAULT_LINE_DELIMITER
public static final String DEFAULT_LINE_DELIMITER
Deprecated.- See Also:
- Constant Field Values
-
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 typeStringandStringValue, 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 IOExceptionDeprecated.- Specified by:
openin interfaceorg.apache.flink.api.common.io.OutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>- Overrides:
openin classorg.apache.flink.api.common.io.FileOutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>- Throws:
IOException
-
close
public void close() throws IOExceptionDeprecated.- Specified by:
closein interfaceorg.apache.flink.api.common.io.OutputFormat<T extends org.apache.flink.api.java.tuple.Tuple>- Overrides:
closein classorg.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:
writeRecordin interfaceorg.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:
setInputTypein interfaceorg.apache.flink.api.java.typeutils.InputTypeConfigurable
-
-