-
Notifications
You must be signed in to change notification settings - Fork 141
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
Pagination: Add Close Cursor API in v2. #1660
Pagination: Add Close Cursor API in v2. #1660
Conversation
Codecov Report
@@ Coverage Diff @@
## feature/pagination/integ #1660 +/- ##
===========================================================
Coverage 97.22% 97.23%
- Complexity 4217 4238 +21
===========================================================
Files 381 385 +4
Lines 10596 10626 +30
Branches 727 726 -1
===========================================================
+ Hits 10302 10332 +30
Misses 287 287
Partials 7 7
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 this Yury
core/src/main/java/org/opensearch/sql/ast/tree/CloseCursor.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/ast/tree/CloseCursor.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/executor/execution/NonQueryPlan.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/executor/execution/QueryPlanFactory.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/executor/execution/QueryPlanFactory.java
Outdated
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/request/OpenSearchScrollRequest.java
Outdated
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/request/OpenSearchScrollRequest.java
Outdated
Show resolved
Hide resolved
...ocol/src/main/java/org/opensearch/sql/protocol/response/format/NoQueryResponseFormatter.java
Outdated
Show resolved
Hide resolved
legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSQLQueryAction.java
Outdated
Show resolved
Hide resolved
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.
Thank you @Yury-Fridlyand!
What happens when closing the cursor fails?
core/src/main/java/org/opensearch/sql/executor/execution/QueryPlanFactory.java
Outdated
Show resolved
Hide resolved
public class CloseCursor extends UnresolvedPlan { | ||
|
||
/** An instance of {@link Cursor} */ | ||
private UnresolvedPlan child; |
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.
What is this child used for?
As far as I can see, this can be cursor id without loss of generality and would make the code more straight-forward.
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.
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.
I see how it works but it's hard to follow. I hope we can make it more explicit at some point later.
...ocol/src/main/java/org/opensearch/sql/protocol/response/format/NoQueryResponseFormatter.java
Outdated
Show resolved
Hide resolved
96cf27b
9100c62
to
96cf27b
Compare
Nothing. A exception is suppressed and not even logged. |
Seems that jacoco is failing |
Thanks, fixed. |
core/src/main/java/org/opensearch/sql/executor/execution/CommandPlan.java
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/executor/execution/QueryPlanFactory.java
Outdated
Show resolved
Hide resolved
return new ExecutionEngine.Schema(List.of()); | ||
} | ||
|
||
// TODO remove |
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.
TODO?
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.
core/src/main/java/org/opensearch/sql/planner/physical/CursorCloseOperator.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/analysis/AnalyzerTest.java
Outdated
Show resolved
Hide resolved
d7f44aa
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
c8c4f17
to
92e9fb7
Compare
Description
Add close cursor API to V2 similar to V1. Refer to pagination doc.
This code branched of #1600. Once #1600 merged I'll update this branch and change base branch of this PR. Currently, it is a temporary branch to show the changes and approach.
Design
https://github.com/opensearch-project/sql/blob/9100c6285f033784b5a2e58f53d575ece360737f/docs/dev/Pagination-v2.md#close-cursor
Issues Resolved
New endpoint on
_plugins/_sql/close
. Under the hood it works as a subsequent query request, reserialized the cursor, but instead of executing it, just closes to encodedscroll
.TODOs
Return an error on repetitiveclose
or on failureclose
failureCheck List
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.