You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/04/02 19:35:13 UTC

[GitHub] [druid] benkrug opened a new issue #11065: casting inside sql division seems to be ineffective

benkrug opened a new issue #11065:
URL: https://github.com/apache/druid/issues/11065


   Reproduced in druid 0.20.0
   
   This will return an integer results, giving the floor of the result, which is expected:
   
   select 5/2
   
   (returns 2).  Casting the numerator and/or denominator makes no difference.  Eg,
   
   select (cast (5 as decimal))/(cast (2 as decimal))
   
   or any other variation I can think if, still returns 2.  You can only get the decimal part by doing something like
   
   select 5.0/2
   
   or a variation like 
   
   select (1.0*5)/2
   


-- 
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:
users@infra.apache.org



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


[GitHub] [druid] JulianJaffePinterest commented on issue #11065: casting inside sql arithmetic operations doesn't seem to work right

Posted by GitBox <gi...@apache.org>.
JulianJaffePinterest commented on issue #11065:
URL: https://github.com/apache/druid/issues/11065#issuecomment-817591502


   I suppose this answers my aside from #10983. As discussed in that issue, Druid does not operate over fixed-point decimal numbers (see e.g. the Druid SQL type docs or the dimension spec supported data types). If you need fixed-point operations, but only up to a known precision, one workaround is to scale your data at ingestion and then use integer division when computing your final result.


-- 
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:
users@infra.apache.org



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