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
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.
Description
This PR addresses a bug in FilterOperator where repeated calls to hasNext() would incorrectly consume input elements. The change includes
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
https://github.com/opensearch-project/sql/issues/3121
Check List
--signoff
.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.