diff options
author | Reynold Xin <rxin@databricks.com> | 2016-05-12 22:18:39 -0700 |
---|---|---|
committer | Yin Huai <yhuai@databricks.com> | 2016-05-12 22:18:39 -0700 |
commit | eda2800d44843b6478e22d2c99bca4af7e9c9613 (patch) | |
tree | 5c0a9eb8fac7f45cae1f0b6b372b4341e7b84606 /sql/hive | |
parent | ba169c3230e7d6cb192ec4bd567a1fef7b93b29f (diff) | |
download | spark-eda2800d44843b6478e22d2c99bca4af7e9c9613.tar.gz spark-eda2800d44843b6478e22d2c99bca4af7e9c9613.tar.bz2 spark-eda2800d44843b6478e22d2c99bca4af7e9c9613.zip |
[SPARK-14541][SQL] Support IFNULL, NULLIF, NVL and NVL2
## What changes were proposed in this pull request?
This patch adds support for a few SQL functions to improve compatibility with other databases: IFNULL, NULLIF, NVL and NVL2. In order to do this, this patch introduced a RuntimeReplaceable expression trait that allows replacing an unevaluable expression in the optimizer before evaluation.
Note that the semantics are not completely identical to other databases in esoteric cases.
## How was this patch tested?
Added a new test suite SQLCompatibilityFunctionSuite.
Closes #12373.
Author: Reynold Xin <rxin@databricks.com>
Closes #13084 from rxin/SPARK-14541.
Diffstat (limited to 'sql/hive')
-rw-r--r-- | sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala index 72736ee55b..b4eb50e331 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala @@ -102,7 +102,6 @@ class ExpressionToSQLSuite extends SQLBuilderTest with SQLTestUtils { checkSqlGeneration("SELECT map(1, 'a', 2, 'b')") checkSqlGeneration("SELECT named_struct('c1',1,'c2',2,'c3',3)") checkSqlGeneration("SELECT nanvl(a, 5), nanvl(b, 10), nanvl(d, c) from t2") - checkSqlGeneration("SELECT nvl(null, 1, 2)") checkSqlGeneration("SELECT rand(1)") checkSqlGeneration("SELECT randn(3)") checkSqlGeneration("SELECT struct(1,2,3)") |