Skip to content

Sorting on stringLast aggregated fields doesn't seem to work #8159

@vinpai

Description

@vinpai

Please provide a detailed title (e.g. "Broker crashes when using TopN query with Bound filter" instead of just "Broker crashes").

While using the limitSpec in groupBy queries, if we sort on stringLast aggregated fields, the final result isn't sorted.

Affected Version

0.14.2

Description

Based on the ingestion_spec mentioned here - https://druid.apache.org/docs/latest/tutorials/tutorial-ingestion-spec.html

If I have a query like below, it doesn't seem to sort the results. However, if the same field is added in the dimensions list, the results are sorted. However, in my use case I need the sorting on the stringLast value.

Another thing I noticed was if the sorting was done on one of the metrics using longLast aggregation, then that seems to work.

{
"dataSource": {
"type": "table",
"name": "ingestion-tutorial"
},
"queryType": "groupBy",
"intervals": [
"2019-07-23T23:31:40.737/2019-07-24T23:31:40.737"
],
"granularity": "all",
"limitSpec": {
"type": "default",
"columns": [
{
"dimension": "protocol",
"direction": "ascending",
"dimensionOrder": "alphanumeric"
}
],
"limit": 50
},
"dimensions": [
{
"type": "default",
"dimension": "srcIp",
"outputName": "srcIp"
},
{
"type": "default",
"dimension": "dstIp",
"outputName": "dstIp"
}
],
"aggregations": [
{
"type": "stringLast",
"name": "protocol",
"fieldName": "protocol"
}
]
}

Please include as much detailed information about the problem as possible.

  • Cluster size
    Single server

  • Configurations in use

  • Steps to reproduce the problem

  • The error message or stack traces encountered. Providing more context, such as nearby log messages or even entire logs, can be helpful.

  • Any debugging that you have already done

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