diff --git a/core/src/main/java/org/opensearch/sql/executor/execution/PaginatedPlan.java b/core/src/main/java/org/opensearch/sql/executor/execution/PaginatedPlan.java index 62c913ee67..36b1b23e5e 100644 --- a/core/src/main/java/org/opensearch/sql/executor/execution/PaginatedPlan.java +++ b/core/src/main/java/org/opensearch/sql/executor/execution/PaginatedPlan.java @@ -39,6 +39,7 @@ public void execute() { @Override public void explain(ResponseListener listener) { - throw new UnsupportedOperationException("implement PaginatedPlan.explain"); + listener.onFailure(new UnsupportedOperationException( + "`explain` feature for paginated requests is not implemented yet.")); } } diff --git a/sql/src/main/java/org/opensearch/sql/sql/SQLService.java b/sql/src/main/java/org/opensearch/sql/sql/SQLService.java index 0912bf3482..908f03e4f2 100644 --- a/sql/src/main/java/org/opensearch/sql/sql/SQLService.java +++ b/sql/src/main/java/org/opensearch/sql/sql/SQLService.java @@ -67,6 +67,12 @@ private AbstractPlan plan( Optional> explainListener) { if (request.getCursor().isPresent()) { // Handle v2 cursor here -- legacy cursor was handled earlier. + if (queryListener.isEmpty() && explainListener.isPresent()) { // explain request + explainListener.get().onFailure(new UnsupportedOperationException( + "`explain` request for cursor requests is not supported. " + + "Use `explain` for the initial query request.")); + } + // non-explain request return queryExecutionFactory.create(request.getCursor().get(), queryListener.get()); } else { // 1.Parse query and convert parse tree (CST) to abstract syntax tree (AST)