abhioncbr commented on PR #10814: URL: https://github.com/apache/pinot/pull/10814#issuecomment-1574523914
I did some analysis, and here are a couple of points. - when we create a numeric `RelDataType` by invoking the function [toRelDataType](https://github.com/apache/pinot/blob/master/pinot-query-planner/src/main/java/org/apache/pinot/query/type/TypeFactory.java#L54), none of them has precision or scale value. The reason being we always get a `False` value from the method [allowsPrec()](https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFactoryImpl.java#L51) - when we invoke the [getPrecision()](https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/BasicSqlType.java#L149) method for the Numeric data type, it returns the value based on ```typeSystem.getDefaultPrecision(typeName)```. - I am not able to find any relationship between the method [decimalOf2()](https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java#L586) in the `createSqlType` call stack. With the above-mentioned points, i see we have two options - Override the `getDefaultPrecision` in `TypeSystem` with something like that ``` @Override public int getDefaultPrecision(SqlTypeName typeName) { switch (typeName) { case DOUBLE: return 16; default: return super.getDefaultPrecision(typeName) } } ``` - Invoking `decimalOf2()` in [toRelDataType()](https://github.com/apache/pinot/blob/master/pinot-query-planner/src/main/java/org/apache/pinot/query/type/TypeFactory.java#L54) for Numeric data type to set the precision and scale values. @walterddr please suggest here. Thanks -- 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