Skip to content
Snippets Groups Projects
  • Dongjoon Hyun's avatar
    9c530576
    [SPARK-16536][SQL][PYSPARK][MINOR] Expose `sql` in PySpark Shell · 9c530576
    Dongjoon Hyun authored
    ## What changes were proposed in this pull request?
    
    This PR exposes `sql` in PySpark Shell like Scala/R Shells for consistency.
    
    **Background**
     * Scala
     ```scala
    scala> sql("select 1 a")
    res0: org.apache.spark.sql.DataFrame = [a: int]
    ```
    
     * R
     ```r
    > sql("select 1")
    SparkDataFrame[1:int]
    ```
    
    **Before**
     * Python
    
     ```python
    >>> sql("select 1 a")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'sql' is not defined
    ```
    
    **After**
     * Python
    
     ```python
    >>> sql("select 1 a")
    DataFrame[a: int]
    ```
    
    ## How was this patch tested?
    
    Manual.
    
    Author: Dongjoon Hyun <dongjoon@apache.org>
    
    Closes #14190 from dongjoon-hyun/SPARK-16536.
    9c530576
    History
    [SPARK-16536][SQL][PYSPARK][MINOR] Expose `sql` in PySpark Shell
    Dongjoon Hyun authored
    ## What changes were proposed in this pull request?
    
    This PR exposes `sql` in PySpark Shell like Scala/R Shells for consistency.
    
    **Background**
     * Scala
     ```scala
    scala> sql("select 1 a")
    res0: org.apache.spark.sql.DataFrame = [a: int]
    ```
    
     * R
     ```r
    > sql("select 1")
    SparkDataFrame[1:int]
    ```
    
    **Before**
     * Python
    
     ```python
    >>> sql("select 1 a")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'sql' is not defined
    ```
    
    **After**
     * Python
    
     ```python
    >>> sql("select 1 a")
    DataFrame[a: int]
    ```
    
    ## How was this patch tested?
    
    Manual.
    
    Author: Dongjoon Hyun <dongjoon@apache.org>
    
    Closes #14190 from dongjoon-hyun/SPARK-16536.