-
- Downloads
[SPARK-20876][SQL] If the input parameter is float type for ceil or floor,the...
[SPARK-20876][SQL] If the input parameter is float type for ceil or floor,the result is not we expected ## What changes were proposed in this pull request? spark-sql>SELECT ceil(cast(12345.1233 as float)); spark-sql>12345 For this case, the result we expected is `12346` spark-sql>SELECT floor(cast(-12345.1233 as float)); spark-sql>-12345 For this case, the result we expected is `-12346` Because in `Ceil` or `Floor`, `inputTypes` has no FloatType, so it is converted to LongType. ## How was this patch tested? After the modification: spark-sql>SELECT ceil(cast(12345.1233 as float)); spark-sql>12346 spark-sql>SELECT floor(cast(-12345.1233 as float)); spark-sql>-12346 Author: liuxian <liu.xian3@zte.com.cn> Closes #18103 from 10110346/wip-lx-0525-1.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala 8 additions, 6 deletions...ache/spark/sql/catalyst/expressions/mathExpressions.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala 1 addition, 1 deletion...rg/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/MathExpressionsSuite.scala 20 additions, 0 deletions...spark/sql/catalyst/expressions/MathExpressionsSuite.scala
- sql/core/src/test/resources/sql-tests/inputs/operators.sql 0 additions, 3 deletionssql/core/src/test/resources/sql-tests/inputs/operators.sql
- sql/core/src/test/resources/sql-tests/results/operators.sql.out 14 additions, 38 deletions...re/src/test/resources/sql-tests/results/operators.sql.out
Loading
Please register or sign in to comment