Skip to content

Fixed GH-3509 Added support for Long type in FilterExpressionTextParser. #3516

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -97,6 +97,7 @@
* }</pre>
*
* @author Christian Tzolov
* @author Sun Yuhan
*/
public class FilterExpressionTextParser {

Expand Down Expand Up @@ -266,6 +267,14 @@ public Filter.Operand visitNotExpression(NotExpressionContext ctx) {
return new Filter.Expression(Filter.ExpressionType.NOT, this.visit(ctx.booleanExpression()), null);
}

@Override
public Filter.Operand visitLongConstant(FiltersParser.LongConstantContext ctx) {
String text = ctx.getText();
// Remove the trailing 'l' or 'L'
long value = Long.parseLong(text.substring(0, text.length() - 1));
return new Filter.Value(value);
}

public Filter.Expression castToExpression(Filter.Operand expression) {
if (expression instanceof Filter.Group group) {
// Remove the top-level grouping.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
token literal names:
null
null
null
'.'
','
'['
Expand Down Expand Up @@ -29,6 +30,7 @@ null

token symbolic names:
null
LONG_SUFFIX
WHERE
DOT
COMMA
Expand Down Expand Up @@ -66,4 +68,4 @@ constant


atn:
[4, 1, 26, 89, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 30, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 39, 16, 1, 0, 0, 0, 39, 21, 1, 0, 0, 0, 39, 25, 1, 0, 0, 0, 39, 33, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 40, 49, 1, 0, 0, 0, 41, 42, 10, 4, 0, 0, 42, 43, 5, 16, 0, 0, 43, 48, 3, 2, 1, 5, 44, 45, 10, 3, 0, 0, 45, 46, 5, 17, 0, 0, 46, 48, 3, 2, 1, 4, 47, 41, 1, 0, 0, 0, 47, 44, 1, 0, 0, 0, 48, 51, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 3, 1, 0, 0, 0, 51, 49, 1, 0, 0, 0, 52, 53, 5, 4, 0, 0, 53, 58, 3, 10, 5, 0, 54, 55, 5, 3, 0, 0, 55, 57, 3, 10, 5, 0, 56, 54, 1, 0, 0, 0, 57, 60, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 61, 1, 0, 0, 0, 60, 58, 1, 0, 0, 0, 61, 62, 5, 5, 0, 0, 62, 5, 1, 0, 0, 0, 63, 64, 7, 0, 0, 0, 64, 7, 1, 0, 0, 0, 65, 66, 5, 25, 0, 0, 66, 67, 5, 2, 0, 0, 67, 71, 5, 25, 0, 0, 68, 71, 5, 25, 0, 0, 69, 71, 5, 22, 0, 0, 70, 65, 1, 0, 0, 0, 70, 68, 1, 0, 0, 0, 70, 69, 1, 0, 0, 0, 71, 9, 1, 0, 0, 0, 72, 74, 7, 1, 0, 0, 73, 72, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 87, 5, 23, 0, 0, 76, 78, 7, 1, 0, 0, 77, 76, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 87, 5, 24, 0, 0, 80, 82, 5, 22, 0, 0, 81, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 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0, 16, 17, 6, 1, -1, 0, 17, 18, 3, 8, 4, 0, 18, 19, 3, 6, 3, 0, 19, 20, 3, 10, 5, 0, 20, 40, 1, 0, 0, 0, 21, 22, 3, 8, 4, 0, 22, 23, 5, 19, 0, 0, 23, 24, 3, 4, 2, 0, 24, 40, 1, 0, 0, 0, 25, 29, 3, 8, 4, 0, 26, 27, 5, 21, 0, 0, 27, 30, 5, 19, 0, 0, 28, 30, 5, 20, 0, 0, 29, 26, 1, 0, 0, 0, 29, 28, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 32, 3, 4, 2, 0, 32, 40, 1, 0, 0, 0, 33, 34, 5, 7, 0, 0, 34, 35, 3, 2, 1, 0, 35, 36, 5, 8, 0, 0, 36, 40, 1, 0, 0, 0, 37, 38, 5, 21, 0, 0, 38, 40, 3, 2, 1, 1, 39, 16, 1, 0, 0, 0, 39, 21, 1, 0, 0, 0, 39, 25, 1, 0, 0, 0, 39, 33, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 40, 49, 1, 0, 0, 0, 41, 42, 10, 4, 0, 0, 42, 43, 5, 17, 0, 0, 43, 48, 3, 2, 1, 5, 44, 45, 10, 3, 0, 0, 45, 46, 5, 18, 0, 0, 46, 48, 3, 2, 1, 4, 47, 41, 1, 0, 0, 0, 47, 44, 1, 0, 0, 0, 48, 51, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 3, 1, 0, 0, 0, 51, 49, 1, 0, 0, 0, 52, 53, 5, 5, 0, 0, 53, 58, 3, 10, 5, 0, 54, 55, 5, 4, 0, 0, 55, 57, 3, 10, 5, 0, 56, 54, 1, 0, 0, 0, 57, 60, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 61, 1, 0, 0, 0, 60, 58, 1, 0, 0, 0, 61, 62, 5, 6, 0, 0, 62, 5, 1, 0, 0, 0, 63, 64, 7, 0, 0, 0, 64, 7, 1, 0, 0, 0, 65, 66, 5, 26, 0, 0, 66, 67, 5, 3, 0, 0, 67, 71, 5, 26, 0, 0, 68, 71, 5, 26, 0, 0, 69, 71, 5, 23, 0, 0, 70, 65, 1, 0, 0, 0, 70, 68, 1, 0, 0, 0, 70, 69, 1, 0, 0, 0, 71, 9, 1, 0, 0, 0, 72, 74, 7, 1, 0, 0, 73, 72, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 76, 5, 24, 0, 0, 76, 92, 5, 1, 0, 0, 77, 79, 7, 1, 0, 0, 78, 77, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 92, 5, 24, 0, 0, 81, 83, 7, 1, 0, 0, 82, 81, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 92, 5, 25, 0, 0, 85, 87, 5, 23, 0, 0, 86, 85, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 92, 1, 0, 0, 0, 90, 92, 5, 22, 0, 0, 91, 73, 1, 0, 0, 0, 91, 78, 1, 0, 0, 0, 91, 82, 1, 0, 0, 0, 91, 86, 1, 0, 0, 0, 91, 90, 1, 0, 0, 0, 92, 11, 1, 0, 0, 0, 11, 29, 39, 47, 49, 58, 70, 73, 78, 82, 88, 91]
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,28 @@ public void enterIdentifier(FiltersParser.IdentifierContext ctx) {
public void exitIdentifier(FiltersParser.IdentifierContext ctx) {
}

/**
* {@inheritDoc}
*
* <p>
* The default implementation does nothing.
* </p>
*/
@Override
public void enterLongConstant(FiltersParser.LongConstantContext ctx) {
}

/**
* {@inheritDoc}
*
* <p>
* The default implementation does nothing.
* </p>
*/
@Override
public void exitLongConstant(FiltersParser.LongConstantContext ctx) {
}

/**
* {@inheritDoc}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,19 @@ public T visitIdentifier(FiltersParser.IdentifierContext ctx) {
return visitChildren(ctx);
}

/**
* {@inheritDoc}
*
* <p>
* The default implementation returns the result of calling {@link #visitChildren} on
* {@code ctx}.
* </p>
*/
@Override
public T visitLongConstant(FiltersParser.LongConstantContext ctx) {
return visitChildren(ctx);
}

/**
* {@inheritDoc}
*
Expand Down
Loading