From d7f44aa790c0d7ada27b0526e6f004a1439d2bc5 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Mon, 29 May 2023 16:56:55 -0700 Subject: [PATCH] Address last PR comments. Signed-off-by: Yury-Fridlyand --- .../sql/executor/execution/QueryPlanFactory.java | 2 +- .../sql/planner/physical/CursorCloseOperator.java | 2 +- .../java/org/opensearch/sql/analysis/AnalyzerTest.java | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/opensearch/sql/executor/execution/QueryPlanFactory.java b/core/src/main/java/org/opensearch/sql/executor/execution/QueryPlanFactory.java index 903cecd166..3273eb3c18 100644 --- a/core/src/main/java/org/opensearch/sql/executor/execution/QueryPlanFactory.java +++ b/core/src/main/java/org/opensearch/sql/executor/execution/QueryPlanFactory.java @@ -90,7 +90,7 @@ boolean canConvertToCursor(UnresolvedPlan plan) { } /** - * Creates a {@link CloseCursor} from a cursor. + * Creates a {@link CloseCursor} command on a cursor. */ public AbstractPlan createCloseCursor(String cursor, ResponseListener queryResponseListener) { diff --git a/core/src/main/java/org/opensearch/sql/planner/physical/CursorCloseOperator.java b/core/src/main/java/org/opensearch/sql/planner/physical/CursorCloseOperator.java index ecad7d4791..13a37fb61e 100644 --- a/core/src/main/java/org/opensearch/sql/planner/physical/CursorCloseOperator.java +++ b/core/src/main/java/org/opensearch/sql/planner/physical/CursorCloseOperator.java @@ -42,7 +42,7 @@ public List getChild() { } /** - * Requires to provide a dummy schema, because this plan node located on the top of the tree. + * Provides an empty schema, because this plan node is always located on the top of the tree. */ @Override public ExecutionEngine.Schema schema() { diff --git a/core/src/test/java/org/opensearch/sql/analysis/AnalyzerTest.java b/core/src/test/java/org/opensearch/sql/analysis/AnalyzerTest.java index c76ec68cd7..d5a8cd4322 100644 --- a/core/src/test/java/org/opensearch/sql/analysis/AnalyzerTest.java +++ b/core/src/test/java/org/opensearch/sql/analysis/AnalyzerTest.java @@ -7,6 +7,7 @@ package org.opensearch.sql.analysis; import static java.util.Collections.emptyList; +import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -1657,7 +1658,10 @@ void visit_cursor() { @Test public void visit_close_cursor() { var analyzed = analyze(new CloseCursor().attach(new FetchCursor("pewpew"))); - assertTrue(analyzed instanceof LogicalCloseCursor); - assertTrue(analyzed.getChild().get(0) instanceof LogicalFetchCursor); + assertAll( + () -> assertTrue(analyzed instanceof LogicalCloseCursor), + () -> assertTrue(analyzed.getChild().get(0) instanceof LogicalFetchCursor), + () -> assertEquals("pewpew", ((LogicalFetchCursor) analyzed.getChild().get(0)).getCursor()) + ); } }