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 1abdb5bce8d Integrate unique key first string column exact splitting 
(#37584)
1abdb5bce8d is described below

commit 1abdb5bce8d6633a631f88acdd7235ed41eff578
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Tue Dec 30 20:19:58 2025 +0800

    Integrate unique key first string column exact splitting (#37584)
---
 .../calculator/position/InventoryPositionCalculator.java      | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/position/InventoryPositionCalculator.java
 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/position/InventoryPositionCalculator.java
index 7b7ec222453..17ca03b6b5d 100644
--- 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/position/InventoryPositionCalculator.java
+++ 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/preparer/inventory/calculator/position/InventoryPositionCalculator.java
@@ -21,13 +21,13 @@ import lombok.RequiredArgsConstructor;
 import 
org.apache.shardingsphere.data.pipeline.core.datasource.PipelineDataSource;
 import 
org.apache.shardingsphere.data.pipeline.core.ingest.dumper.inventory.query.Range;
 import 
org.apache.shardingsphere.data.pipeline.core.ingest.position.IngestPosition;
-import 
org.apache.shardingsphere.data.pipeline.core.ingest.position.type.pk.type.StringPrimaryKeyIngestPosition;
 import 
org.apache.shardingsphere.data.pipeline.core.ingest.position.type.pk.type.UnsupportedKeyIngestPosition;
 import 
org.apache.shardingsphere.data.pipeline.core.metadata.model.PipelineColumnMetaData;
 import 
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator.InventoryDataSparsenessCalculator;
 import 
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator.position.estimated.InventoryPositionEstimatedCalculator;
 import 
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator.position.exact.IntegerPositionHandler;
 import 
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator.position.exact.InventoryPositionExactCalculator;
+import 
org.apache.shardingsphere.data.pipeline.core.preparer.inventory.calculator.position.exact.StringPositionHandler;
 import 
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.option.datatype.DialectDataTypeOption;
 import 
org.apache.shardingsphere.database.connector.core.type.DatabaseTypeRegistry;
 import org.apache.shardingsphere.infra.metadata.database.schema.QualifiedTable;
@@ -63,8 +63,8 @@ public final class InventoryPositionCalculator {
         if (dataTypeOption.isIntegerDataType(firstColumnDataType)) {
             return getIntegerPositions();
         }
-        if (1 == uniqueKeyColumns.size() && 
dataTypeOption.isStringDataType(firstColumnDataType)) {
-            return Collections.singletonList(new 
StringPrimaryKeyIngestPosition(null, null));
+        if (dataTypeOption.isStringDataType(firstColumnDataType)) {
+            return getStringPositions();
         }
         return Collections.singletonList(new UnsupportedKeyIngestPosition());
     }
@@ -77,4 +77,9 @@ public final class InventoryPositionCalculator {
         }
         return 
InventoryPositionEstimatedCalculator.getIntegerPositions(tableRecordsCount, 
uniqueKeyValuesRange, shardingSize);
     }
+    
+    private List<IngestPosition> getStringPositions() {
+        String uniqueKey = uniqueKeyColumns.get(0).getName();
+        return InventoryPositionExactCalculator.getPositions(qualifiedTable, 
uniqueKey, shardingSize, dataSource, new StringPositionHandler());
+    }
 }

Reply via email to