GitHub user dongjoon-hyun opened a pull request:

    https://github.com/apache/spark/pull/12137

    [SPARK-14350][SQL] EXPLAIN output should be in a single cell

    ## What changes were proposed in this pull request?
    
    EXPLAIN output should be in a single cell.
    
    **Before**
    ```
    scala> sql("explain select 1").collect()
    res0: Array[org.apache.spark.sql.Row] = Array([== Physical Plan ==], 
[WholeStageCodegen], [:  +- Project [1 AS 1#1]], [:     +- INPUT], [+- Scan 
OneRowRelation[]])
    ```
    
    **After**
    ```
    scala> sql("explain select 1").collect()
    res1: Array[org.apache.spark.sql.Row] =
    Array([== Physical Plan ==
    WholeStageCodegen
    :  +- Project [1 AS 1#4]
    :     +- INPUT
    +- Scan OneRowRelation[]])
    ```
    Or,
    ```
    scala> sql("explain select 1").head
    res1: org.apache.spark.sql.Row =
    [== Physical Plan ==
    WholeStageCodegen
    :  +- Project [1 AS 1#5]
    :     +- INPUT
    +- Scan OneRowRelation[]]
    ```
    
    Please note that `Spark-shell(Scala-shell)` trims long string output. So, 
you may need to use `println` to get full strings.
    ```
    scala> println(sql("explain codegen select 'a' as a group by 1").head)
    [Found 2 WholeStageCodegen subtrees.
    == Subtree 1 / 2 ==
    WholeStageCodegen
    ...
    /* 059 */   }
    /* 060 */ }
    
    ]
    ```
    
    ## How was this patch tested?
    
    Pass the Jenkins tests. (Testcases are updated.)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-14350

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/12137.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #12137
    
----
commit a1a9177b1d4e9f29117fb67edf9df27ccc04b139
Author: Dongjoon Hyun <dongj...@apache.org>
Date:   2016-04-03T08:45:45Z

    [SPARK-14350][SQL] EXPLAIN output should be in a single cell

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to