JulianJaffePinterest commented on issue #10983:
URL: https://github.com/apache/druid/issues/10983#issuecomment-800892414


   Druid doesn't operate over fixed-point decimal numbers (see e.g. [the Druid 
SQL type 
docs](http://druid.apache.org/docs/latest/querying/sql.html#data-types) or the 
[dimension spec supported data 
types](http://druid.apache.org/docs/latest/ingestion/index.html#dimension-objects).
 I haven't poked through the Calcite code recently; it's possible that doing 
something like `SELECT CAST(1 AS DECIMAL)/CAST(4.7 AS DECIMAL)` would use 
fixed-point math if Calcite reduces the constant expression without passing to 
Druid for evaluation. Anything that compiles into a Druid query under the hood 
will use floating-point arithmetic.
   
   If you're just building a client and want to include decimals for 
completeness, there's not much else you can do beyond note the limitation in 
your documentation. If you're trying to perform fixed-point calculations over 
your data in Druid and you don't need arbitrary precision, only precision up to 
some number of decimal places (for example, currency operations), you can 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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to