diff --git a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/parser/AbstractBuilder.java b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/parser/AbstractBuilder.java index 949fc077df78d..09466502f4a6a 100644 --- a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/parser/AbstractBuilder.java +++ b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/parser/AbstractBuilder.java @@ -24,12 +24,8 @@ public Object visit(ParseTree tree) { return ParserUtils.visit(super::visit, tree); } - protected T typedParsing(ParseTree ctx, Class type) { - return ParserUtils.typedParsing(this, ctx, type); - } - protected LogicalPlan plan(ParseTree ctx) { - return typedParsing(ctx, LogicalPlan.class); + return ParserUtils.typedParsing(this, ctx, LogicalPlan.class); } protected List plans(List ctxs) { diff --git a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/parser/ExpressionBuilder.java b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/parser/ExpressionBuilder.java index 33e9423c256c7..1ed04d43a1ddf 100644 --- a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/parser/ExpressionBuilder.java +++ b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/parser/ExpressionBuilder.java @@ -59,6 +59,7 @@ import static java.util.Collections.emptyList; import static java.util.stream.Collectors.toList; import static org.elasticsearch.xpack.ql.parser.ParserUtils.source; +import static org.elasticsearch.xpack.ql.parser.ParserUtils.typedParsing; import static org.elasticsearch.xpack.ql.parser.ParserUtils.visitList; @@ -71,7 +72,7 @@ public ExpressionBuilder(ParserParams params) { } protected Expression expression(ParseTree ctx) { - return typedParsing(ctx, Expression.class); + return typedParsing(this, ctx, Expression.class); } protected List expressions(List contexts) { diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/AbstractBuilder.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/AbstractBuilder.java index 027760fdf238b..943a60cc52c68 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/AbstractBuilder.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/AbstractBuilder.java @@ -31,12 +31,8 @@ public Object visit(ParseTree tree) { return ParserUtils.visit(super::visit, tree); } - protected T typedParsing(ParseTree ctx, Class type) { - return ParserUtils.typedParsing(this, ctx, type); - } - protected LogicalPlan plan(ParseTree ctx) { - return typedParsing(ctx, LogicalPlan.class); + return ParserUtils.typedParsing(this, ctx, LogicalPlan.class); } protected List plans(List ctxs) { diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/ExpressionBuilder.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/ExpressionBuilder.java index f51284fac50cc..39eb429ef7d41 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/ExpressionBuilder.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/ExpressionBuilder.java @@ -10,8 +10,8 @@ import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.TerminalNode; -import org.elasticsearch.core.Booleans; import org.elasticsearch.common.Strings; +import org.elasticsearch.core.Booleans; import org.elasticsearch.core.Tuple; import org.elasticsearch.xpack.ql.QlIllegalArgumentException; import org.elasticsearch.xpack.ql.expression.Alias; @@ -136,6 +136,7 @@ import static java.util.Collections.singletonList; import static org.elasticsearch.xpack.ql.parser.ParserUtils.source; import static org.elasticsearch.xpack.ql.parser.ParserUtils.text; +import static org.elasticsearch.xpack.ql.parser.ParserUtils.typedParsing; import static org.elasticsearch.xpack.ql.parser.ParserUtils.visitList; import static org.elasticsearch.xpack.sql.type.SqlDataTypeConverter.canConvert; import static org.elasticsearch.xpack.sql.type.SqlDataTypeConverter.converterFor; @@ -154,7 +155,7 @@ abstract class ExpressionBuilder extends IdentifierBuilder { } protected Expression expression(ParseTree ctx) { - return typedParsing(ctx, Expression.class); + return typedParsing(this, ctx, Expression.class); } protected List expressions(List contexts) { @@ -407,7 +408,7 @@ public DataType visitPrimitiveDataType(PrimitiveDataTypeContext ctx) { public Cast visitCastExpression(CastExpressionContext ctx) { CastTemplateContext castTc = ctx.castTemplate(); if (castTc != null) { - return new Cast(source(castTc), expression(castTc.expression()), typedParsing(castTc.dataType(), DataType.class)); + return new Cast(source(castTc), expression(castTc.expression()), typedParsing(this, castTc.dataType(), DataType.class)); } else { ConvertTemplateContext convertTc = ctx.convertTemplate(); DataType dataType = dataType(source(convertTc.dataType()), convertTc.dataType().getText()); @@ -426,7 +427,7 @@ private static DataType dataType(Source ctx, String string) { @Override public Object visitCastOperatorExpression(SqlBaseParser.CastOperatorExpressionContext ctx) { - return new Cast(source(ctx), expression(ctx.primaryExpression()), typedParsing(ctx.dataType(), DataType.class)); + return new Cast(source(ctx), expression(ctx.primaryExpression()), typedParsing(this, ctx.dataType(), DataType.class)); } @Override