Skip to content

Fixing corner case when only one of upper or lower range is unbounded…#16154

Closed
somu-imply wants to merge 4 commits intoapache:masterfrom
somu-imply:window_unbounded_range
Closed

Fixing corner case when only one of upper or lower range is unbounded…#16154
somu-imply wants to merge 4 commits intoapache:masterfrom
somu-imply:window_unbounded_range

Conversation

@somu-imply
Copy link
Contributor

@somu-imply somu-imply commented Mar 18, 2024

… in a window range

Previously a query with an upper or lower offset of 1 on a window with a single row was throwing a NPE as below

Error: RUNTIME_FAILURE (OPERATOR)

1

java.lang.ArrayIndexOutOfBoundsException

as the corner case was not handled correctly. This PR handles the cases and examples are added

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

Copy link
Contributor

@sreemanamala sreemanamala left a comment

Choose a reason for hiding this comment

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

overall LGTM. Solves the case.
Comment could be updated to when numRows equal to upperOffset rather than just values are 1

@somu-imply somu-imply force-pushed the window_unbounded_range branch from 3a84267 to 145b404 Compare April 8, 2024 19:48
// In such a case the priming of results is not needed
if (rowIdProvider.get() == numRows) {
for (int i = 0; i < aggs.length; i++) {
results[i][resultStorageIndex] = aggs[i].get();
Copy link
Contributor

Choose a reason for hiding this comment

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

this should now be
results[i][resultStorageIndex] = aggFactories[i].finalizeComputation(aggs[i].get())
since this PR

Similarly in reverse cummulative aggregate as well

@github-actions
Copy link

This pull request has been marked as stale due to 60 days of inactivity.
It will be closed in 4 weeks if no further activity occurs. If you think
that's incorrect or this pull request should instead be reviewed, please simply
write any comment. Even if closed, you can still revive the PR at any time or
discuss it on the dev@druid.apache.org list.
Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 12, 2024
@github-actions
Copy link

This pull request/issue has been closed due to lack of activity. If you think that
is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions bot closed this Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants