GitHub user dilipbiswal opened a pull request:

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

    [SPARK-18009][SQL] Fix ClassCastException while calling toLocalIterator() 
on dataframe produced by RunnableCommand

    ## What changes were proposed in this pull request?
    A short code snippet that uses toLocalIterator() on a dataframe produced by 
a RunnableCommand
    reproduces the problem. toLocalIterator() is called by thriftserver when 
    `spark.sql.thriftServer.incrementalCollect`is set to handle large queries 
producing large result
    set.
    
    **Before**
    ```SQL
    scala> spark.sql("show databases")
    res0: org.apache.spark.sql.DataFrame = [databaseName: string]
    
    scala> res0.toLocalIterator()
    16/10/26 03:00:24 ERROR Executor: Exception in task 0.0 in stage 0.0 (TID 0)
    java.lang.ClassCastException: 
org.apache.spark.sql.catalyst.expressions.GenericInternalRow cannot be cast to 
org.apache.spark.sql.catalyst.expressions.UnsafeRow
    ```
    
    **After**
    ```SQL
    scala> spark.sql("drop database databases")
    res30: org.apache.spark.sql.DataFrame = []
    
    scala> spark.sql("show databases")
    res31: org.apache.spark.sql.DataFrame = [databaseName: string]
    
    scala> res31.toLocalIterator().asScala foreach println
    [default]
    [parquet]
    
    ```
    (Please explain how this patch was tested. E.g. unit tests, integration 
tests, manual tests)
    Added a test in DDLSuite

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

    $ git pull https://github.com/dilipbiswal/spark SPARK-18009

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

    https://github.com/apache/spark/pull/15642.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 #15642
    
----
commit 5ea4b956eb78815c525eb62f2dc14fecf5a3a066
Author: Dilip Biswal <dbis...@us.ibm.com>
Date:   2016-10-26T10:04:42Z

    [SPARK-18008] Fix ClassCastException while calling toLocalIterator() on 
dataframe produced by RunnableCommand

----


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