GitHub user gatorsmile opened a pull request:

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

    [SPARK-16329] [SQL] Star Expansion over Table Containing No Column 

    #### What changes were proposed in this pull request?
    Star expansion over a table containing zero column does not work since 1.6. 
However, it works in Spark 1.5.1. This PR is to fix the issue in the master 
branch.
    
    For example, 
    ```
    val rddNoCols = sqlContext.sparkContext.parallelize(1 to 10).map(_ => 
Row.empty)
    val dfNoCols = sqlContext.createDataFrame(rddNoCols, StructType(Seq.empty))
    dfNoCols.registerTempTable("temp_table_no_cols")
    sqlContext.sql("select * from temp_table_no_cols").show
    ```
    
    Without the fix, users will get the following the exception:
    ```
    java.lang.IllegalArgumentException: requirement failed
            at scala.Predef$.require(Predef.scala:221)
            at 
org.apache.spark.sql.catalyst.analysis.UnresolvedStar.expand(unresolved.scala:199)
    ```
    
    #### How was this patch tested?
    Tests are added

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

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

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

    https://github.com/apache/spark/pull/14007.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 #14007
    
----
commit f1ae973bca00fc86fb9e77073b1949811842d21d
Author: gatorsmile <[email protected]>
Date:   2016-07-01T03:06:06Z

    fix

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to