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/09/06 03:07:48 UTC

[GitHub] [shardingsphere] kissthisrain opened a new issue, #20812: why 5.1.2 version The SQL clause 'LIKE' is unsupported?

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

   ## Bug Report
    in version 5.1.2,The SQL clause 'LIKE' is unsupported in encrypt rule,I dont konw why
   
   
   ### Which version of ShardingSphere did you use?
    5.1.2
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   support 'like'
   
   ### Actual behavior
   ```java
   Caused by: org.apache.shardingsphere.infra.exception.ShardingSphereException: The SQL clause 'LIKE' is unsupported in encrypt rule.
   	at org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine.createBinaryEncryptCondition(EncryptConditionEngine.java:143)
   	at org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine.createEncryptCondition(EncryptConditionEngine.java:126)
   	at org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine.addEncryptConditions(EncryptConditionEngine.java:119)
   	at org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine.addEncryptConditions(EncryptConditionEngine.java:107)
   	at org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine.createEncryptConditions(EncryptConditionEngine.java:97)
   	at org.apache.shardingsphere.encrypt.rewrite.context.EncryptSQLRewriteContextDecorator.createEncryptConditions(EncryptSQLRewriteContextDecorator.java:73)
   	at org.apache.shardingsphere.encrypt.rewrite.context.EncryptSQLRewriteContextDecorator.decorate(EncryptSQLRewriteContextDecorator.java:53)
   	at org.apache.shardingsphere.encrypt.rewrite.context.EncryptSQLRewriteContextDecorator.decorate(EncryptSQLRewriteContextDecorator.java:44)
   	at org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry.decorate(SQLRewriteEntry.java:86)
   	at org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry.createSQLRewriteContext(SQLRewriteEntry.java:78)
   	at org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry.rewrite(SQLRewriteEntry.java:67)
   	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:471)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:364)
   	at sun.reflect.GeneratedMethodAccessor339.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
   	at com.sun.proxy.$Proxy680.execute(Unknown Source)
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
   	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
   	at sun.reflect.GeneratedMethodAccessor347.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
   	at com.sun.proxy.$Proxy678.query(Unknown Source)
   	at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doQuery(MybatisSimpleExecutor.java:69)
   	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
   	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
   	at com.baomidou.mybatisplus.core.executor.MybatisCachingExecutor.query(MybatisCachingExecutor.java:165)
   	at com.baomidou.mybatisplus.core.executor.MybatisCachingExecutor.query(MybatisCachingExecutor.java:92)
   	at sun.reflect.GeneratedMethodAccessor329.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
   	at com.sun.proxy.$Proxy677.query(Unknown Source)
   	at sun.reflect.GeneratedMethodAccessor329.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
   	at com.sun.proxy.$Proxy677.query(Unknown Source)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
   ```
   
   ### 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("<=");
           SUPPORTED_COMPARE_OPERATOR.add("IS");
       }
   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 commented on issue #20812: why 5.1.2 version The SQL clause 'LIKE' is unsupported?

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

   This bug has been fixed in 5.2.0 version, so I will close this issue.


-- 
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] strongduanmu closed issue #20812: why 5.1.2 version The SQL clause 'LIKE' is unsupported?

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


-- 
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] strongduanmu closed issue #20812: why 5.1.2 version The SQL clause 'LIKE' is unsupported?

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


-- 
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] strongduanmu commented on issue #20812: why 5.1.2 version The SQL clause 'LIKE' is unsupported?

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

   Sorry, this issue has not been fixed yet, I will reopen the issue.


-- 
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] strongduanmu commented on issue #20812: why 5.1.2 version The SQL clause 'LIKE' is unsupported?

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

   Duplicated with #20435.


-- 
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] strongduanmu commented on issue #20812: why 5.1.2 version The SQL clause 'LIKE' is unsupported?

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

   @kissthisrain Thank you for your feedback, this is a bug in 5.1.2. We fixed this bug in the upcoming 5.2.0 version.


-- 
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] github-actions[bot] closed issue #20812: why 5.1.2 version The SQL clause 'LIKE' is unsupported?

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #20812: why 5.1.2 version The SQL clause 'LIKE' is unsupported?
URL: https://github.com/apache/shardingsphere/issues/20812


-- 
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] github-actions[bot] commented on issue #20812: why 5.1.2 version The SQL clause 'LIKE' is unsupported?

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #20812:
URL: https://github.com/apache/shardingsphere/issues/20812#issuecomment-1272348604

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


-- 
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