Skip to content

Commit

Permalink
Revert "Add position() to V2 engine (#177)"
Browse files Browse the repository at this point in the history
This reverts commit eee57aa.

Signed-off-by: Margarit Hakobyan <[email protected]>
  • Loading branch information
margarit-h committed Dec 6, 2022
1 parent cab64ae commit 35ac23b
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.opensearch.sql.ast.expression.Literal;
import org.opensearch.sql.ast.expression.Not;
import org.opensearch.sql.ast.expression.Or;
import org.opensearch.sql.ast.expression.PositionFunction;
import org.opensearch.sql.ast.expression.QualifiedName;
import org.opensearch.sql.ast.expression.RelevanceFieldList;
import org.opensearch.sql.ast.expression.Span;
Expand Down Expand Up @@ -202,13 +201,6 @@ public Expression visitHighlightFunction(HighlightFunction node, AnalysisContext
return new HighlightExpression(expr);
}

@Override
public Expression visitPositionFunction(PositionFunction node, AnalysisContext context) {
Expression stringPatternExpr = node.getStringPatternExpr().accept(this, context);
Expression searchStringExpr = node.getSearchStringExpr().accept(this, context);
return DSL.position(stringPatternExpr, searchStringExpr);
}

@Override
public Expression visitIn(In node, AnalysisContext context) {
return visitIn(node.getField(), node.getValueList(), context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.opensearch.sql.ast.expression.Map;
import org.opensearch.sql.ast.expression.Not;
import org.opensearch.sql.ast.expression.Or;
import org.opensearch.sql.ast.expression.PositionFunction;
import org.opensearch.sql.ast.expression.QualifiedName;
import org.opensearch.sql.ast.expression.RelevanceFieldList;
import org.opensearch.sql.ast.expression.Span;
Expand Down Expand Up @@ -274,10 +273,6 @@ public T visitHighlightFunction(HighlightFunction node, C context) {
return visitChildren(node, context);
}

public T visitPositionFunction(PositionFunction node, C context) {
return visitChildren(node, context);
}

public T visitStatement(Statement node, C context) {
return visit(node, context);
}
Expand Down
6 changes: 0 additions & 6 deletions core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.opensearch.sql.ast.expression.Not;
import org.opensearch.sql.ast.expression.Or;
import org.opensearch.sql.ast.expression.ParseMethod;
import org.opensearch.sql.ast.expression.PositionFunction;
import org.opensearch.sql.ast.expression.QualifiedName;
import org.opensearch.sql.ast.expression.Span;
import org.opensearch.sql.ast.expression.SpanUnit;
Expand Down Expand Up @@ -284,11 +283,6 @@ public UnresolvedExpression highlight(UnresolvedExpression fieldName,
return new HighlightFunction(fieldName, arguments);
}

public UnresolvedExpression position(UnresolvedExpression stringPatternExpr,
UnresolvedExpression searchStringExpr) {
return new PositionFunction(stringPatternExpr, searchStringExpr);
}

public UnresolvedExpression window(UnresolvedExpression function,
List<UnresolvedExpression> partitionByList,
List<Pair<SortOption, UnresolvedExpression>> sortList) {
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions core/src/main/java/org/opensearch/sql/expression/DSL.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,6 @@ public static FunctionExpression position(Expression... expressions) {
return compile(FunctionProperties.None, BuiltinFunctionName.POSITION, expressions);
}

public static FunctionExpression position(Expression... expressions) {
return compile(BuiltinFunctionName.POSITION, expressions);
}

public static FunctionExpression truncate(Expression... expressions) {
return compile(FunctionProperties.None, BuiltinFunctionName.TRUNCATE, expressions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.opensearch.sql.ast.expression.Alias;
import org.opensearch.sql.ast.expression.HighlightFunction;
import org.opensearch.sql.ast.expression.Literal;
import org.opensearch.sql.ast.expression.PositionFunction;
import org.opensearch.sql.expression.NamedExpression;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -49,14 +48,4 @@ void visit_highlight() {
NamedExpression analyze = analyzer.analyze(alias, analysisContext);
assertEquals("highlight(fieldA)", analyze.getNameOrAlias());
}

@Test
void visit_position() {
Alias alias = AstDSL.alias("position(fieldA IN fieldB)",
new PositionFunction(AstDSL.stringLiteral("fieldA"), AstDSL.stringLiteral("fieldB")));
NamedExpressionAnalyzer analyzer = new NamedExpressionAnalyzer(expressionAnalyzer);

NamedExpression analyze = analyzer.analyze(alias, analysisContext);
assertEquals("position(fieldA IN fieldB)", analyze.getNameOrAlias());
}
}

0 comments on commit 35ac23b

Please sign in to comment.