lalicw opened a new issue #1884: between ... and ... for column of datetime  
type is not supported
URL: https://github.com/apache/incubator-shardingsphere/issues/1884
 
 
   ## Bug Report
   SQL like "select * from t_order  where create_time between '2018-01-01 
00:00:00' and '2018-01-02 00:00:00'"  is not supported
   
   CommonExpressionSegment.java not support the string value and in the code of 
PredicateExtractor
   it extract the number value and ignore the string value.
   ` private Optional<? extends ExpressionSegment> buildExpression(final 
Map<ParserRuleContext, Integer> questionNodeIndexMap, final ParserRuleContext 
valueNode) {
           Optional<? extends ExpressionSegment> sqlExpression = new 
ExpressionExtractor().extract(valueNode);
           if (!sqlExpression.isPresent() || !(sqlExpression.get() instanceof 
CommonExpressionSegment)) {
               return sqlExpression;
           }
           CommonExpressionSegment commonExpressionSegment = 
(CommonExpressionSegment) sqlExpression.get();
           Optional<ParserRuleContext> expressionNode = 
ExtractorUtils.findFirstChildNode(valueNode, RuleName.QUESTION);
           if (expressionNode.isPresent()) {
               Integer index = questionNodeIndexMap.get(expressionNode.get());
               commonExpressionSegment.setIndex(index);
           } else {
               Optional<ParserRuleContext> bitExprNode = 
ExtractorUtils.findFirstChildNode(valueNode, RuleName.BIT_EXPR);
               expressionNode = ExtractorUtils.findFirstChildNode(valueNode, 
RuleName.NUMBER);
               if (expressionNode.isPresent() && (!bitExprNode.isPresent() || 1 
== bitExprNode.get().getChildCount())) {
                   
commonExpressionSegment.setValue(NumberUtil.getExactlyNumber(expressionNode.get().getText(),
 10));
               }
           }
           return sqlExpression;
       }`
   
   but in the 4.0.0-SNAPSHOT version, it has been fixed.
   
   ### Which version of ShardingSphere did you use?
   3.1.0
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-JDBC 
   ### Expected behavior
   supported
   ### Actual behavior
   not supported
   ### Reason analyze (If you can)
   as mentioned above
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   as mentioned above
   ### Example codes for reproduce this issue (such as a github link).
   as mentioned above

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to