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

EQL: Add ? param support #52301

Closed
wants to merge 5 commits into from
Closed
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
3 changes: 3 additions & 0 deletions x-pack/plugin/eql/src/main/antlr/EqlBase.g4
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ constant
| number #numericLiteral
| booleanValue #booleanLiteral
| string #stringLiteral
| PARAM #paramLiteral
;

comparisonOperator
Expand Down Expand Up @@ -160,6 +161,8 @@ UNTIL: 'until';
WHERE: 'where';
WITH: 'with';

PARAM: '?';

// Operators
EQ : '=' | '==';
NEQ : '!=';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@

package org.elasticsearch.xpack.eql.parser;

import org.antlr.v4.runtime.Token;
import org.elasticsearch.xpack.eql.parser.EqlBaseParser.SingleStatementContext;
import org.elasticsearch.xpack.ql.plan.logical.LogicalPlan;

import java.util.Map;

public class AstBuilder extends LogicalPlanBuilder {

AstBuilder(ParserParams params) {
super(params);
AstBuilder(ParserParams params, Map<Token, Object> paramTokens) {
super(params, paramTokens);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,18 @@ class EqlBaseBaseListener implements EqlBaseListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStringLiteral(EqlBaseParser.StringLiteralContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterParamLiteral(EqlBaseParser.ParamLiteralContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitParamLiteral(EqlBaseParser.ParamLiteralContext ctx) { }
/**
* {@inheritDoc}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ class EqlBaseBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements EqlBa
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStringLiteral(EqlBaseParser.StringLiteralContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitParamLiteral(EqlBaseParser.ParamLiteralContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,18 @@ interface EqlBaseListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitStringLiteral(EqlBaseParser.StringLiteralContext ctx);
/**
* Enter a parse tree produced by the {@code paramLiteral}
* labeled alternative in {@link EqlBaseParser#constant}.
* @param ctx the parse tree
*/
void enterParamLiteral(EqlBaseParser.ParamLiteralContext ctx);
/**
* Exit a parse tree produced by the {@code paramLiteral}
* labeled alternative in {@link EqlBaseParser#constant}.
* @param ctx the parse tree
*/
void exitParamLiteral(EqlBaseParser.ParamLiteralContext ctx);
/**
* Enter a parse tree produced by {@link EqlBaseParser#comparisonOperator}.
* @param ctx the parse tree
Expand Down
Loading