DataFrameWriter
Saves the contents of a DataFrame to external storage systems (e.g. file systems, key-value stores, tables). Use Dataset.write to access this.
Mirrors the public surface of org.apache.spark.sql.DataFrameWriter over the Spark Connect protocol.
Attributes
- Example
-
df.write.format("parquet").mode("overwrite").save("out.parquet") df.write.mode("append").saveAsTable("my_table") - Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Buckets the output by the given columns into numBuckets buckets. If specified, the output is laid out on the file system similar to Hive's bucketing scheme.
Buckets the output by the given columns into numBuckets buckets. If specified, the output is laid out on the file system similar to Hive's bucketing scheme.
Attributes
- Returns
-
this writer, for chaining.
Clusters the output by the given columns, for table formats that support clustering (e.g. liquid clustering). Cannot be combined with partitionBy or bucketBy.
Clusters the output by the given columns, for table formats that support clustering (e.g. liquid clustering). Cannot be combined with partitionBy or bucketBy.
Attributes
- Returns
-
this writer, for chaining.
Saves the content as CSV at the given path.
Saves the content as CSV at the given path.
Attributes
Specifies the output data source format (e.g. "csv", "json", "parquet", "orc").
Specifies the output data source format (e.g. "csv", "json", "parquet", "orc").
Attributes
- Returns
-
this writer, for chaining.
Saves the content to the external database table table over JDBC, using url and the connection properties. Partitioning, bucketing, and clustering are not supported here.
Saves the content to the external database table table over JDBC, using url and the connection properties. Partitioning, bucketing, and clustering are not supported here.
Attributes
Saves the content as JSON at the given path.
Saves the content as JSON at the given path.
Attributes
Adds an output option for the underlying data source.
Adds an output option for the underlying data source.
Attributes
- Returns
-
this writer, for chaining.
Adds a boolean output option. @return this writer, for chaining.
Adds a boolean output option. @return this writer, for chaining.
Attributes
Adds a long output option. @return this writer, for chaining.
Adds a long output option. @return this writer, for chaining.
Attributes
Adds a double output option. @return this writer, for chaining.
Adds a double output option. @return this writer, for chaining.
Attributes
Adds multiple output options.
Adds multiple output options.
Attributes
- Returns
-
this writer, for chaining.
(Java-specific) Adds multiple output options. @return this writer, for chaining.
(Java-specific) Adds multiple output options. @return this writer, for chaining.
Attributes
Saves the content as ORC at the given path.
Saves the content as ORC at the given path.
Attributes
Saves the content as Parquet at the given path.
Saves the content as Parquet at the given path.
Attributes
Partitions the output by the given columns on the file system.
Partitions the output by the given columns on the file system.
Attributes
- Returns
-
this writer, for chaining.
Sorts the output in each bucket by the given columns.
Sorts the output in each bucket by the given columns.
Attributes
- Returns
-
this writer, for chaining.
Saves the content as text at the given path.
Saves the content as text at the given path.
Attributes
Enables automatic schema evolution for this write (Spark 4.2+). The target table must declare the AUTOMATIC_SCHEMA_EVOLUTION capability.
Enables automatic schema evolution for this write (Spark 4.2+). The target table must declare the AUTOMATIC_SCHEMA_EVOLUTION capability.
Attributes
- Returns
-
this writer, for chaining.
Saves the content as XML at the given path.
Saves the content as XML at the given path.