forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BETWEEN expression in v2 engine (opensearch-project#1163) (opense…
…arch-project#1187) * Add between grammar and in-memory impl Signed-off-by: Chen Dai <[email protected]> * Add comparison test for between Signed-off-by: Chen Dai <[email protected]> * Add doctest for between Signed-off-by: Chen Dai <[email protected]> * Add not between support Signed-off-by: Chen Dai <[email protected]> * Fix doctest failure Signed-off-by: Chen Dai <[email protected]> * Refactor to rewrite to basic comparison expression Signed-off-by: Chen Dai <[email protected]> * Clean up unused code Signed-off-by: Chen Dai <[email protected]> * Prepare to publish PR Signed-off-by: Chen Dai <[email protected]> Signed-off-by: Chen Dai <[email protected]> (cherry picked from commit 6c0af83) Co-authored-by: Chen Dai <[email protected]>
- Loading branch information
1 parent
ab46fdd
commit eb595c7
Showing
9 changed files
with
169 additions
and
17 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
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
40 changes: 40 additions & 0 deletions
40
core/src/main/java/org/opensearch/sql/ast/expression/Between.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,40 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.ast.expression; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
import org.opensearch.sql.ast.Node; | ||
|
||
/** | ||
* Unresolved expression for BETWEEN. | ||
*/ | ||
@Data | ||
@EqualsAndHashCode(callSuper = false) | ||
public class Between extends UnresolvedExpression { | ||
|
||
/** Value for range check. */ | ||
private final UnresolvedExpression value; | ||
|
||
/** Lower bound of the range (inclusive). */ | ||
private final UnresolvedExpression lowerBound; | ||
|
||
/** Upper bound of the range (inclusive). */ | ||
private final UnresolvedExpression upperBound; | ||
|
||
@Override | ||
public List<? extends Node> getChild() { | ||
return Arrays.asList(value, lowerBound, upperBound); | ||
} | ||
|
||
@Override | ||
public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitBetween(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
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
Oops, something went wrong.