Package org.apache.datafusion
Class CsvWriteOptions
java.lang.Object
org.apache.datafusion.CsvWriteOptions
Configuration knobs for writing CSV, passed to
DataFrame.writeCsv(String, CsvWriteOptions).
Mirrors a subset of DataFusion's DataFrameWriteOptions and the writer-side
CsvOptions. All setters return this for fluent chaining. Defaults: every field
null or empty (meaning the DataFusion default is used).
Path semantics: when singleFileOutput(boolean) is true, the path passed to
writeCsv is the literal output filename. When left unset (the default) and there are no
partition columns, the path is treated as a directory that DataFusion populates with one or more
part-files.
Compression reuses FileCompressionType -- both the read and write sides accept the
same codec set (UNCOMPRESSED, GZIP, BZIP2, XZ, ZSTD).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondelimiter(byte b) Field delimiter byte.escape(byte b) Escape character byte.Output compression codec.hasHeader(boolean v) Whether to write a header row.String to write for SQL NULL values.partitionCols(String... cols) Hive-style partition columns.quote(byte b) Quote character byte.singleFileOutput(boolean v) Whentrue, write to a single file at the supplied path.
-
Constructor Details
-
CsvWriteOptions
public CsvWriteOptions()
-
-
Method Details
-
singleFileOutput
Whentrue, write to a single file at the supplied path. When left unset (the default) and no partition columns are configured, the path is treated as a directory and DataFusion writes one or more part-files. -
partitionCols
Hive-style partition columns. Each column listed here is removed from the data rows and encoded into the directory layout (one subdirectory per distinct value). Mutually exclusive withsingleFileOutput(boolean)-- DataFusion rejects the combination at write time. -
hasHeader
Whether to write a header row. Defaults to DataFusion's setting (typicallytrue). -
delimiter
Field delimiter byte. Defaults to','. -
quote
Quote character byte. Defaults to'"'. -
escape
Escape character byte. Defaults to none. -
nullValue
String to write for SQL NULL values. Defaults to the empty string. -
fileCompressionType
Output compression codec. Defaults to uncompressed.
-