This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 535c54f70ff Refactor createBinaryEncryptCondition code style according 
to code review (#26760)
535c54f70ff is described below

commit 535c54f70ff67dcf9901cd0ac609ec37d8a6a584
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Wed Jul 5 08:09:55 2023 +0800

    Refactor createBinaryEncryptCondition code style according to code review 
(#26760)
---
 .../encrypt/rewrite/condition/EncryptConditionEngine.java     | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git 
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/condition/EncryptConditionEngine.java
 
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/condition/EncryptConditionEngine.java
index 37437b52f29..f42bf7f54d5 100644
--- 
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/condition/EncryptConditionEngine.java
+++ 
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/condition/EncryptConditionEngine.java
@@ -26,6 +26,7 @@ import org.apache.shardingsphere.encrypt.rule.EncryptTable;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import 
org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BetweenExpression;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
@@ -158,13 +159,11 @@ public final class EncryptConditionEngine {
     
     private Optional<EncryptCondition> createBinaryEncryptCondition(final 
BinaryOperationExpression expression, final String tableName) {
         String operator = expression.getOperator();
-        if (!LOGICAL_OPERATOR.contains(operator)) {
-            if (SUPPORTED_COMPARE_OPERATOR.contains(operator)) {
-                return createCompareEncryptCondition(tableName, expression, 
expression.getRight());
-            }
-            throw new UnsupportedEncryptSQLException(operator);
+        if (LOGICAL_OPERATOR.contains(operator)) {
+            return Optional.empty();
         }
-        return Optional.empty();
+        
ShardingSpherePreconditions.checkState(SUPPORTED_COMPARE_OPERATOR.contains(operator),
 () -> new UnsupportedEncryptSQLException(operator));
+        return createCompareEncryptCondition(tableName, expression, 
expression.getRight());
     }
     
     private Optional<EncryptCondition> createCompareEncryptCondition(final 
String tableName, final BinaryOperationExpression expression, final 
ExpressionSegment compareRightValue) {

Reply via email to