spark-instrumented-optimizer/sql/catalyst/src/main
Dongjoon Hyun 9c03c56460 [SPARK-17251][SQL] Improve OuterReference to be NamedExpression
## What changes were proposed in this pull request?

Currently, `OuterReference` is not `NamedExpression`. So, it raises 'ClassCastException` when it used in projection lists of IN correlated subqueries. This PR aims to support that by making `OuterReference` as `NamedExpression` to show correct error messages.

```scala
scala> sql("CREATE TEMPORARY VIEW t1 AS SELECT * FROM VALUES 1, 2 AS t1(a)")
scala> sql("CREATE TEMPORARY VIEW t2 AS SELECT * FROM VALUES 1 AS t2(b)")
scala> sql("SELECT a FROM t1 WHERE a IN (SELECT a FROM t2)").show
java.lang.ClassCastException: org.apache.spark.sql.catalyst.expressions.OuterReference cannot be cast to org.apache.spark.sql.catalyst.expressions.NamedExpression
```

## How was this patch tested?

Pass the Jenkins test with new test cases.

Author: Dongjoon Hyun <dongjoon@apache.org>

Closes #16015 from dongjoon-hyun/SPARK-17251-2.
2016-11-26 14:57:48 -08:00
..
antlr4/org/apache/spark/sql/catalyst/parser [SPARK-18533] Raise correct error upon specification of schema for datasource tables created using CTAS 2016-11-22 15:57:07 -08:00
java/org/apache/spark/sql [SPARK-18053][SQL] compare unsafe and safe complex-type values correctly 2016-11-23 04:15:19 -08:00
scala/org/apache/spark/sql [SPARK-17251][SQL] Improve OuterReference to be NamedExpression 2016-11-26 14:57:48 -08:00