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

Fix resultLevelCache for timeseries with grandTotal #7624

Merged
merged 4 commits into from
May 10, 2019

Conversation

jihoonson
Copy link
Contributor

Fixes #7621.

@jihoonson jihoonson added the Bug label May 9, 2019
@jihoonson jihoonson added this to the 0.15.0 milestone May 9, 2019
if (timestamp == null && tResult.timestamp == null) {
return 0;
} else if (timestamp == null) {
return 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be -1, if timestamp is null, assuming null is less than tResult.timestamp(which is supposedly non-null) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, honestly, this doesn't affect to the order of grandTotal. It's computed in brokers and added at the last of the result regardless of the descending flag.

But, I changed this part to handle null timestamp correctly for any use case in the future. Null means unknown value and thus comparing non-nulls with nulls is not defined. Usually other systems provides some options to place nulls at first (NULLS FIRST) or at last (NULLS LAST). We don't have such options yet, and so I thought it would be better to place nulls at last in natural order because the row with null timestamp would be grandTotal. What do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining, if you are placing nulls at last, then this is fine. Although, it might be more clear if you use Comparator.nullsLast

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure fixed.

} else if (timestamp == null) {
return 1;
} else if (tResult == null) {
return -1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this should be 1 ?

Copy link

@surekhasaharan surekhasaharan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @jihoonson. LGTM !

Copy link
Member

@clintropolis clintropolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@fjy fjy merged commit 18e0d6a into apache:master May 10, 2019
@clintropolis clintropolis modified the milestones: 0.15.0, 0.14.2 May 10, 2019
clintropolis pushed a commit that referenced this pull request May 10, 2019
* Fix resultLevelCache for timeseries with grandTotal

* Address comment

* fix test
gianm pushed a commit to implydata/druid-public that referenced this pull request May 10, 2019
* Fix resultLevelCache for timeseries with grandTotal

* Address comment

* fix test
jihoonson added a commit to jihoonson/druid that referenced this pull request May 11, 2019
* Fix resultLevelCache for timeseries with grandTotal

* Address comment

* fix test
jihoonson added a commit that referenced this pull request May 12, 2019
* Fix resultLevelCache for timeseries with grandTotal

* Address comment

* fix test
jihoonson added a commit to implydata/druid-public that referenced this pull request Jun 4, 2019
…ache#7637)

* Fix resultLevelCache for timeseries with grandTotal

* Address comment

* fix test
jihoonson added a commit to implydata/druid-public that referenced this pull request Jun 26, 2019
* Fix resultLevelCache for timeseries with grandTotal

* Address comment

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

Successfully merging this pull request may close these issues.

NPE when both populateResultLevelCache and grandTotal are set
4 participants