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 FilterOperator to cache next element and avoid repeated consumption on hasNext() calls #3123

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

penghuo
Copy link
Collaborator

@penghuo penghuo commented Oct 25, 2024

Description

This PR addresses a bug in FilterOperator where repeated calls to hasNext() would incorrectly consume input elements. The change includes

  • Updated FilterOperator to cache the next matching element, ensuring that repeated hasNext() calls return true without advancing the input.
  • Unit Tests: Added a test case to confirm that inputPlan.next() is called only once across multiple hasNext() calls, preventing unintended input consumption.
  • IT, SELECT Origin, Dest FROM (SELECT * FROM opensearch_dashboards_sample_data_flights WHERE AvgTicketPrice > 100 GROUP BY Origin, Dest, AvgTicketPrice) AS flights WHERE AvgTicketPrice < 1000 ORDER BY AvgTicketPrice LIMIT 30

Related Issues

#3121

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Collaborator

@ykmr1224 ykmr1224 left a comment

Choose a reason for hiding this comment

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

LGTM

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