Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subtotalsSpec and filtering returns no results #7820

Closed
nrwiersma opened this issue Jun 3, 2019 · 4 comments · Fixed by #7827
Closed

subtotalsSpec and filtering returns no results #7820

nrwiersma opened this issue Jun 3, 2019 · 4 comments · Fixed by #7827
Milestone

Comments

@nrwiersma
Copy link

nrwiersma commented Jun 3, 2019

When using both subtotalsSpec and a filter on a renamed dimension, no results are returned.

Affected Version

Druid 0.14.0

Description

All 3 of the following need to be true to encounter the bug:

  • The dimension needs to have renamed
  • There needs to be a filter on any dimension, I have tested both the queried dimension and a completely separate dimension
  • There must be a subtotalsSpec.

And example query looks like this:

{
    "queryType": "groupBy",
    "dataSource": "some_awesome_table",
    "granularity": "all",
    "dimensions": [
        {
            "type":"default",
            "dimension":"country",
            "outputName":"country_name"
        }
    ],
    "filter": {
       "type": "selector",
       "dimension": "country",
       "value": "ZA"
    },
    "aggregations": [
        {
            "type": "count",
            "name": "count"
        }
    ],
    "subtotalsSpec": [["country_name"], []],	
    "intervals": [
        "2019-05-28T00:00:00Z/2019-05-29T00:00:00Z"
    ],
     "context": {
        "useCache": false,
        "populateCache": false,
        "useResultLevelCache": false,
        "populateResultLevelCache": false
     }
}

This query will return [].
If you remove the filter or the subtotalsSpec or make the "outputName" the same as the dimension, results are returned. Using "bySegment: true" in context also returns results.

On a hunch it may have to do with a single result, I have also tested an or filter, and it still returns no results.

@himanshug
Copy link
Contributor

you are right, I was able to repro it and the cause is that we are trying to reapply filter when processing subtotalsSpec on top of base query result set where filter should just be ignored.

#7827 fixes this.

@nrwiersma
Copy link
Author

Thanks for the prompt response. Really appreciate it.

@akansal1
Copy link

akansal1 commented Jul 1, 2019

has this change been merged in the new release 0.15.0?

@himanshug
Copy link
Contributor

himanshug commented Jul 2, 2019

it will be included in the next release only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants