walterddr commented on code in PR #10814:
URL: https://github.com/apache/pinot/pull/10814#discussion_r1223361422
##########
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:
i think this is the problem : in JavaTypeFactoryImpl
```
@Override public Type getJavaClass(RelDataType type) {
...
if (type instanceof BasicSqlType || type instanceof IntervalSqlType) {
switch (type.getSqlTypeName()) {
...
case DOUBLE:
case FLOAT: // sic
return type.isNullable() ? Double.class : double.class;
case REAL:
return type.isNullable() ? Float.class : float.class;
```
This means `SQL.REAL` is actually java Float. and `SQL.FLOAT` or
`SQL.DOUBLE` is actually java Double...
This means all of our interpretation on float is wrong (b/c we equivalent
`SQL.FLOAT` as java Float
This is a much bigger problem IMO
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]