diff options
author | Sean Zhong <seanzhong@databricks.com> | 2016-08-04 19:45:47 +0800 |
---|---|---|
committer | Wenchen Fan <wenchen@databricks.com> | 2016-08-04 19:45:47 +0800 |
commit | 9d7a47406ed538f0005cdc7a62bc6e6f20634815 (patch) | |
tree | b015623f922bd4646c2e80c9e27fd2349d04a469 /project | |
parent | 43f4fd6f9bfff749af17e3c65b53a33f5ecb0922 (diff) | |
download | spark-9d7a47406ed538f0005cdc7a62bc6e6f20634815.tar.gz spark-9d7a47406ed538f0005cdc7a62bc6e6f20634815.tar.bz2 spark-9d7a47406ed538f0005cdc7a62bc6e6f20634815.zip |
[SPARK-16853][SQL] fixes encoder error in DataSet typed select
## What changes were proposed in this pull request?
For DataSet typed select:
```
def select[U1: Encoder](c1: TypedColumn[T, U1]): Dataset[U1]
```
If type T is a case class or a tuple class that is not atomic, the resulting logical plan's schema will mismatch with `Dataset[T]` encoder's schema, which will cause encoder error and throw AnalysisException.
### Before change:
```
scala> case class A(a: Int, b: Int)
scala> Seq((0, A(1,2))).toDS.select($"_2".as[A])
org.apache.spark.sql.AnalysisException: cannot resolve '`a`' given input columns: [_2];
..
```
### After change:
```
scala> case class A(a: Int, b: Int)
scala> Seq((0, A(1,2))).toDS.select($"_2".as[A]).show
+---+---+
| a| b|
+---+---+
| 1| 2|
+---+---+
```
## How was this patch tested?
Unit test.
Author: Sean Zhong <seanzhong@databricks.com>
Closes #14474 from clockfly/SPARK-16853.
Diffstat (limited to 'project')
-rw-r--r-- | project/MimaExcludes.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/project/MimaExcludes.scala b/project/MimaExcludes.scala index 56061559fe..a201d7f838 100644 --- a/project/MimaExcludes.scala +++ b/project/MimaExcludes.scala @@ -38,7 +38,9 @@ object MimaExcludes { lazy val v21excludes = v20excludes ++ { Seq( // [SPARK-16199][SQL] Add a method to list the referenced columns in data source Filter - ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.spark.sql.sources.Filter.references") + ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.spark.sql.sources.Filter.references"), + // [SPARK-16853][SQL] Fixes encoder error in DataSet typed select + ProblemFilters.exclude[IncompatibleMethTypeProblem]("org.apache.spark.sql.Dataset.select") ) } |