-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Fix resultLevelCache for timeseries with grandTotal #7624
Conversation
if (timestamp == null && tResult.timestamp == null) { | ||
return 0; | ||
} else if (timestamp == null) { | ||
return 1; |
There was a problem hiding this comment.
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) ?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @jihoonson. LGTM !
…l-result-level-cache
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍
* Fix resultLevelCache for timeseries with grandTotal * Address comment * fix test
* Fix resultLevelCache for timeseries with grandTotal * Address comment * fix test
* Fix resultLevelCache for timeseries with grandTotal * Address comment * fix test
…ache#7637) * Fix resultLevelCache for timeseries with grandTotal * Address comment * fix test
* Fix resultLevelCache for timeseries with grandTotal * Address comment * fix test
Fixes #7621.