Issue 1:
Bug Report

Which version of ShardingSphere did you use?

5.1.1

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior

Just a simple query sql with interval sharding algorithm config like below:

shardingsphere:
rules:
sharding:
default-database-strategy:
none:
default-table-strategy:
none:
sharding-algorithms:
sharding-by-month:
type: INTERVAL
props:
datetime-pattern: "yyyy-MM-dd HH:mm:ss"
datetime-lower: "2022-06-01 00:00:00"
datetime-upper: "2022-12-01 00:00:00"
sharding-suffix-pattern: "yyyyMM"
datetime-interval-amount: 1
datetime-interval-unit: "months"

select id, username from user_info where created_time > '2022-05-01 00:00:00'

Actual behavior

exec sharding failure, Method threw 'java.time.format.DateTimeParseException' exception. Text '2022-05-22T15:06:54' could not be parsed at index 10

Reason analyze (If you can)

IntervalShardingAlgorithm#hasIntersection calc range lower and upper endpoint called range.lowerEndpoint().toString(), the output result format will be "yyyy-MM-dd'T'HH:mm:ss.SSS" that with T char in middle and not match the config props "datetime-pattern: yyyy-MM-dd HH:mm:ss"，it cause parseDateTime exec failure.

private boolean hasIntersection(final Range<LocalDateTime> calculateRange, final Range<Comparable<?>> range) {
LocalDateTime lower = range.hasLowerBound() ? parseDateTime(**range.lowerEndpoint().toString()**) : dateTimeLower;
LocalDateTime upper = range.hasUpperBound() ? parseDateTime(**range.upperEndpoint().toString()**) : dateTimeUpper;
BoundType lowerBoundType = range.hasLowerBound() ? range.lowerBoundType() : BoundType.CLOSED;
BoundType upperBoundType = range.hasUpperBound() ? range.upperBoundType() : BoundType.CLOSED;
Range<LocalDateTime> dateTimeRange = Range.range(lower, lowerBoundType, upper, upperBoundType);
return calculateRange.isConnected(dateTimeRange) && !calculateRange.intersection(dateTimeRange).isEmpty();
}

private LocalDateTime parseDateTime(final String value) {
return **LocalDateTime.parse(value.substring(0, dateTimePatternLength), dateTimeFormatter);**
}

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

none

Example codes for reproduce this issue (such as a github link).

none

Issue 2:
Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Searched open and closed GitHub issues.

Read documentation: ShardingSphere Doc.

Please pay attention on issues you submitted, because we maybe need more details.

If no response more than 7 days and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

4.0.0-RC1

Which project did you use? Sharding-JDBC or Sharding-Proxy?

Sharding-JDBC

Expected behavior

Logic SQL

INSERT INTO `DEMO_USER` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)

Expected SQL

INSERT INTO `DEMO_USER3` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)

Actual behavior

INSERT INTO `DEMO_USER3` (id, name, age, tags, NICK_NAME_TT4, ENCRYPT_TEST, key, acc1, acc2, localDate, createdAt, updatedAt, deletedAt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

spring
shardingsphere:
datasource:
names: ds0
ds0:
type: com.zaxxer.hikari.HikariDataSource
# driverClassName: com.mysql.cj.jdbc.Driver
jdbcUrl: jdbc:mysql://${db.host}:${db.port}/${db.schema}?useUnicode=true&characterEncoding=utf8&useSSL=false
username: ${db.username}
password: ${db.password}
sharding:
tables:
DEMO_USER:
actual-data-nodes: ds0.DEMO_USER$->{0..4}
table-strategy:
inline:
sharding-column: age
algorithm-expression: DEMO_USER$->{age % 5}
props:
sql:
show: true

Example codes for reproduce this issue (such as a github link).

!@#$`2019-05-30 15:39:31,785`[//]`INFO `main`ShardingSphere-SQL`Rule Type: sharding
!@#$`2019-05-30 15:39:31,785`[//]`INFO `main`ShardingSphere-SQL`Logic SQL: INSERT INTO `DEMO_USER` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)
!@#$`2019-05-30 15:39:31,785`[//]`INFO `main`ShardingSphere-SQL`SQLStatement: InsertStatement(super=DMLStatement(super=AbstractSQLStatement(type=DML, tables=Tables(tables=[Table(name=DEMO_USER, alias=Optional.absent())]), routeConditions=Conditions(orCondition=OrCondition(andConditions=[AndCondition(conditions=[Condition(column=Column(name=age, tableName=DEMO_USER), operator=EQUAL, compareOperator=null, positionValueMap={}, positionIndexMap={0=2})])])), encryptConditions=Conditions(orCondition=OrCondition(andConditions=[])), sqlTokens=[TableToken(tableName=DEMO_USER, quoteCharacter=BACK_QUOTE, schemaNameLength=0), SQLToken(startIndex=24)], parametersIndex=13, logicSQL=INSERT INTO `DEMO_USER` (`id`,`name`,`age`,`tags`,`NICK_NAME_TT4`,`ENCRYPT_TEST`,`key`,`acc1`,`acc2`,`localDate`,`createdAt`,`updatedAt`,`deletedAt`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)), deleteStatement=false, updateTableAlias={}, updateColumnValues={}, whereStartIndex=0, whereStopIndex=0, whereParameterStartIndex=0, whereParameterEndIndex=0), columnNames=[id, name, age, tags, NICK_NAME_TT4, ENCRYPT_TEST, key, acc1, acc2, localDate, createdAt, updatedAt, deletedAt], values=[InsertValue(columnValues=[org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@142918a0, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@745cf754, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@25bc65ab, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@6eab92f3, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@321b7b9e, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@21eedcde, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@67396475, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@55b74e6b, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@3c1908c8, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@6bc62bb9, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@47f0e078, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@28db2afb, org.apache.shardingsphere.core.parse.old.parser.expression.SQLPlaceholderExpression@5c703860])])
!@#$`2019-05-30 15:39:31,786`[//]`INFO `main`ShardingSphere-SQL`Actual SQL: ds0 ::: INSERT INTO `DEMO_USER3` (id, name, age, tags, NICK_NAME_TT4, ENCRYPT_TEST, key, acc1, acc2, localDate, createdAt, updatedAt, deletedAt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ::: [U57345@abc, goTmtbNosOdrALL3PQIqOA==, 2333, ivo9Lm8d4771fu2hfAO5vw==, alkaksdjflk, fSPTMmlED6BMfs57Dhwpug==, adf-key, 12.5744334, 1112.578867, 2019-05-30, 1559201970400, 1559201970400, -1]