This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 8a2d5499715 Rename InventoryPositionCalculator to
InventoryPositionEstimatedCalculator (#37511)
8a2d5499715 is described below
commit 8a2d549971503a39b7cbd01bbba5bec34ebdde33
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Thu Dec 25 16:01:52 2025 +0800
Rename InventoryPositionCalculator to InventoryPositionEstimatedCalculator
(#37511)
* Rename InventoryPositionCalculator to InventoryPositionEstimatedCalculator
* Rename method
---
.../InventoryPositionEstimatedCalculator.java} | 12 ++++++------
.../splitter/InventoryDumperContextSplitter.java | 4 ++--
.../InventoryPositionEstimatedCalculatorTest.java} | 20 ++++++++++----------
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/InventoryPositionCalculator.java
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/position/estimated/InventoryPositionEstimatedCalculator.java
similarity index 86%
rename from
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/InventoryPositionCalculator.java
rename to
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/position/estimated/InventoryPositionEstimatedCalculator.java
index 4f95a43de67..1fd5afec071 100644
---
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/InventoryPositionCalculator.java
+++
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/position/estimated/InventoryPositionEstimatedCalculator.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator;
+package
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator.position.estimated;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@@ -30,20 +30,20 @@ import java.util.LinkedList;
import java.util.List;
/**
- * Inventory position calculator.
+ * Inventory position estimated calculator.
*/
@NoArgsConstructor(access = AccessLevel.NONE)
-public final class InventoryPositionCalculator {
+public final class InventoryPositionEstimatedCalculator {
/**
- * Get position by integer unique key range.
+ * Get positions by integer unique key range.
*
* @param tableRecordsCount table records count
* @param uniqueKeyValuesRange unique key values range
* @param shardingSize sharding size
- * @return position collection
+ * @return positions
*/
- public static List<IngestPosition>
getPositionByIntegerUniqueKeyRange(final long tableRecordsCount, final
Range<Long> uniqueKeyValuesRange, final long shardingSize) {
+ public static List<IngestPosition> getIntegerPositions(final long
tableRecordsCount, final Range<Long> uniqueKeyValuesRange, final long
shardingSize) {
if (0 == tableRecordsCount) {
return Collections.singletonList(new
IntegerPrimaryKeyIngestPosition(0L, 0L));
}
diff --git
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/splitter/InventoryDumperContextSplitter.java
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/splitter/InventoryDumperContextSplitter.java
index 40870f001bf..32da7a3c7dd 100644
---
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/splitter/InventoryDumperContextSplitter.java
+++
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/splitter/InventoryDumperContextSplitter.java
@@ -31,7 +31,7 @@ import
org.apache.shardingsphere.data.pipeline.core.ingest.position.type.placeho
import
org.apache.shardingsphere.data.pipeline.core.job.progress.TransmissionJobItemProgress;
import
org.apache.shardingsphere.data.pipeline.core.metadata.loader.PipelineTableMetaDataUtils;
import
org.apache.shardingsphere.data.pipeline.core.metadata.model.PipelineColumnMetaData;
-import
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator.InventoryPositionCalculator;
+import
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator.position.estimated.InventoryPositionEstimatedCalculator;
import
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator.InventoryRecordsCountCalculator;
import
org.apache.shardingsphere.data.pipeline.core.ratelimit.JobRateLimitAlgorithm;
import
org.apache.shardingsphere.data.pipeline.core.sqlbuilder.sql.PipelinePrepareSQLBuilder;
@@ -124,7 +124,7 @@ public final class InventoryDumperContextSplitter {
if (dataTypeOption.isIntegerDataType(firstColumnDataType)) {
Range<Long> uniqueKeyValuesRange =
getUniqueKeyValuesRange(jobItemContext, dumperContext);
int shardingSize =
jobItemContext.getJobProcessContext().getProcessConfiguration().getRead().getShardingSize();
- return
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(tableRecordsCount,
uniqueKeyValuesRange, shardingSize);
+ return
InventoryPositionEstimatedCalculator.getIntegerPositions(tableRecordsCount,
uniqueKeyValuesRange, shardingSize);
}
if (1 == uniqueKeyColumns.size() &&
dataTypeOption.isStringDataType(firstColumnDataType)) {
return Collections.singleton(new
StringPrimaryKeyIngestPosition(null, null));
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/position/estimated/InventoryPositionEstimatedCalculatorTest.java
similarity index 84%
rename from
kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/InventoryPositionCalculatorTest.java
rename to
kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/position/estimated/InventoryPositionEstimatedCalculatorTest.java
index e4460263af3..2940eace7f0 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/position/estimated/InventoryPositionEstimatedCalculatorTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator;
+package
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator.position.estimated;
import org.apache.commons.lang3.Range;
import
org.apache.shardingsphere.data.pipeline.core.ingest.position.IngestPosition;
@@ -28,11 +28,11 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.isA;
-class InventoryPositionCalculatorTest {
+class InventoryPositionEstimatedCalculatorTest {
@Test
- void assertGetPositionByIntegerUniqueKeyRange() {
- List<IngestPosition> actualPositions =
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(200L,
Range.of(1L, 600L), 100L);
+ void assertGetIntegerPositions() {
+ List<IngestPosition> actualPositions =
InventoryPositionEstimatedCalculator.getIntegerPositions(200L, Range.of(1L,
600L), 100L);
assertThat(actualPositions.size(), is(2));
for (IngestPosition each : actualPositions) {
assertThat(each, isA(IntegerPrimaryKeyIngestPosition.class));
@@ -47,28 +47,28 @@ class InventoryPositionCalculatorTest {
}
@Test
- void assertGetPositionByIntegerUniqueKeyRangeWithZeroTotalRecordsCount() {
- List<IngestPosition> actualPositions =
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(0L, Range.of(0L,
0L), 1L);
+ void assertGetIntegerPositionsWithZeroTotalRecordsCount() {
+ List<IngestPosition> actualPositions =
InventoryPositionEstimatedCalculator.getIntegerPositions(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));
}
@Test
- void assertGetPositionByIntegerUniqueKeyRangeWithTheSameMinMax() {
- List<IngestPosition> actualPositions =
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(200L,
Range.of(5L, 5L), 100L);
+ void assertGetIntegerPositionsWithTheSameMinMax() {
+ List<IngestPosition> actualPositions =
InventoryPositionEstimatedCalculator.getIntegerPositions(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));
}
@Test
- void assertGetPositionByIntegerUniqueKeyRangeOverflow() {
+ void assertGetIntegerPositionsOverflow() {
long tableRecordsCount = Long.MAX_VALUE - 1L;
long shardingSize = tableRecordsCount / 2L;
long minimum = Long.MIN_VALUE + 1L;
long maximum = Long.MAX_VALUE;
- List<IngestPosition> actualPositions =
InventoryPositionCalculator.getPositionByIntegerUniqueKeyRange(tableRecordsCount,
Range.of(minimum, maximum), shardingSize);
+ List<IngestPosition> actualPositions =
InventoryPositionEstimatedCalculator.getIntegerPositions(tableRecordsCount,
Range.of(minimum, maximum), shardingSize);
assertThat(actualPositions.size(), is(2));
for (IngestPosition each : actualPositions) {
assertThat(each, isA(IntegerPrimaryKeyIngestPosition.class));