-
- Downloads
[SPARK-16730][SQL] Implement function aliases for type casts
## What changes were proposed in this pull request? Spark 1.x supports using the Hive type name as function names for doing casts, e.g. ```sql SELECT int(1.0); SELECT string(2.0); ``` The above query would work in Spark 1.x because Spark 1.x fail back to Hive for unimplemented functions, and break in Spark 2.0 because the fall back was removed. This patch implements function aliases using an analyzer rule for the following cast functions: - boolean - tinyint - smallint - int - bigint - float - double - decimal - date - timestamp - binary - string ## How was this patch tested? Added end-to-end tests in SQLCompatibilityFunctionSuite. Author: petermaxlee <petermaxlee@gmail.com> Closes #14364 from petermaxlee/SPARK-16730-2.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala 44 additions, 7 deletions...apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala 3 additions, 0 deletions...cala/org/apache/spark/sql/catalyst/expressions/Cast.scala
- sql/core/src/test/scala/org/apache/spark/sql/SQLCompatibilityFunctionSuite.scala 26 additions, 0 deletions.../org/apache/spark/sql/SQLCompatibilityFunctionSuite.scala
Loading
Please register or sign in to comment