diff --git a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4 b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4 index 113ca78dc6094..4d3a5739f98c5 100644 --- a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4 +++ b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4 @@ -918,7 +918,7 @@ simpleExpr | columnRef | simpleExpr collateClause | variable - | simpleExpr OR_ simpleExpr + | simpleExpr VERTICAL_BAR_ VERTICAL_BAR_ simpleExpr | (PLUS_ | MINUS_ | TILDE_ | notOperator | BINARY) simpleExpr | ROW? LP_ expr (COMMA_ expr)* RP_ | EXISTS? subquery diff --git a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java index ae5ce5b7a28d8..8a43ea4e8ade0 100644 --- a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java +++ b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java @@ -639,11 +639,11 @@ public final ASTNode visitSimpleExpr(final SimpleExprContext ctx) { if (null != ctx.LP_() && 1 == ctx.expr().size()) { return visit(ctx.expr(0)); } - if (null != ctx.OR_()) { + if (null != ctx.VERTICAL_BAR_() && 2 == ctx.VERTICAL_BAR_().size()) { ExpressionSegment left = (ExpressionSegment) visit(ctx.simpleExpr(0)); ExpressionSegment right = (ExpressionSegment) visit(ctx.simpleExpr(1)); String text = ctx.start.getInputStream().getText(new Interval(ctx.start.getStartIndex(), ctx.stop.getStopIndex())); - return new BinaryOperationExpression(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), left, right, ctx.OR_().getText(), text); + return new BinaryOperationExpression(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), left, right, ctx.VERTICAL_BAR_(0).getText().concat(ctx.VERTICAL_BAR_(1).getText()), text); } return visitRemainSimpleExpr(ctx); } diff --git a/test/it/parser/src/main/resources/case/dml/select-expression.xml b/test/it/parser/src/main/resources/case/dml/select-expression.xml index 9a9166a21234f..b44c4ddc4747a 100644 --- a/test/it/parser/src/main/resources/case/dml/select-expression.xml +++ b/test/it/parser/src/main/resources/case/dml/select-expression.xml @@ -522,7 +522,7 @@ - + @@ -530,25 +530,25 @@ = - - - - - - || - - - - - + + - = + || - - - + + + + + + = + + + + + + diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-where.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-where.xml index 9b044f659d9a0..1fc4b22468965 100644 --- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-where.xml +++ b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-where.xml @@ -59,6 +59,11 @@ + + + + +