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/03/17 08:24:18 UTC

[GitHub] [druid] JulianJaffePinterest edited a comment on issue #10983: SQL JSON interface should have a context option to write decimals as strings to avoid unintended float coercion

JulianJaffePinterest edited a comment 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:
users@infra.apache.org



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