GitHub user gatorsmile opened a pull request:

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

    [SPARK-15216] [SQL] Add a new Dataset API explainCodegen

    #### What changes were proposed in this pull request?
    Reading codegen output is important for developers to debug. So far, 
outputting codegen results is available in the SQL interface by `EXPLAIN 
CODEGEN`. However, in the Dataset/DataFrame APIs, we face the same issue. 
    
    This PR is to add a new Dataset API `explainCodegen` for achieving the same 
purpose. 
    
    BTW, I also tried another way, i.e., adding a new boolean parameter into 
the existing `explain` API. However, if users set both `extended` and `codegen` 
to `true`, we only output the `codegen` results to the console. Basically, that 
is not allowed. We need to issue an exception in that case? Or change the 
behavior? Output both results in this case? Anyway, I am also fine if this is 
preferred. 
    
    #### How was this patch tested?
    Since `explainCodegen` is writing the result to the console, I only do the 
manual testing in my local environment. For example, the test case:
    ```scala
      test("explainCodegen") {
        val ds = Seq("a" -> 1, "a" -> 3, "b" -> 3).toDS().groupByKey(_._1).agg(
          expr("avg(_2)").as[Double],
          ComplexResultAgg.toColumn)
        ds.explainCodegen()
      }
    ```


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

    $ git pull https://github.com/gatorsmile/spark explainCodeGen

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

    https://github.com/apache/spark/pull/12992.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 #12992
    
----
commit f716b106ede5f090c12e261d64ac5fb4ae0af8a4
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2016-05-08T20:53:44Z

    a explainCodegen debug API

----


---
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