aboutsummaryrefslogtreecommitdiff
path: root/sql/catalyst/src/test
diff options
context:
space:
mode:
authorDaoyuan Wang <daoyuan.wang@intel.com>2016-09-07 13:01:27 +0200
committerHerman van Hovell <hvanhovell@databricks.com>2016-09-07 13:01:27 +0200
commit6f4aeccf8cdfe0b5bdf77165711a9062a52d9d90 (patch)
treea2e311f6f6c5758c3be80de4f9364de6131839af /sql/catalyst/src/test
parent6b41195bca65de6236168d96758f93b85f1dd7ca (diff)
downloadspark-6f4aeccf8cdfe0b5bdf77165711a9062a52d9d90.tar.gz
spark-6f4aeccf8cdfe0b5bdf77165711a9062a52d9d90.tar.bz2
spark-6f4aeccf8cdfe0b5bdf77165711a9062a52d9d90.zip
[SPARK-17427][SQL] function SIZE should return -1 when parameter is null
## What changes were proposed in this pull request? `select size(null)` returns -1 in Hive. In order to be compatible, we should return `-1`. ## How was this patch tested? unit test in `CollectionFunctionsSuite` and `DataFrameFunctionsSuite`. Author: Daoyuan Wang <daoyuan.wang@intel.com> Closes #14991 from adrian-wang/size.
Diffstat (limited to 'sql/catalyst/src/test')
-rw-r--r--sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionFunctionsSuite.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionFunctionsSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionFunctionsSuite.scala
index a5f784fdcc..c76dad208e 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionFunctionsSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionFunctionsSuite.scala
@@ -40,8 +40,8 @@ class CollectionFunctionsSuite extends SparkFunSuite with ExpressionEvalHelper {
checkEvaluation(Size(m1), 0)
checkEvaluation(Size(m2), 1)
- checkEvaluation(Literal.create(null, MapType(StringType, StringType)), null)
- checkEvaluation(Literal.create(null, ArrayType(StringType)), null)
+ checkEvaluation(Size(Literal.create(null, MapType(StringType, StringType))), -1)
+ checkEvaluation(Size(Literal.create(null, ArrayType(StringType))), -1)
}
test("MapKeys/MapValues") {