Skip to content
Snippets Groups Projects
  • Dongjoon Hyun's avatar
    a865f6e0
    [SPARK-15996][R] Fix R examples by removing deprecated functions · a865f6e0
    Dongjoon Hyun authored
    ## 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 <dongjoon@apache.org>
    
    Closes #13714 from dongjoon-hyun/SPARK-15996.
    a865f6e0
    History
    [SPARK-15996][R] Fix R examples by removing deprecated functions
    Dongjoon Hyun authored
    ## 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 <dongjoon@apache.org>
    
    Closes #13714 from dongjoon-hyun/SPARK-15996.