GitHub user gatorsmile opened a pull request: https://github.com/apache/spark/pull/14040
[SPARK-16329] [SQL] [Backport-2.0] 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, ```scala 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 starExpansionEmptyTable Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/14040.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 #14040 ---- commit 298ced4d3e8603ec3d044dc5af0e16d91850c9ee Author: gatorsmile <gatorsm...@gmail.com> Date: 2016-07-04T03:38:27Z backport to 2.0 ---- --- 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