Skip to content

MetricsSpec fields having type doubleSum returned 0.0 on groupBy query #5180

@rockamitk

Description

@rockamitk

Please help to solve this issue.
#Task
{ "type" : "index", "spec" : { "dataSchema" : { "dataSource" : "fr_json_schema_1k", "parser" : { "type" : "string", "parseSpec" : { "format" : "json", "timestampSpec" : { "column" : "WeekDate", "format" : "auto" }, "dimensionsSpec" : { "dimensions": ["ItemNumber","CalYear","IssuingLOC","Forecast"], "dimensionExclusions" : [], "spatialDimensions" : [] } } }, "metricsSpec" : [ { "type" : "doubleSum", "name" : "SumForecast", "fieldName" : "Forecast" } ], "granularitySpec" : { "type" : "uniform", "segmentGranularity" : "WEEK", "queryGranularity" : "NONE", "intervals" : [ "2014-01-01/2019-12-31" ] } }, "ioConfig" : { "type" : "index", "firehose" : { "type" : "local", "baseDir" : "quickstart/", "filter" : "fr_json_data_1k.json" } }, "tuningConfig" : { "type" : "index", "targetPartitionSize" : 5000000, "maxRowsInMemory" : 75000 } } }
curl -X 'POST' -H 'Content-Type:application/json' -d @quickstart/fr_json_task2_1k.json localhost:8090/druid/indexer/v1/task

Sample JSON Data:
{"ItemNumber":"010014025PP","CalYear":2017,"IssuingLOC":"143130","Forecast":1.64230844186531e-09}
Aggregate Query
{ "queryType": "groupBy", "dataSource": "fr_json_schema_1k", "granularity": "week", "dimensions": ["ItemNumber","CalYear","IssuingLOC"], "aggregations": [ { "type": "count", "name": "Rows", "fieldName": "Forecast" }, { "type": "doubleSum", "name": "Sum", "fieldName": "Forecast" } ], "intervals": [ "2014-01-01T00:00:00Z/2019-12-31T00:00:00Z" ] }
curl -L -H 'Content-Type: application/json' -XPOST --data-binary @quickstart/fr_json_group_1k.json http://localhost:8082/druid/v2/?pretty

Output
{ "version" : "v1", "timestamp" : "2018-12-31T00:00:00.000Z", "event" : { "ItemNumber" : "010014025PP", "CalYear" : 2018, "IssuingLOC" : "143130", "Rows": 1 "Sum" : 0.0 } }

So here its Sum: 0 on metric type is 'longSum' and Sum: 0.0 on metric type is floatSum and doubleSum.
Even its return 0 for integer type metric .
'Forecast' field values has fetched if it declare as Dimension instead metrics.
Count is working fine.
Note: Aggregate sum return expected result file ingestion as csv form instead json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions