aboutsummaryrefslogtreecommitdiff
path: root/sql/hive/src
diff options
context:
space:
mode:
authorDongjoon Hyun <dongjoon@apache.org>2016-07-19 10:28:17 -0700
committerReynold Xin <rxin@databricks.com>2016-07-19 10:28:17 -0700
commit162d04a30e38bb83d35865679145f8ea80b84c26 (patch)
treecc8d6f2871f792bcd2bc1cd03ef4f0699cda3e89 /sql/hive/src
parent0bd76e872b60cb80295fc12654e370cf22390056 (diff)
downloadspark-162d04a30e38bb83d35865679145f8ea80b84c26.tar.gz
spark-162d04a30e38bb83d35865679145f8ea80b84c26.tar.bz2
spark-162d04a30e38bb83d35865679145f8ea80b84c26.zip
[SPARK-16602][SQL] `Nvl` function should support numeric-string cases
## What changes were proposed in this pull request? `Nvl` function should support numeric-straing cases like Hive/Spark1.6. Currently, `Nvl` finds the tightest common types among numeric types. This PR extends that to consider `String` type, too. ```scala - TypeCoercion.findTightestCommonTypeOfTwo(left.dataType, right.dataType).map { dtype => + TypeCoercion.findTightestCommonTypeToString(left.dataType, right.dataType).map { dtype => ``` **Before** ```scala scala> sql("select nvl('0', 1)").collect() org.apache.spark.sql.AnalysisException: cannot resolve `nvl("0", 1)` due to data type mismatch: input to function coalesce should all be the same type, but it's [string, int]; line 1 pos 7 ``` **After** ```scala scala> sql("select nvl('0', 1)").collect() res0: Array[org.apache.spark.sql.Row] = Array([0]) ``` ## How was this patch tested? Pass the Jenkins tests. Author: Dongjoon Hyun <dongjoon@apache.org> Closes #14251 from dongjoon-hyun/SPARK-16602.
Diffstat (limited to 'sql/hive/src')
0 files changed, 0 insertions, 0 deletions