-
- Downloads
[SPARK-16228][SQL] HiveSessionCatalog should return `double`-param functions...
[SPARK-16228][SQL] HiveSessionCatalog should return `double`-param functions for decimal param lookups ## What changes were proposed in this pull request? This PR supports a fallback lookup by casting `DecimalType` into `DoubleType` for the external functions with `double`-type parameter. **Reported Error Scenarios** ```scala scala> sql("select percentile(value, 0.5) from values 1,2,3 T(value)") org.apache.spark.sql.AnalysisException: ... No matching method for class org.apache.hadoop.hive.ql.udf.UDAFPercentile with (int, decimal(38,18)). Possible choices: _FUNC_(bigint, array<double>) _FUNC_(bigint, double) ; line 1 pos 7 scala> sql("select percentile_approx(value, 0.5) from values 1.0,2.0,3.0 T(value)") org.apache.spark.sql.AnalysisException: ... Only a float/double or float/double array argument is accepted as parameter 2, but decimal(38,18) was passed instead.; line 1 pos 7 ``` ## How was this patch tested? Pass the Jenkins tests (including a new testcase). Author: Dongjoon Hyun <dongjoon@apache.org> Closes #13930 from dongjoon-hyun/SPARK-16228.
Showing
- sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveSessionCatalog.scala 15 additions, 1 deletion.../scala/org/apache/spark/sql/hive/HiveSessionCatalog.scala
- sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveUDFSuite.scala 7 additions, 0 deletions...la/org/apache/spark/sql/hive/execution/HiveUDFSuite.scala
Please register or sign in to comment