Druid is storing the 0 or 0.0 values as null

Hi,

Current we are using druid .10.1 from HDP-2.6.5.0

We are using the druid kafka indexer service ingestion to ingest the data from kafka to druid. we observed that data like 0 or 0.0 is been stored as null in druid as we have verified this behavior from druid post api. Below are the details. Please let me know if I am missing anything here.

Ingestion spec file below:

{
    "type": "kafka",
    "dataSchema": {
        "dataSource": "data-source",
        "parser": {
            "type": "string",
            "parseSpec": {
                "format": "json",
                "timestampSpec": {
                    "column": "datetime",
                    "format": "YYYYMMdd_HHmmss"
                },
                "columns": [
                    "created_date",
                    "s_type",
                    "datetime",
                    "ds_ser",
                    "ven",
                    "cou_name",
                    "c_name",
                    "d_name",
                    "dv_name",
                    "p_name",
                    "redTime",
                    "wrTime",
                    "tRate",
                    "MTRate"
                ],
                "dimensionsSpec": {
                    "dimensions": [
                        "created_date",
                    "s_type",
                    "datetime",
                    "ds_ser",
                    "ven",
                    "cou_name",
                    "c_name",
                    "d_name",
                    "dv_name",
                    "p_name",
                    ]
                }
            }
        },
        "metricsSpec": [{
            "name": "count",
            "type": "count"
        },
            {
                "type": "doubleMax",
                "name": "redTime",
                "fieldName": "redTime"
            },
            {
                "type": "doubleMax",
                "name": "wrTime",
                "fieldName": "wrTime"
            },
            {
                "type": "longMax",
                "name": "tRate",
                "fieldName": "tRate"
            },
            {
                "type": "longMax",
                "name": "MTRate",
                "fieldName": "MTRate"
            }
        ],
        "granularitySpec": {
            "type": "uniform",
            "segmentGranularity": "HOUR",
            "queryGranularity": "NONE"
        }
    },
    "tuningConfig": {
        "type": "kafka",
        "maxRowsPerSegment": 5000000
    },
    "ioConfig": {
        "topic": "ptopic",
        "useEarliestOffset": "true",
        "consumerProperties": {
            "bootstrap.servers": "host:port"
        },
        "taskCount": 1,
        "replicas": 1,
        "taskDuration": "PT5M"
    }
}

Rest api from druid used: http://host:port/druid/v2?pretty

body:

{
    "queryType": "groupBy",
    "dataSource": "data-source",
    "granularity": "all",
    "dimensions": ["ds_ser"],
    "aggregations": [
        {"type": "doubleMax", "name": "redTime", "redTime": "writeresponsetime"},
        {"type": "doubleMax", "name": "wrTime", "wrTime": "totalResponseTime"},
        {"type": "longMax", "name": "tRate", "fieldName": "tRate"},
        {"type": "longMax", "name": "MTRate", "MTRate": "MaxTransferRate"}

    ],
    "intervals": ["2019-01-02T00:00/2019-01-02T23:59"]
}

Response from Druid:

[
    {
        "version": "v1",
        "timestamp": "2019-01-02T00:00:00.000Z",
        "event": {
            "redTime": null,
            "ds_ser": "240163",
            "wrTime": null,
            "tRate": null,
            "MTRate": null
        }
    },
    {
        "version": "v1",
        "timestamp": "2019-01-02T00:00:00.000Z",
        "event": {
            "redTime": null,
            "ds_ser": "443548",
            "wrTime": null,
            "tRate": 0,
            "MTRate": null
        }
    }
]

Data in Kafka:

> {"created_date":"2019-02-03T18:35:59.514Z","s_type":"BLOCK","datetime":"20181121_070000","ds_ser":"443551","ven":"abc","cou_name":"USA","c_name":"Piscataway","d_name":"Piscataway","dv_name":"USPSCG","p_name":"443551-CK","redTime":0.0,"wrTime":0.0,"tRate":0,"MTRate":0}
> {"created_date":"2019-02-03T18:35:59.514Z","s_type":"BLOCK","datetime":"20181121_070000","ds_ser":"443551","ven":"abc","cou_name":"USA","c_name":"Piscataway","d_name":"Piscataway","dv_name":"USPSCG4","p_name":"443551-CF","redTime":0.0,"wrTime":0.0,"tRate":0,"MTRate":0}

Just to update, we are also facing the issue while querying the data from superset. Error from Superset is:

Guys please help here. We need to fix this and this is hampering us badly. Please suggest the workaround if there is any.

May be you want to take a look at
https://github.com/apache/incubator-druid/issues/4349

Thanks & Rgds

Venkat

In your query, the “redTime” “wrTime” and “MTRate” aggregators do not have a “fieldName” property, so you’re aggregating on non-existent columns there, which is probably why you see nulls:

        {"type": "doubleMax", "name": "redTime", "redTime": "writeresponsetime"},
        {"type": "doubleMax", "name": "wrTime", "wrTime": "totalResponseTime"},
        {"type": "longMax", "name": "tRate", "fieldName": "tRate"},
        {"type": "longMax", "name": "MTRate", "MTRate": "MaxTransferRate"}