nizarhejazi opened a new issue #8418:
URL: https://github.com/apache/pinot/issues/8418


   Pinot currently support storing BigDecimal as byte[], and a couple inbuilt 
scalar functions for converting a string to BigDecimal bytes and converting 
BigDecimal bytes to strings:
   
   ```
   byte[] bigDecimalToBytes(String number)
   String bytesToBigDecimal(byte[] bytes)
   ```
   
   There is also support for sum aggregation with precision and scale: 
`SUMPRECISION(expression, precision, scale)`.
   
   Pinot supports BigDecimal with an arbitrary precision integer unscaled 
value, and a 16-bit integer scale (instead of 32-bit integer scale supported by 
`java.math.BigDecimal` class). Data types are defined inside an enum (`enum 
ObjectType`) which makes BigDecimal not configurable.
   
   There is a need to expose BigDecimal data type in Pinot (instead of byte[]) 
so clients (e.g. Presto, Trino, etc.) can map Pinot's BigDecimal to the 
equivalent supported data type. 
   
   Please note that Presto/Trino supports a fixed precision decimal number (up 
to 38 digits). One possible way to map Pinot's representation of BigDecimal to 
Trino is similar to how [Trino handles Postgres decimal 
type](https://trino.io/docs/current/connector/postgresql.html#decimal-type-handling):
   - The scale of the resulting type is controlled via the 
`decimal-default-scale` configuration property or the `decimal-rounding-mode` 
session property.
   - The precision is always 38.
   
   The ask is to support BigDecimal in: Data Types (ObjectType), Data 
Ingestion, Selection, etc.


-- 
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