aboutsummaryrefslogtreecommitdiff
path: root/sql/core
diff options
context:
space:
mode:
authorDaoyuan Wang <daoyuan.wang@intel.com>2015-08-21 12:21:51 -0700
committerMichael Armbrust <michael@databricks.com>2015-08-21 12:21:51 -0700
commit3c462f5d87a9654c5a68fd658a40f5062029fd9a (patch)
tree488f7775d106255ce70dcae0c47aedaf2b5310a1 /sql/core
parent708036c1de52d674ceff30ac465e1dcedeb8dde8 (diff)
downloadspark-3c462f5d87a9654c5a68fd658a40f5062029fd9a.tar.gz
spark-3c462f5d87a9654c5a68fd658a40f5062029fd9a.tar.bz2
spark-3c462f5d87a9654c5a68fd658a40f5062029fd9a.zip
[SPARK-10130] [SQL] type coercion for IF should have children resolved first
Type coercion for IF should have children resolved first, or we could meet unresolved exception. Author: Daoyuan Wang <daoyuan.wang@intel.com> Closes #8331 from adrian-wang/spark10130.
Diffstat (limited to 'sql/core')
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
index da50aec17c..dcb4e83710 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
@@ -1679,4 +1679,11 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
checkAnswer(sqlContext.table("`db.t`"), df)
}
}
+
+ test("SPARK-10130 type coercion for IF should have children resolved first") {
+ val df = Seq((1, 1), (-1, 1)).toDF("key", "value")
+ df.registerTempTable("src")
+ checkAnswer(
+ sql("SELECT IF(a > 0, a, 0) FROM (SELECT key a FROM src) temp"), Seq(Row(1), Row(0)))
+ }
}