-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-25656][SQL][DOC][EXAMPLE] Add a doc and examples about extra data source options #22801
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 1 commit
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 |
|---|---|---|
|
|
@@ -57,6 +57,15 @@ def basic_datasource_example(spark): | |
| format="csv", sep=":", inferSchema="true", header="true") | ||
| # $example off:manual_load_options_csv$ | ||
|
|
||
| # $example on:manual_save_options_orc$ | ||
| df = spark.read.orc("examples/src/main/resources/users.orc") | ||
| (df.write.format("orc") | ||
| .option("orc.bloom.filter.columns", "favorite_color") | ||
| .option("orc.dictionary.key.threshold", "1.0") | ||
| .option("orc.column.encoding.direct", 'name') | ||
|
||
| .save("users_with_options.orc")) | ||
| # $example off:manual_save_options_orc$ | ||
|
|
||
| # $example on:write_sorting_and_bucketing$ | ||
| df.write.bucketBy(42, "name").sortBy("age").saveAsTable("people_bucketed") | ||
| # $example off:write_sorting_and_bucketing$ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -118,6 +118,10 @@ df <- read.df("examples/src/main/resources/people.csv", "csv", sep=";", inferSch | |
| namesAndAges <- select(df, "name", "age") | ||
| # $example off:manual_load_options_csv$ | ||
|
|
||
| # $example on:manual_save_options_orc$ | ||
| df <- read.df("examples/src/main/resources/users.orc", "orc") | ||
| write.orc(df, "users_with_options.orc", mode="overwrite", orc.bloom.filter.columns="favorite_color", orc.dictionary.key.threshold=1.0, orc.column.encoding.direct="name") | ||
| # $example off:manual_save_options_orc$ | ||
|
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. Hi, @felixcheung . Could you review this PR?
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. we should put space after param
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. Thank you! |
||
|
|
||
| # $example on:direct_sql$ | ||
| df <- sql("SELECT * FROM parquet.`examples/src/main/resources/users.parquet`") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,13 @@ object SQLDataSourceExample { | |
| .option("header", "true") | ||
| .load("examples/src/main/resources/people.csv") | ||
| // $example off:manual_load_options_csv$ | ||
| // $example on:manual_save_options_orc$ | ||
| usersDF.write.format("orc") | ||
| .option("orc.bloom.filter.columns", "favorite_color") | ||
| .option("orc.dictionary.key.threshold", "1.0") | ||
| .option("orc.column.encoding.direct", "name") | ||
| .save("users_with_options.orc") | ||
|
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. Also, cc @dbtsai . |
||
| // $example off:manual_save_options_orc$ | ||
|
|
||
| // $example on:direct_sql$ | ||
| val sqlDF = spark.sql("SELECT * FROM parquet.`examples/src/main/resources/users.parquet`") | ||
|
|
||
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 review this, @gatorsmile ? This is the example we discussed previously.