From 44c49a17420c85a3d5a788562642f8adf799516a Mon Sep 17 00:00:00 2001 From: Haoran Meng Date: Mon, 23 Dec 2024 17:34:05 +0800 Subject: [PATCH] Fix index out of bounds exception for migration without unique keys (#34127) --- .../table/calculator/RecordSingleTableInventoryCalculator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/calculator/RecordSingleTableInventoryCalculator.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/calculator/RecordSingleTableInventoryCalculator.java index 22af62850c3c7..ebf59bb3c7c6a 100644 --- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/calculator/RecordSingleTableInventoryCalculator.java +++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/calculator/RecordSingleTableInventoryCalculator.java @@ -148,7 +148,7 @@ private void fulfillCalculationContext(final CalculationContext calculationConte } private String getQuerySQL(final SingleTableInventoryCalculateParameter param) { - ShardingSpherePreconditions.checkNotNull(param.getFirstUniqueKey(), + ShardingSpherePreconditions.checkState(param.getUniqueKeys() != null && !param.getUniqueKeys().isEmpty() && null != param.getFirstUniqueKey(), () -> new UnsupportedOperationException("Record inventory calculator does not support table without unique key and primary key now.")); PipelineDataConsistencyCalculateSQLBuilder pipelineSQLBuilder = new PipelineDataConsistencyCalculateSQLBuilder(param.getDatabaseType()); Collection columnNames = param.getColumnNames().isEmpty() ? Collections.singleton("*") : param.getColumnNames();