DataFrameReader
Loads data from external storage systems (e.g. file systems, key-value stores, JDBC) into a DataFrame. Use SparkSession.read to access this.
Mirrors the public surface of org.apache.spark.sql.DataFrameReader over the Spark Connect protocol.
Attributes
- Example
-
spark.read.format("csv").option("header", true).load("data.csv") spark.read.json("events.json") spark.read.table("my_table") - Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Returns the row-level changes (Change Data Capture) of the table as a DataFrame (Spark 4.2+). Only Data Source V2 tables whose catalog supports change logs implement this. Use options such as startingVersion, endingVersion, startingTimestamp, endingTimestamp, deduplicationMode, and computeUpdates to choose the range and post-processing:
Returns the row-level changes (Change Data Capture) of the table as a DataFrame (Spark 4.2+). Only Data Source V2 tables whose catalog supports change logs implement this. Use options such as startingVersion, endingVersion, startingTimestamp, endingTimestamp, deduplicationMode, and computeUpdates to choose the range and post-processing:
spark.read.option("startingVersion", "10").changes("my_table")
Attributes
Specifies the input data source format (e.g. "csv", "json", "parquet", "orc").
Specifies the input data source format (e.g. "csv", "json", "parquet", "orc").
Attributes
- Returns
-
this reader, for chaining.
Constructs a DataFrame representing the database table accessible via JDBC.
Constructs a DataFrame representing the database table accessible via JDBC.
Value parameters
- properties
-
connection properties (e.g.
"user","password"); these are merged into the read options. - table
-
the name of the table in the external database (or a subquery).
- url
-
the JDBC URL of the form
jdbc:subprotocol:subname.
Attributes
Adds an input option for the underlying data source.
Adds an input option for the underlying data source.
Attributes
- Returns
-
this reader, for chaining.
Adds a boolean input option. @return this reader, for chaining.
Adds a boolean input option. @return this reader, for chaining.
Attributes
Adds a long input option. @return this reader, for chaining.
Adds a long input option. @return this reader, for chaining.
Attributes
Adds a double input option. @return this reader, for chaining.
Adds a double input option. @return this reader, for chaining.
Attributes
Adds multiple input options.
Adds multiple input options.
Attributes
- Returns
-
this reader, for chaining.
(Java-specific) Adds multiple input options. @return this reader, for chaining.
(Java-specific) Adds multiple input options. @return this reader, for chaining.
Attributes
Specifies the input schema using a DDL-formatted string (e.g. "a INT, b STRING").
Specifies the input schema using a DDL-formatted string (e.g. "a INT, b STRING").
Attributes
- Returns
-
this reader, for chaining.
Specifies the input schema using a StructType.
Specifies the input schema using a StructType.
Attributes
- Returns
-
this reader, for chaining.
Loads text file(s) and returns a Dataset[String] of their lines.
Loads text file(s) and returns a Dataset[String] of their lines.
Attributes
Loads text file(s) and returns a Dataset[String] of their lines.
Loads text file(s) and returns a Dataset[String] of their lines.