walterddr commented on code in PR #10814:
URL: https://github.com/apache/pinot/pull/10814#discussion_r1224914165


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/type/TypeSystem.java:
##########
@@ -70,4 +70,16 @@ public RelDataType deriveAvgAggType(RelDataTypeFactory 
typeFactory,
       }
     }
   }
+
+  // overriding the function for handling comparison between different data 
types.
+  // based on the precision value calcite adds the CAST function to make 
operands of same type for comparison.
+  @Override public int getDefaultPrecision(SqlTypeName typeName) {
+    switch (typeName) {
+      case DOUBLE:
+        return 16;
+      default:
+        // Following BasicSqlType precision as the default
+        return super.getDefaultPrecision(typeName);
+    }

Review Comment:
   `SqlTypeFactoryImpl` uses `RelDataTypeSystemImpl` to compute the 
scale/precision, which behaves the same as JavaTypeFactoryImpl. 
   ```
   ...
       case REAL:
         return 7;
       case FLOAT:
       case DOUBLE:
         return 15;
   ```
   what we should really do here is to change `TypeFactory` to : 
   ```
         case FLOAT:
           return fieldSpec.isSingleValueField() ? 
createSqlType(SqlTypeName.REAL) // instead of FLOAT
               : createArrayType(createSqlType(SqlTypeName.REAL), -1);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to