Spark file output
Description
Spark file output writes the incoming Dataset with df.write.format(…).save(path) on the native Spark pipeline engine.
It is the bulk output of the native Spark engine: Spark writes one part file per partition in parallel on the executors, so use it instead of the classic Text File Output or Parquet File Output transforms for large or partitioned writes.
This transform is not available on the local Hop engine or on the Beam engines. It is a leaf: the write is executed as a Spark action when the engine materialises the pipeline, and no rows are passed on.
The path is a Spark/Hadoop FileSystem URI that must be writable from every executor, not a Hop VFS path: a local directory on local[], hdfs://… or s3a://… on a cluster.
Spark always writes a directory of part files at that location, never a single file with that name; see Getting a single file below.
See Paths and file systems for the scheme mapping and for the *Path scheme map on the run configuration.
Options
| Option | Description |
|---|---|
Transform name |
Unique name of the transform in the pipeline. |
Spark path / directory (Hadoop URI) |
Output directory or prefix. Supports variables. Avoid |
Format |
|
Save mode |
What to do when the target already exists: |
Write header |
CSV and text only. Write the column names as the first line of every part file. |
Separator |
CSV and text only. Field separator, default |
Quote character |
CSV and text only. Default |
Partition by columns |
Comma-separated list of columns to partition the output by. Spark creates one sub-directory per distinct value ( |
Coalesce partitions |
Reduce the number of partitions, and therefore of part files, before writing. Supports variables. |
Extra options |
Additional Spark write options as |
The output fields are the input fields: this transform does not change the row layout.
Getting a single file
Spark writes part-00000-… files into the directory you give, together with a _SUCCESS marker.
To get one data file, set Coalesce partitions to 1; the file still lives inside the output directory and keeps its Spark-generated name.
If you need an exact file name, rename or copy it in a following workflow action.
Metadata injection
All options support metadata injection.
Related pages
-
Spark lake table output for Delta Lake and Apache Iceberg tables