-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update IntervalShardingAlgorithm.java to fix an exception caused by polymorphism #20255
Conversation
the method private String getDateTimeText(final Comparable<?> endpoint) will throws an java.lang.UnsupportedOperationException if the parameter endpoint's type is java.sql.Date, because of java.sql.Date values do not have a time component, so it's mehtod public Instant toInstant() always throws an java.lang.UnsupportedOperationException.
Codecov Report
@@ Coverage Diff @@
## master #20255 +/- ##
============================================
+ Coverage 60.87% 60.90% +0.02%
Complexity 2422 2422
============================================
Files 3876 3876
Lines 54690 54692 +2
Branches 9310 9311 +1
============================================
+ Hits 33295 33311 +16
+ Misses 18542 18529 -13
+ Partials 2853 2852 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
The CI bug was fixed by Filter poolName when execute show database resources #20274, this PR should merge the master branch.
-
It is better to add a test case of
java.sql.Date
to the corresponding unit test class of this class. Previous tests missed this class.
...pache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithmTest.java
Outdated
Show resolved
Hide resolved
use Java 8 Date Time API to construct java.sql.Date instance
fix the missed import statement
|
the method private String getDateTimeText(final Comparable<?> endpoint) will throws an java.lang.UnsupportedOperationException if the parameter endpoint's type is java.sql.Date, because of java.sql.Date values do not have a time component, so it's mehtod public Instant toInstant() always throws an java.lang.UnsupportedOperationException.
Reproduction example: examples/shardingsphere-jdbc-example/single-feature-example/sharding-example/sharding-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/sharding/raw/jdbc/ShardingRawYamlIntervalConfigurationExample.java
Changes proposed in this pull request: