hashroute3 opened a new issue, #20412:
URL: https://github.com/apache/pinot/issues/20412

   In the multi-stage engine, casting a literal to `BIG_DECIMAL` returns the 
value with 1,000 decimal places. The single-stage engine returns the value as 
written.
   
   Checked on 1.6.0 with the batch QuickStart:
   
   ```sql
   SELECT CAST(1.5 AS BIG_DECIMAL) FROM baseballStats LIMIT 1
   ```
   
   - Single-stage: `"1.5"`
   - Multi-stage: `"1.5000...0"`, a 1,002-character string
   
   Casting a column, as in `CAST(homeRuns AS BIG_DECIMAL)`, isn't affected. So 
it looks like the literal gets folded at plan time with the type's default 
scale.
   
   `TypeSystem.getDefaultScale(DECIMAL)` in pinot-query-planner returns 
`MAX_DECIMAL_SCALE` (1000), so an unparameterized `DECIMAL`/`BIG_DECIMAL` 
literal takes scale 1000.
   
   I'm not sure whether the large default scale is intentional. The same class 
also caps the derived precision of decimal arithmetic (see #11151), so it may 
be deliberate. If it is, stripping trailing zeros when a folded literal is 
serialized might be the narrower fix. Happy to work on either.
   


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

Reply via email to