-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-16381][SQL][SparkR] Update SQL examples and programming guide for R language binding #14082
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
e7def7c
1af09f3
9ac6a70
05ee46b
828b2cf
7dca42d
34ca57c
af2365c
cd184b3
5e95fdd
d5b0b7f
a1eca2b
7195750
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,11 @@ head(count(groupBy(df, "age"))) | |
| # $example off:dataframe_operations$ | ||
|
|
||
|
|
||
| # Create a DataFrame from json file | ||
| path <- file.path(Sys.getenv("SPARK_HOME"), "examples/src/main/resources/people.json") | ||
| peopleDF <- read.json(path) | ||
| # Register this DataFrame as a table. | ||
| createOrReplaceTempView(peopleDF, "table") | ||
| # $example on:sql_query$ | ||
| df <- sql("SELECT * FROM table") | ||
|
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 example line is fine in doc but it won't run in an example R file - I think it does illustrate how to run a SQL query but there is no setup to create a temp view
Contributor
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. here should I add more to create the
Contributor
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. Lets register |
||
| # $example off:sql_query$ | ||
|
|
||
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.
can we use the same
dffrom before or do we need to create a new one here ?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.
we can use the
dffrom before, basicallypeopleDFhere is the same asdfbeforebut right after this line is
df <- sql("SELECT * FROM table"), I think it's better use another name in this example for clarity.what do you think?
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.
Hmm I see. since this is a
select *query the contents are not changing. Would something likework ?
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.
this is great, I'll do it