You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/01/25 03:14:13 UTC

[GitHub] guowdxp commented on issue #1813: The same sharding rule, sharding-proxy 3.0.0 can query the data, sharding-proxy 3.1.0 can not query the data.

guowdxp commented on issue #1813: The same sharding rule, sharding-proxy 3.0.0 can query the data, sharding-proxy 3.1.0 can not query the data.
URL: https://github.com/apache/incubator-shardingsphere/issues/1813#issuecomment-457440859
 
 
   I modified the OrConditionFiller.java code according to #1784, but I still can't query the data with this sql. I debug the program under the breakpoint. The value parsed by the sql condition is still -1.  When the program enter the buildExpression method of the OrConditionFiller class, The value of  the expressionSegment variable is already -1.
   
   OrConditionFiller.java 
   
       private com.google.common.base.Optional<SQLExpression> buildExpression(final SelectStatement selectStatement, final ExpressionSegment expressionSegment, final String sql,
                                                                              final ShardingRule shardingRule, final ShardingTableMetaData shardingTableMetaData) {
           if (!(expressionSegment instanceof CommonExpressionSegment)) {
               new ExpressionFiller().fill(expressionSegment, selectStatement, sql, shardingRule, shardingTableMetaData);
               return com.google.common.base.Optional.absent();
           }
           CommonExpressionSegment commonExpressionSegment = (CommonExpressionSegment) expressionSegment;
           if (-1 < commonExpressionSegment.getIndex()) {
               return com.google.common.base.Optional.<SQLExpression>of(new SQLPlaceholderExpression(commonExpressionSegment.getIndex()));
           }
           if (null != commonExpressionSegment.getValue()) {
               return com.google.common.base.Optional.<SQLExpression>of(new SQLNumberExpression(commonExpressionSegment.getValue()));
           }
           //String expression = sql.substring(commonExpressionSegment.getStartPosition(), commonExpressionSegment.getEndPosition() + 1);
           //return Optional.<SQLExpression>of(new SQLTextExpression(expression));
           if(commonExpressionSegment.isText()) {
               return Optional.<SQLExpression>of(new SQLTextExpression(sql.substring(commonExpressionSegment.getStartPosition() + 1, commonExpressionSegment.getEndPosition())));
           }
           return Optional.<SQLExpression>of(new SQLTextExpression(sql.substring(commonExpressionSegment.getStartPosition(), commonExpressionSegment.getEndPosition() + 1)));
       }
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services