Skip to content

Conversation

@dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Jun 16, 2016

What changes were proposed in this pull request?

Currently, R examples(dataframe.R and data-manipulation.R) fail like the following. We had better update them before releasing 2.0 RC. This PR updates them to use up-to-date APIs.

$ bin/spark-submit examples/src/main/r/dataframe.R 
...
Warning message:
'createDataFrame(sqlContext...)' is deprecated.
Use 'createDataFrame(data, schema = NULL, samplingRatio = 1.0)' instead.
See help("Deprecated") 
...
Warning message:
'read.json(sqlContext...)' is deprecated.
Use 'read.json(path)' instead.
See help("Deprecated") 
...
Error: could not find function "registerTempTable"
Execution halted

How was this patch tested?

Manual.

curl -LO http://s3-us-west-2.amazonaws.com/sparkr-data/flights.csv
bin/spark-submit examples/src/main/r/dataframe.R
bin/spark-submit examples/src/main/r/data-manipulation.R flights.csv

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-15996][R] Fix R dataframe example by removing deprecated functions [SPARK-15996][R] Fix R examples by removing deprecated functions Jun 16, 2016
@SparkQA
Copy link

SparkQA commented Jun 16, 2016

Test build #60655 has finished for PR 13714 at commit 852de0d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jun 16, 2016

Test build #60656 has finished for PR 13714 at commit 6753083.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member Author

Hi, @shivaram , @felixcheung , @sun-rui .
Could you review this PR?

@shivaram
Copy link
Contributor

LGTM. Thanks for the fix @dongjoon-hyun

@shivaram
Copy link
Contributor

Merging this to master and branch-2.0

@dongjoon-hyun
Copy link
Member Author

Thank you, @shivaram !

@asfgit asfgit closed this in a865f6e Jun 16, 2016
asfgit pushed a commit that referenced this pull request Jun 16, 2016
## What changes were proposed in this pull request?

Currently, R examples(`dataframe.R` and `data-manipulation.R`) fail like the following. We had better update them before releasing 2.0 RC. This PR updates them to use up-to-date APIs.

```bash
$ bin/spark-submit examples/src/main/r/dataframe.R
...
Warning message:
'createDataFrame(sqlContext...)' is deprecated.
Use 'createDataFrame(data, schema = NULL, samplingRatio = 1.0)' instead.
See help("Deprecated")
...
Warning message:
'read.json(sqlContext...)' is deprecated.
Use 'read.json(path)' instead.
See help("Deprecated")
...
Error: could not find function "registerTempTable"
Execution halted
```

## How was this patch tested?

Manual.
```
curl -LO http://s3-us-west-2.amazonaws.com/sparkr-data/flights.csv
bin/spark-submit examples/src/main/r/dataframe.R
bin/spark-submit examples/src/main/r/data-manipulation.R flights.csv
```

Author: Dongjoon Hyun <[email protected]>

Closes #13714 from dongjoon-hyun/SPARK-15996.

(cherry picked from commit a865f6e)
Signed-off-by: Shivaram Venkataraman <[email protected]>
@felixcheung
Copy link
Member

Thanks for catching these!

# First, register the flights SparkDataFrame as a table
registerTempTable(flightsDF, "flightsTable")
destDF <- sql(sqlContext, "SELECT dest, cancelled FROM flightsTable")
createOrReplaceTempView(flightsDF, "flightsTable")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm - it looks like we have made a breaking change? IMO it's ok to leave the registerTempTable - at least we should deprecate before removing it completely? @shivaram - It is SPARK-15925

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I assumed this was a breaking change in 2.0 in Spark SQL for Scala and Python as well. But looking at #12945 it looks like the call is only deprecated and its not a breaking change - In that case we should add it back with a similar deprecation warning

cc @liancheng

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first I thought it might be OK to just replace registerTempTable with createOrReplaceTempView since SparkR is still in experimental status. But after double thinking about this, a deprecation makes more sense here. Will add back the removed function and deprecate it. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you all for nice conclusion! :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure - I'm on it @liancheng

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks!

@dongjoon-hyun dongjoon-hyun deleted the SPARK-15996 branch July 20, 2016 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants