Skip to content

Malformed GroupBy JSON Query Returns a 500 #4428

@scot0357

Description

@scot0357

Submitting GroupBy queries to the JSON query API returns a 500 when given duplicate output name columns. For example:

{
    "context": {"queryId": "010b5fa5-9a45-4614-8c0b-acaa747c2af0"},
    "dataSource": "Famous_Duets",
    "aggregations": [{
        "fieldName": "count",
        "name": "count",
        "type": "count"
    }],
    "dataSource": "my_datasource",
    "dimensions": [{
        "dimension": "Female_Singer",
        "outputName": "Singer",
        "type": "default"
    }, {
        "dimension": "Male_Singer",
        "outputName": "Singer",
        "type": "default"
    }],
    "granularity": "all",
    "intervals": ["2017-06-20T14:51:00Z/2017-06-20T18:27:00Z"],
    "queryType": "groupBy"
}

Note that Singer is the outputName for more than one groupBy dimension. The query response is:

{"error":"Unknown exception"}

Obviously, the query is malformed, but returning the error in this response might be helpful. The way I tracked it down was in the logs:

2017-06-20T18:49:09,604 INFO [qtp1665324560-197[groupBy_Famous_Duets_010b5fa5-9a45-4614-8c0b-acaa747c2af0]] io.druid.server.QueryResource - Unknown exception [010b5fa5-9a45-4614-8c0b-acaa747c2af0]

Later in the logs, a log containing:

Dimension[Singer] occurred more than once in InputRow

Tipped me off to what the error was.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions