himanshug edited a comment on issue #10190:
URL: https://github.com/apache/druid/issues/10190#issuecomment-665334396


   @jihoonson java's `BigDecimal` is `immutable` . So, "aggregate" operation 
creates new objects unnecessarily.
   You can't aggregate with `BigDecimal` in serialized off-heap representation, 
so a naive `BufferAggregator` off-heap impl would require constantly 
deserializing state stored off-heap into on-heap java `BigDecimal` object for 
aggregation then serializing it again into the off-heap buffer. So, using java 
`BigDecimal` is slow in general.
   
   One line of thought was to create a custom `BigDecimal` implementation with 
code/algo pretty much same as java's `BigDecimal`, but that was `mutable` and 
had an equivalent `off-heap` representation with operations doable on the 
off-heap form itself (e.g. the way we do things for thetaSketches etc) . That 
complexity wasn't worth the effort/time given that our use case was satisfied 
by simpler approach described in earlier comment.


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

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