Pramy commented on a change in pull request #3217: support now() for sharding 
value
URL: 
https://github.com/apache/incubator-shardingsphere/pull/3217#discussion_r333932754
 
 

 ##########
 File path: 
sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/condition/generator/impl/ConditionValueBetweenOperatorGenerator.java
 ##########
 @@ -39,7 +42,15 @@
     public Optional<RouteValue> generate(final PredicateBetweenRightValue 
predicateRightValue, final Column column, final List<Object> parameters) {
         Optional<Comparable> betweenRouteValue = new 
ConditionValue(predicateRightValue.getBetweenExpression(), 
parameters).getValue();
         Optional<Comparable> andRouteValue = new 
ConditionValue(predicateRightValue.getAndExpression(), parameters).getValue();
-        return betweenRouteValue.isPresent() && andRouteValue.isPresent()
-                ? Optional.<RouteValue>of(new 
RangeRouteValue<>(column.getName(), column.getTableName(), 
Range.closed(betweenRouteValue.get(), andRouteValue.get()))) : 
Optional.<RouteValue>absent();
+        if (betweenRouteValue.isPresent() && andRouteValue.isPresent()) {
+            return Optional.<RouteValue>of(new 
RangeRouteValue<>(column.getName(), column.getTableName(), 
Range.closed(betweenRouteValue.get(), andRouteValue.get())));
+        }
+        DefaultTimeService defaultTimeService = new DefaultTimeService();
 
 Review comment:
   ```
   sharding clomn is create_time
   select * from ts_order where create_time between ? and now()
   ```
   I think if use this to query , we still need SPI to load `TimeService`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to