diff options
author | Daoyuan Wang <daoyuan.wang@intel.com> | 2015-05-06 10:30:42 -0700 |
---|---|---|
committer | Yin Huai <yhuai@databricks.com> | 2015-05-06 10:30:42 -0700 |
commit | c3eb441f5487c9b6476e1d6e2a2d852dcc43b986 (patch) | |
tree | e552f539608a3f11bdb735f0e4adc57ff79cb437 /sql/core/src | |
parent | 150f671c286c57deaf37ab1d8f837d68b5be82a0 (diff) | |
download | spark-c3eb441f5487c9b6476e1d6e2a2d852dcc43b986.tar.gz spark-c3eb441f5487c9b6476e1d6e2a2d852dcc43b986.tar.bz2 spark-c3eb441f5487c9b6476e1d6e2a2d852dcc43b986.zip |
[SPARK-6201] [SQL] promote string and do widen types for IN
huangjs
Acutally spark sql will first go through analysis period, in which we do widen types and promote strings, and then optimization, where constant IN will be converted into INSET.
So it turn out that we only need to fix this for IN.
Author: Daoyuan Wang <daoyuan.wang@intel.com>
Closes #4945 from adrian-wang/inset and squashes the following commits:
71e05cc [Daoyuan Wang] minor fix
581fa1c [Daoyuan Wang] mysql way
f3f7baf [Daoyuan Wang] address comments
5eed4bc [Daoyuan Wang] promote string and do widen types for IN
Diffstat (limited to 'sql/core/src')
-rw-r--r-- | sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala | 9 |
1 files changed, 9 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 0ab8558c1d..208cec6a32 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 @@ -120,6 +120,15 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll { Row(1, 1) :: Nil) } + test("SPARK-6201 IN type conversion") { + jsonRDD(sparkContext.parallelize(Seq("{\"a\": \"1\"}}", "{\"a\": \"2\"}}", "{\"a\": \"3\"}}"))) + .registerTempTable("d") + + checkAnswer( + sql("select * from d where d.a in (1,2)"), + Seq(Row("1"), Row("2"))) + } + test("SPARK-3176 Added Parser of SQL ABS()") { checkAnswer( sql("SELECT ABS(-1.3)"), |