Skip to content

Commit

Permalink
Add explain request handlers.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Feb 16, 2023
1 parent 888c6a4 commit 74b1e94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void execute() {

@Override
public void explain(ResponseListener<ExecutionEngine.ExplainResponse> listener) {
throw new UnsupportedOperationException("implement PaginatedPlan.explain");
listener.onFailure(new UnsupportedOperationException(
"`explain` feature for paginated requests is not implemented yet."));
}
}
6 changes: 6 additions & 0 deletions sql/src/main/java/org/opensearch/sql/sql/SQLService.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ private AbstractPlan plan(
Optional<ResponseListener<ExplainResponse>> 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)
Expand Down

0 comments on commit 74b1e94

Please sign in to comment.