[Feature](Nereids): add logical operator || && (#15643)
This commit is contained in:
@ -413,6 +413,7 @@ SLASH: '/';
|
||||
PERCENT: '%';
|
||||
TILDE: '~';
|
||||
AMPERSAND: '&';
|
||||
LOGICALAND: '&&';
|
||||
PIPE: '|';
|
||||
CONCAT_PIPE: '||';
|
||||
HAT: '^';
|
||||
|
||||
@ -243,8 +243,8 @@ booleanExpression
|
||||
| (ISNULL | IS_NULL_PRED) LEFT_PAREN valueExpression RIGHT_PAREN #isnull
|
||||
| IS_NOT_NULL_PRED LEFT_PAREN valueExpression RIGHT_PAREN #is_not_null_pred
|
||||
| valueExpression predicate? #predicated
|
||||
| left=booleanExpression operator=AND right=booleanExpression #logicalBinary
|
||||
| left=booleanExpression operator=OR right=booleanExpression #logicalBinary
|
||||
| left=booleanExpression operator=(AND | LOGICALAND) right=booleanExpression #logicalBinary
|
||||
| left=booleanExpression operator=(OR | CONCAT_PIPE) right=booleanExpression #logicalBinary
|
||||
;
|
||||
|
||||
predicate
|
||||
|
||||
@ -575,9 +575,11 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor<Object> {
|
||||
Expression right = getExpression(ctx.right);
|
||||
|
||||
switch (ctx.operator.getType()) {
|
||||
case DorisParser.LOGICALAND:
|
||||
case DorisParser.AND:
|
||||
return new And(left, right);
|
||||
case DorisParser.OR:
|
||||
case DorisParser.CONCAT_PIPE:
|
||||
return new Or(left, right);
|
||||
default:
|
||||
throw new ParseException("Unsupported logical binary type: " + ctx.operator.getText(), ctx);
|
||||
|
||||
Reference in New Issue
Block a user