-
Notifications
You must be signed in to change notification settings - Fork 139
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
[FEATURE] - Support pagination for PPL and SQL query #656
Comments
[Draft] Design Doc1 OverviewSupport pagination requests for PPL and SQL query 2 Problem StatementsThe V2 engine limits the response size of a query. This is a blocker for ML plugin to pull more data by using Piped Processing Language (PPL). While the V1 SQL engine supports pagination using cursor scrolling, PPL uses the V2 engine explicitly. Therefore, we need to migrate cursor support to the V2 engine. The legacy engine took a stateless approach: the cursor encodes the necessary information for re-constructing the query: https://github.com/opensearch-project/sql/blob/main/docs/dev/Pagination.md 3 Requirements3.1 Use Cases3.1.1 Scrolling through web interfaceSQL cursor
3.1.2 Interacting with ML command in PPL to load full result setSample request:
Users do not need to add the 3.1.3 Extending query size limit#703
3.2 Functional Requirements
4 Measure of Success
5 Design5.1 Background5.1.1 Current execution flowQuery request
execution path: (1a) → (2a) → (3) Scroll query request
execution path: (1a) → (2b) → (3) → legacy OpenSearch request Scroll cursor request
execution path: (1b) → legacy cursor executor 5.2 Design considerations5.2.1 Physical plan generationPhysical plan for index scan does not solely depend on the logical plan for the Option 1Let the Planner generate different physical plans for query and scroll requests.
Option 2Let the Analyzer generate different logical plans for query and scroll requests.
5.2.2 Scrolling interaction with limit/offsetLimitOffsetOpenSearch doesn't allow scroll requests to have offset != 0. 5.2.3 Physical plan retentionExtra calculations are required for some queries, such as the Context lookupWhere does such context live? In local memory? Shared storage? 5.2.4 Backward compatibility with legacy cursor formathttps://github.com/opensearch-project/sql/blob/main/legacy/src/main/java/org/opensearch/sql/legacy/cursor/DefaultCursor.java 5.3 Design Overview5.3.1 Journey of Request5.3.2 Backend: OpenSearch RequestInterface to the OpenSearch engine
5.3.3 Backend: Physical Plan GenerationWe add a new request builder to the OpenSearchIndexScan plan.
We add a 5.3.4 Frontend: Request HandlingIf the request is a scroll query request, set PlanContext so that this information is passed to the planner later. This same logic will apply to both SQL and PPL request handling. 5.3.5 Frontend: Response Formatting5.3.6 Cursor generation and mapping |
In the second cursor request can there be a scenario with some extra calculations along with push down. how do you retain entire physical plan? |
Thanks for pointing this out. I've come up with a design idea that takes this into consideration. It also avoids many of the problems faced in the PoC PR #693
|
relate to #947 |
What's the status of this? |
WIP, you can track it in Bit-Quill#226 |
OpenSearch.SQL.pagination.phase.1.demo.mp4 |
Pagination.with.WHERE.clause.mp4 |
|
Superseded by #1759 |
Is your feature request related to a problem?
What solution would you like?
The text was updated successfully, but these errors were encountered: