Druid Support for Decimals?

Hi,

We are looking into using Druid to replace some homegrown code but have run into an issue with what seems to be a lack of support in Druid for decimal values. Are decimals supported? If not, are people storing money values in Druid? How do you do it? Is adding support for decimals something that others are interested in? Is it on the Druid roadmap?

Thanks,

Collin

Hey Colin,

Decimal values are not supported in Druid. We store money values as microcurrencies (e.g. 1000000 micros = 1 USD/EUR/GBP/etc.) in longs.

Hi Julian,

Thanks for your help. Is there any way to accurately format micros into dollars within your Druid queries or do you have to post-process the results within your app?

How happy have you been with the solution (does it feel like a hack)? Are you using any third-party tooling (such as Superset) to query Druid? Is it able to work with, round and format the micros accurately? My concern being that I might not be able to convert to dollars via code if going directly from Druid to Superset, etc.

Thanks again for your help!

Hey Collin,

We do some post-processing in our app, although that isn’t strictly necessary for your case since both Druid post aggregators and sql queries can handle the conversion without trouble. We use microcurrencies because we deal with values that are converted according to exchange rates and so can have “fractional” parts. If you’re only dealing with dollars, you can just store your values in cents and then use the SQL ROUND function or the equivalent post aggregators in your calls from Superset.

Awesome. We’ll give it a go. Thank you so much for your help.