SYMPTOM : When there is a division in Druid SQL, users may get 0 as result.
For example: the return on `Saving_ratio` is always 0 in the following case.
ROOT CAUSE:
All numbers were ingested as of type `longSum` (integer), and in Druid SQL integer divided by integer uses integer division and rounds down. Therefore, the `Saving_ratio` is always zero since 'Save` is less than `Income`
RESOLUTION:
Ingest the data as `floatSum` instead:
"metricsSpec": [ { "type": "count", "name": "count" }, { "type": "floatSum", "name": "Income", "fieldName": "Income", "expression": null }, { "type": "floatSum", "name": "Food_spending", "fieldName": "Food", "expression": null }, { "type": "floatSum", "name": "Clothing_spending", "fieldName": "Clothing", "expression": null }, { "type": "floatSum", "name": "Save", "fieldName": "Save", "expression": null } ],
Comments
0 comments
Please sign in to leave a comment.