-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
- Loading branch information
1 parent
73f18df
commit 9100c62
Showing
19 changed files
with
401 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
core/src/main/java/org/opensearch/sql/ast/tree/CloseCursor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.ast.tree; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
import org.opensearch.sql.ast.Node; | ||
import org.opensearch.sql.executor.pagination.PlanSerializer; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* TODO | ||
*/ | ||
public class CloseCursor extends UnresolvedPlan { | ||
|
||
/** An instance of {@link Cursor} */ | ||
private UnresolvedPlan child; | ||
|
||
@Override | ||
public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitCloseCursor(this, context); | ||
} | ||
|
||
@Override | ||
public UnresolvedPlan attach(UnresolvedPlan child) { | ||
this.child = child; | ||
return this; | ||
} | ||
|
||
@Override | ||
public List<? extends Node> getChild() { | ||
return List.of(child); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
core/src/main/java/org/opensearch/sql/executor/execution/NonQueryPlan.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.sql.executor.execution; | ||
|
||
import org.opensearch.sql.ast.tree.UnresolvedPlan; | ||
import org.opensearch.sql.common.response.ResponseListener; | ||
import org.opensearch.sql.executor.ExecutionEngine; | ||
import org.opensearch.sql.executor.QueryId; | ||
import org.opensearch.sql.executor.QueryService; | ||
|
||
/** | ||
* Query plan which does not reflect a search query being executed. | ||
*/ | ||
public class NonQueryPlan extends AbstractPlan { | ||
|
||
/** | ||
* The query plan ast. | ||
*/ | ||
protected final UnresolvedPlan plan; | ||
|
||
/** | ||
* Query service. | ||
*/ | ||
protected final QueryService queryService; | ||
|
||
protected final ResponseListener<ExecutionEngine.QueryResponse> listener; | ||
|
||
public NonQueryPlan(QueryId queryId, UnresolvedPlan plan, QueryService queryService, | ||
ResponseListener<ExecutionEngine.QueryResponse> listener) { | ||
super(queryId); | ||
this.plan = plan; | ||
this.queryService = queryService; | ||
this.listener = listener; | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
queryService.execute(plan, listener); | ||
} | ||
|
||
@Override | ||
public void explain(ResponseListener<ExecutionEngine.ExplainResponse> listener) { | ||
throw new UnsupportedOperationException("NonQueryPlan does not support explain"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
core/src/main/java/org/opensearch/sql/planner/logical/LogicalCloseCursor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.planner.logical; | ||
|
||
import java.util.List; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
/** | ||
* TODO | ||
*/ | ||
@ToString | ||
@EqualsAndHashCode(callSuper = false) | ||
public class LogicalCloseCursor extends LogicalPlan { | ||
|
||
public LogicalCloseCursor(LogicalPlan child) { | ||
super(List.of(child)); | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(LogicalPlanNodeVisitor<R, C> visitor, C context) { | ||
return visitor.visitCloseCursor(this, context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
core/src/main/java/org/opensearch/sql/planner/physical/CursorCloseOperator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.planner.physical; | ||
|
||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.opensearch.sql.data.model.ExprValue; | ||
import org.opensearch.sql.executor.ExecutionEngine; | ||
import org.opensearch.sql.storage.TableScanOperator; | ||
|
||
// TODO add doc | ||
@RequiredArgsConstructor | ||
public class CursorCloseOperator extends PhysicalPlan { | ||
|
||
// Entire deserialized from cursor plan tree | ||
private final PhysicalPlan input; | ||
|
||
@Override | ||
public <R, C> R accept(PhysicalPlanNodeVisitor<R, C> visitor, C context) { | ||
return visitor.visitCursorClose(this, context); | ||
} | ||
|
||
@Override | ||
public boolean hasNext() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public ExprValue next() { | ||
throw new IllegalStateException(); | ||
} | ||
|
||
@Override | ||
public List<PhysicalPlan> getChild() { | ||
return List.of(input); | ||
} | ||
|
||
@Override | ||
public ExecutionEngine.Schema schema() { | ||
return new ExecutionEngine.Schema(List.of()); | ||
} | ||
|
||
// TODO remove | ||
@Override | ||
public long getTotalHits() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void open() { | ||
// no-op, no search should be invoked. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.