You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "walterddr (via GitHub)" <gi...@apache.org> on 2023/03/01 16:22:36 UTC

[GitHub] [pinot] walterddr commented on issue #10318: [multistage] Return type for AVG() aggregation function

walterddr commented on issue #10318:
URL: https://github.com/apache/pinot/issues/10318#issuecomment-1450432071

   It is possible to mimic Postgres behavior. Calcite RelDataTypeFactory has precision and scale associated with each numeric type. we can apply the function as above with several caveats
   
   see https://github.com/apache/calcite/blob/2dba40e7a0a5651eac5a30d9e0a72f178bd9bff2/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java#L562-L587
   
   1. for all the precision and scale factors listed --> we round up to the nearest associated Pinot type.
       - according to calcite: INTEGER(10, 0) and BIGINT(38, 0), FLOAT(14, 7), DOUBLE(30, 15), 
       - for example: so if our scale calculation results in a (12, 2) --> this matches to FLOAT
   2. we don't need to exactly compute the ceil(log10(count()), we can use the table size to estimate given that the scale differences are so large between 2 pinot data types
   
   


-- 
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-unsubscribe@pinot.apache.org

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


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