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

[FEATURE] Support paging system requests #1595

Open
Yury-Fridlyand opened this issue May 1, 2023 · 0 comments
Open

[FEATURE] Support paging system requests #1595

Yury-Fridlyand opened this issue May 1, 2023 · 0 comments
Labels
enhancement New feature or request pagination Pagination feature, ref #656

Comments

@Yury-Fridlyand
Copy link
Collaborator

Yury-Fridlyand commented May 1, 2023

Is your feature request related to a problem?
If the main customer of SQL plugin -- JDBC driver -- uses pagination, it sends all queries as paging requests. See opensearch-project/sql-jdbc#67.

What solution would you like?
Support pagination of queries like

SHOW TABLES
DESCRIBE TABLES
{
    "query" : "describe tables like 'calcs'",
    "fetch_size" : 5
}

Currently, such request has following response:

{
  "error": {
    "reason": "There was internal problem at backend",
    "details": "'class org.opensearch.sql.opensearch.storage.system.OpenSearchSystemIndex' does not support pagination",
    "type": "UnsupportedOperationException"
  },
  "status": 503
}

Error stack:

Server side error during query execution
java.lang.UnsupportedOperationException: 'class org.opensearch.sql.opensearch.storage.system.OpenSearchSystemIndex' does not support pagination
        at org.opensearch.sql.storage.Table.createPagedScanBuilder(Table.java:105) ~[core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.planner.optimizer.rule.CreatePagingTableScanBuilder.apply(CreatePagingTableScanBuilder.java:67) ~[core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.planner.optimizer.rule.CreatePagingTableScanBuilder.apply(CreatePagingTableScanBuilder.java:23) ~[core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.planner.optimizer.LogicalPlanOptimizer.internalOptimize(LogicalPlanOptimizer.java:85) ~[core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.planner.optimizer.LogicalPlanOptimizer.optimize(LogicalPlanOptimizer.java:70) ~[core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.planner.Planner.optimize(Planner.java:65) ~[core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.planner.Planner.plan(Planner.java:41) ~[core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.executor.QueryService.plan(QueryService.java:108) ~[core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.executor.QueryService.lambda$executePlan$1(QueryService.java:75) ~[core-3.0.0.0-SNAPSHOT.jar:?]
        at java.util.Optional.ifPresentOrElse(Optional.java:198) ~[?:?]
        at org.opensearch.sql.executor.QueryService.executePlan(QueryService.java:72) [core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.executor.QueryService.execute(QueryService.java:43) [core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.executor.execution.QueryPlan.execute(QueryPlan.java:71) [core-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.opensearch.executor.OpenSearchQueryManager.lambda$submit$0(OpenSearchQueryManager.java:33) [opensearch-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.sql.opensearch.executor.OpenSearchQueryManager.lambda$withCurrentContext$1(OpenSearchQueryManager.java:47) [opensearch-3.0.0.0-SNAPSHOT.jar:?]
        at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:747) [opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) [?:?]
        at java.lang.Thread.run(Thread.java:1589) [?:?]

What alternatives have you considered?
Ignore fetch_size parameter for such queries and always return full response.

Do you have any additional context?
Implementation of that require implementing a new Physical Plan node -- PaginateOperator.
It was implemented in past and then removed in 1f6cf70 in #1497. Paging system query is not supported by legacy engine too.

@Yury-Fridlyand Yury-Fridlyand added enhancement New feature or request untriaged pagination Pagination feature, ref #656 and removed untriaged labels May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pagination Pagination feature, ref #656
Projects
None yet
Development

No branches or pull requests

1 participant