-
Notifications
You must be signed in to change notification settings - Fork 180
Backend API support for pagination #4948
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
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
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.
Can you add some tests in CalciteExplainIT?
Is this query
POST /_plugins/_ppl
{
"query": "source=logs | where status='error' | sort timestamp",
"pageSize": 100,
"offset": 1000
}
equals to
POST /_plugins/_ppl
{
"query": "source=logs | where status='error' | sort timestamp | head 100 from 1000"
}
?
| * <p>Unlike regular LogicalSort which may be merged with other sorts by Calcite optimizer, this | ||
| * class ensures pagination is applied as a final post-processing step on the query result. | ||
| */ | ||
| public class LogicalPaginationLimit extends Sort { |
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.
Please reuse LogicalSystemLimit with type=pagination
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.
Updated
| RelNode optimized = optimize(relNode, context); | ||
| RelNode calcitePlan = convertToCalcitePlan(optimized); | ||
| executionEngine.execute(calcitePlan, context, listener); | ||
| AccessController.doPrivileged( |
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.
why add the doPrivileged back?
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.
Updated to remove doPrivileged
Added test cases in CalciteExplainIT |
39352de to
9a809b7
Compare
Signed-off-by: Kai Huang <ahkcs@amazon.com> # Conflicts: # core/src/main/java/org/opensearch/sql/executor/QueryService.java
Signed-off-by: Kai Huang <ahkcs@amazon.com>
Signed-off-by: Kai Huang <ahkcs@amazon.com> # Conflicts: # integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteExplainIT.java
69f3cdb to
ad1c15b
Compare
LantaoJin
left a comment
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.
Is this PR ready for review now?
| */ | ||
| @Test | ||
| public void testExplainPaginationApi() throws IOException { | ||
| enabledOnlyWhenPushdownIsEnabled(); |
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.
Remove this line since the PPL pagination feature should work when the DSL pushdown disabled. We should check the calcite plan without pushdown.
| */ | ||
| @Test | ||
| public void testExplainPaginationApiWithHeadFrom() throws IOException { | ||
| enabledOnlyWhenPushdownIsEnabled(); |
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.
ditto
Not yet, it's currently a POC PR, still need to finalize design |
Description
This PR adds offset-based pagination support for PPL queries executed through the Calcite engine. Users can now paginate through large result sets by specifying pageSize and offset parameters in the request body
API Design
Request Format
Parameters
Example: Paginating Through Results
Check List
--signoffor-s.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.