This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 01a2ea4f228 Use Range.of to instead of Range.between (#36411)
01a2ea4f228 is described below

commit 01a2ea4f228744deda98a271e254786c1ca9329f
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Mon Aug 25 01:28:08 2025 +0800

    Use Range.of to instead of Range.between (#36411)
---
 .../data/pipeline/core/util/IntervalToRangeIterator.java         | 8 ++++----
 .../inventory/calculator/InventoryPositionCalculatorTest.java    | 9 ++++-----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/IntervalToRangeIterator.java
 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/IntervalToRangeIterator.java
index 0718e4b3e9c..694fe0fa4fd 100644
--- 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/IntervalToRangeIterator.java
+++ 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/IntervalToRangeIterator.java
@@ -46,7 +46,7 @@ public final class IntervalToRangeIterator implements 
Iterator<Range<Long>> {
         }
         this.maximum = BigInteger.valueOf(maximum);
         this.interval = BigInteger.valueOf(interval);
-        this.current = BigInteger.valueOf(minimum);
+        current = BigInteger.valueOf(minimum);
     }
     
     @Override
@@ -60,12 +60,12 @@ public final class IntervalToRangeIterator implements 
Iterator<Range<Long>> {
             throw new NoSuchElementException("");
         }
         BigInteger upperLimit = min(maximum, current.add(interval));
-        Range<Long> result = Range.between(current.longValue(), 
upperLimit.longValue());
+        Range<Long> result = Range.of(current.longValue(), 
upperLimit.longValue());
         current = upperLimit.add(BigInteger.ONE);
         return result;
     }
     
-    private BigInteger min(final BigInteger one, final BigInteger another) {
-        return one.compareTo(another) < 0 ? one : another;
+    private BigInteger min(final BigInteger integer1, final BigInteger 
integer2) {
+        return integer1.compareTo(integer2) < 0 ? integer1 : integer2;
     }
 }
diff --git 
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/InventoryPositionCalculatorTest.java
 
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/InventoryPositionCalculatorTest.java
index 71899740fd8..966e9b414ac 100644
--- 
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/InventoryPositionCalculatorTest.java
+++ 
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/InventoryPositionCalculatorTest.java
@@ -32,7 +32,7 @@ class InventoryPositionCalculatorTest {
     
     @Test
     void assertGetPositionByIntegerUniqueKeyRange() {
-        List<IngestPosition> actualPositions = (List<IngestPosition>) 
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(200L, 
Range.between(1L, 600L), 100L);
+        List<IngestPosition> actualPositions = (List<IngestPosition>) 
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(200L, 
Range.of(1L, 600L), 100L);
         assertThat(actualPositions.size(), is(2));
         for (IngestPosition each : actualPositions) {
             assertThat(each, isA(IntegerPrimaryKeyIngestPosition.class));
@@ -48,7 +48,7 @@ class InventoryPositionCalculatorTest {
     
     @Test
     void assertGetPositionByIntegerUniqueKeyRangeWithZeroTotalRecordsCount() {
-        List<IngestPosition> actualPositions = (List<IngestPosition>) 
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(0L, 
Range.between(0L, 0L), 1L);
+        List<IngestPosition> actualPositions = (List<IngestPosition>) 
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(0L, Range.of(0L, 
0L), 1L);
         assertThat(actualPositions.size(), is(1));
         assertThat(actualPositions.get(0), 
isA(IntegerPrimaryKeyIngestPosition.class));
         assertPosition(new IntegerPrimaryKeyIngestPosition(0L, 0L), 
(IntegerPrimaryKeyIngestPosition) actualPositions.get(0));
@@ -56,7 +56,7 @@ class InventoryPositionCalculatorTest {
     
     @Test
     void assertGetPositionByIntegerUniqueKeyRangeWithTheSameMinMax() {
-        List<IngestPosition> actualPositions = (List<IngestPosition>) 
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(200L, 
Range.between(5L, 5L), 100L);
+        List<IngestPosition> actualPositions = (List<IngestPosition>) 
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(200L, 
Range.of(5L, 5L), 100L);
         assertThat(actualPositions.size(), is(1));
         assertThat(actualPositions.get(0), 
isA(IntegerPrimaryKeyIngestPosition.class));
         assertPosition(new IntegerPrimaryKeyIngestPosition(5L, 5L), 
(IntegerPrimaryKeyIngestPosition) actualPositions.get(0));
@@ -68,8 +68,7 @@ class InventoryPositionCalculatorTest {
         long shardingSize = tableRecordsCount / 2L;
         long minimum = Long.MIN_VALUE + 1L;
         long maximum = Long.MAX_VALUE;
-        List<IngestPosition> actualPositions = (List<IngestPosition>) 
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(
-                tableRecordsCount, Range.between(minimum, maximum), 
shardingSize);
+        List<IngestPosition> actualPositions = (List<IngestPosition>) 
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(tableRecordsCount,
 Range.of(minimum, maximum), shardingSize);
         assertThat(actualPositions.size(), is(2));
         for (IngestPosition each : actualPositions) {
             assertThat(each, isA(IntegerPrimaryKeyIngestPosition.class));

Reply via email to