terrymanu commented on a change in pull request #3217: support now() for
sharding value
URL:
https://github.com/apache/incubator-shardingsphere/pull/3217#discussion_r333944312
##########
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:
What I mean is we need SPI to load `TimeService`, but we should load SPI
obvious from the caller.
Right now, we put loading SPI logic into `DefaultTimeService`, that make
`DefaultTimeService` to complicated.
`DefaultTimeService` may just as a regular SPI implementation.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services