Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] QL: Remove delegating method (#76418) #76426

Merged
merged 1 commit into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ public Object visit(ParseTree tree) {
return ParserUtils.visit(super::visit, tree);
}

protected <T> T typedParsing(ParseTree ctx, Class<T> 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<LogicalPlan> plans(List<? extends ParserRuleContext> ctxs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -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<Expression> expressions(List<? extends ParserRuleContext> contexts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@ public Object visit(ParseTree tree) {
return ParserUtils.visit(super::visit, tree);
}

protected <T> T typedParsing(ParseTree ctx, Class<T> 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<LogicalPlan> plans(List<? extends ParserRuleContext> ctxs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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<Expression> expressions(List<? extends ParserRuleContext> contexts) {
Expand Down Expand Up @@ -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());
Expand All @@ -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
Expand Down