This is an automated email from the ASF dual-hosted git repository.

stigahuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 1490018810c7575adf066aeef941fa5f73dc73ef
Author: Steve Carlin <[email protected]>
AuthorDate: Wed Nov 6 08:39:02 2024 -0800

    IMPALA-13522: Calcite Planner: Treat the "real" type as double
    
    Real type was being treated as a float. E2E test can be found in
    exprs.test where there is a cast to real. Specifically, this test...
    
    select count(*) from alltypesagg
    where double_col >= 20.2
    and cast(double_col as double) = cast(double_col as real)
    
    ... was casting double_col as a double and returning the wrong result
    previous to this commit.
    
    Change-Id: I5f3cc0e50a4dfc0e28f39d81b591c1b458fd59ce
    Reviewed-on: http://gerrit.cloudera.org:8080/22087
    Reviewed-by: Joe McDonnell <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
    Reviewed-by: Aman Sinha <[email protected]>
---
 .../main/java/org/apache/impala/calcite/type/ImpalaTypeConverter.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/java/calcite-planner/src/main/java/org/apache/impala/calcite/type/ImpalaTypeConverter.java
 
b/java/calcite-planner/src/main/java/org/apache/impala/calcite/type/ImpalaTypeConverter.java
index 978f49b68..d26e10698 100644
--- 
a/java/calcite-planner/src/main/java/org/apache/impala/calcite/type/ImpalaTypeConverter.java
+++ 
b/java/calcite-planner/src/main/java/org/apache/impala/calcite/type/ImpalaTypeConverter.java
@@ -237,9 +237,9 @@ public class ImpalaTypeConverter {
         return Type.VARCHAR;
       case BOOLEAN:
         return Type.BOOLEAN;
-      case REAL:
       case FLOAT:
         return Type.FLOAT;
+      case REAL:
       case DOUBLE:
         return Type.DOUBLE;
       case DECIMAL:
@@ -291,9 +291,9 @@ public class ImpalaTypeConverter {
       case BIGINT:
         return Type.BIGINT;
       case FLOAT:
-      case REAL:
         return Type.FLOAT;
       case DOUBLE:
+      case REAL:
         return Type.DOUBLE;
       case TIMESTAMP:
         return Type.TIMESTAMP;

Reply via email to