klniu commented on a change in pull request #8693:
URL: https://github.com/apache/shardingsphere/pull/8693#discussion_r547587149
##########
File path:
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
##########
@@ -124,7 +126,16 @@ private int getLastPartition(final Range<Comparable<?>>
valueRange) {
}
private long parseDate(final Comparable<?> shardingValue) {
- LocalDateTime dateValue =
LocalDateTime.parse(shardingValue.toString(), DATE_TIME_FORMAT);
+ LocalDateTime dateValue;
Review comment:
It happened when the type of the sharding value is LocalDateTime. Here
is the configuration:
```
dt_partition_detection:
actual-data-nodes:
dsd$->{0..9}.dt_partition_detection_$->{2013..2025}0$->{1..4}
database-strategy:
standard:
sharding-column: sys_org_code
sharding-algorithmName: detection-db-sharding
tableStrategy:
standard:
sharding-column: time
sharding-algorithm-name: detection-table-sharding
key-generate-strategy:
type: SNOWFLAKE
column: id
...
detection-table-sharding:
type: INTERVAL
props:
datetime-pattern: yyyy-MM-dd HH:mm:ss
datetime-lower: '2013-01-01 00:00:00'
sharding-suffix-pattern: yyyyQQ
datetime-interval-amount: '3'
datetime-interval-unit: MONTHS
```
Using INTERVAL sharding rule,when insert a entity, whose field **time** is
LocalDateTime.
After PreparedStatement.execute(); it will call doSharding using the
arguments passed to PreparedStatement.
**time** is not called with the toString() method, but directly pass the raw
value. Like the image showing:

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