-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-20431][SQL] Specify a schema by using a DDL-formatted string #17719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,18 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging { | |
| this | ||
| } | ||
|
|
||
| /** | ||
| * Specifies the schema by using the input DDL-formatted string. Some data sources (e.g. JSON) can | ||
| * infer the input schema automatically from data. By specifying the schema here, the underlying | ||
| * data source can skip the schema inference step, and thus speed up data loading. | ||
| * | ||
| * @since 2.3.0 | ||
| */ | ||
| def schema(schemaString: String): DataFrameReader = { | ||
| this.userSpecifiedSchema = Option(StructType.fromDDL(schemaString)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change will make PySpark API inconsistent with the Scala API
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, but I probably missed your point. What's the API consistency you pointed out here?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I misread the Python codes. |
||
| this | ||
| } | ||
|
|
||
| /** | ||
| * Adds an input option for the underlying data source. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give an example here to users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok