You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/05/09 10:13:36 UTC

[GitHub] [shardingsphere] wuwu20048 opened a new issue, #17483: why 5.1.1 version The SQL clause 'IS' is unsupported?

wuwu20048 opened a new issue, #17483:
URL: https://github.com/apache/shardingsphere/issues/17483

   ## Bug Report
   
    "is not null" or "<> null" was supported for encrypt  cipher filed  in 5.0.0 version . but in 5.1.1 version The SQL clause 'IS' is unsupported.
   
   why ?
   
   ### Which version of ShardingSphere did you use?
    5.1.1 version
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
    ShardingSphere-JDBC
   ### Expected behavior
   I want the “IS” work well for the cipher filed
   ### Actual behavior
   ```java
   Caused by: org.apache.shardingsphere.infra.exception.ShardingSphereException: The SQL clause 'IS' is unsupported in encrypt rule.
   	at org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine.createBinaryEncryptCondition(EncryptConditionEngine.java:135)
   	at org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine.createEncryptCondition(EncryptConditionEngine.java:118)
   	at org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine.addEncryptConditions(EncryptConditionEngine.java:111)
   	at org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine.addEncryptConditions(EncryptConditionEngine.java:102)
   	at org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine.createEncryptConditions(EncryptConditionEngine.java:92)
   	at org.apache.shardingsphere.encrypt.rewrite.context.EncryptSQLRewriteContextDecorator.getEncryptConditions(EncryptSQLRewriteContextDecorator.java:71)
   	at org.apache.shardingsphere.encrypt.rewrite.context.EncryptSQLRewriteContextDecorator.decorate(EncryptSQLRewriteContextDecorator.java:48)
   	at org.apache.shardingsphere.encrypt.rewrite.context.EncryptSQLRewriteContextDecorator.decorate(EncryptSQLRewriteContextDecorator.java:43)
   	at org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry.decorate(SQLRewriteEntry.java:88)
   	at org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry.createSQLRewriteContext(SQLRewriteEntry.java:80)
   	at org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry.rewrite(SQLRewriteEntry.java:73)
   	at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.rewrite(KernelProcessor.java:59)
   	at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:47)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createExecutionContext(ShardingSpherePreparedStatement.java:470)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeQuery(ShardingSpherePreparedStatement.java:214)
   	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70)
   	at org.hibernate.loader.Loader.getResultSet(Loader.java:2117)
   	at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1900)
   	at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1876)
   	at org.hibernate.loader.Loader.doQuery(Loader.java:919)
   	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)
   	at org.hibernate.loader.Loader.doList(Loader.java:2617)
   	at org.hibernate.loader.Loader.doList(Loader.java:2600)
   	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2429)
   	at org.hibernate.loader.Loader.list(Loader.java:2424)
   	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501)
   	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371)
   	at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
   	at org.hibernate.internal.StatelessSessionImpl.list(StatelessSessionImpl.java:566)
   	at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)
   ```
   ### Reason analyze (If you can)
   ```java
       static {
           LOGICAL_OPERATOR.add("AND");
           LOGICAL_OPERATOR.add("&&");
           LOGICAL_OPERATOR.add("OR");
           LOGICAL_OPERATOR.add("||");
           SUPPORTED_COMPARE_OPERATOR.add("=");
           SUPPORTED_COMPARE_OPERATOR.add("<>");
           SUPPORTED_COMPARE_OPERATOR.add("!=");
           SUPPORTED_COMPARE_OPERATOR.add(">");
           SUPPORTED_COMPARE_OPERATOR.add("<");
           SUPPORTED_COMPARE_OPERATOR.add(">=");
           SUPPORTED_COMPARE_OPERATOR.add("<=");
       }
       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 ShardingSphereException("The SQL clause '%s' is unsupported in encrypt rule.", operator);
           }
           return Optional.empty();
       }
   ```
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu closed issue #17483: why 5.1.1 version The SQL clause 'IS' is unsupported?

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #17483:  why 5.1.1 version The SQL clause 'IS' is unsupported?
URL: https://github.com/apache/shardingsphere/issues/17483


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] cheese8 commented on issue #17483: why 5.1.1 version The SQL clause 'IS' is unsupported?

Posted by GitBox <gi...@apache.org>.
cheese8 commented on issue #17483:
URL: https://github.com/apache/shardingsphere/issues/17483#issuecomment-1120959206

   I will follow this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org