Druid sql precision problem

Hi all,

I found a druid sql precision problem. when i use “select * from table” , the result is :


“__time”: “2018-01-22T17:56:40.000+08:00”,

“count”: 1,

“met1”: 0.9399999976158142,

“met2”: 2.9700000286102295


but the original data is:


“met1”: 0.94,

“met2”: 2.98


how to fix it?



Hi :

Which Druid version are you using ?


Hi Jenny,

This is because by default Druid is storing your decimal numbers as 32-bit floats, and then converting them to 64-bit decimals at query time, which only retains about 6 digits of precision. You’ll notice that the precision is only off after about the sixth digit. Starting in Druid 0.11 you can store them as 64-bit columns too if you want – see “Migrating to Double columns” on https://github.com/druid-io/druid/releases/druid-0.11.0.


在 2018年1月23日星期二 UTC+8上午4:56:35,Ming F写道:

ok, Thanks!

在 2018年1月23日星期二 UTC+8上午9:31:03,Gian Merlino写道: