LakshSingla commented on pull request #11923:
URL: https://github.com/apache/druid/pull/11923#issuecomment-975482658


   Reopening with the following comment: 
   
   The type conversion happens because Floor in `Functions` always returns a 
double expression as a result. Therefore we have a BigDecimal(123.0) wrapped in 
an INTEGER note. When trying to extract the value, Calcite extracts it using it 
as `unscaled` value.
   `SELECT FLOOR(123) FROM druid.foo` returns the correct result, because the 
actual conversion is delegated to the native layer (without trying to extract a 
Long value via Calcite's methods). 
   
   Another fix that we can do is remove this that Floor returns a type of the 
result which is passed to it, i.e. FLOOR(INT) should return INT and 
FLOOR(DOUBLE) should return DOUBLE, but I am unsure if that is the correct 
approach for this issue.


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