GitHub user gatorsmile opened a pull request:
https://github.com/apache/spark/pull/14042
[SPARK-16329] [SQL] [Backport-1.6] Star Expansion over Table Containing No
Column #14040
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 starExpansionEmpty
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/14042.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 #14042
commit edeeb1421931963affbd5402301563579b00611a
Author: gatorsmile
Date: 2016-07-04T05:09:24Z
backport to 1.6
---
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