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

menghaoran 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 ef6262d99c3 Fix sonar issue on InventoryDumper (#32622)
ef6262d99c3 is described below

commit ef6262d99c348b899336d68feb23fd485c2e2ae6
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Aug 22 10:38:48 2024 +0800

    Fix sonar issue on InventoryDumper (#32622)
---
 .../pipeline/core/ingest/dumper/inventory/InventoryDumper.java    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/inventory/InventoryDumper.java
 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/inventory/InventoryDumper.java
index 7b62d5eadd8..61a6e05f124 100644
--- 
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/inventory/InventoryDumper.java
+++ 
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/inventory/InventoryDumper.java
@@ -113,9 +113,7 @@ public class InventoryDumper extends 
AbstractPipelineLifecycleRunnable implement
         }
         init();
         try (Connection connection = dataSource.getConnection()) {
-            if (!Strings.isNullOrEmpty(dumperContext.getQuerySQL()) || 
!dumperContext.hasUniqueKey()
-                    || position instanceof PrimaryKeyIngestPosition && null == 
((PrimaryKeyIngestPosition<?>) position).getBeginValue()
-                            && null == ((PrimaryKeyIngestPosition<?>) 
position).getEndValue()) {
+            if (!Strings.isNullOrEmpty(dumperContext.getQuerySQL()) || 
!dumperContext.hasUniqueKey() || isPrimaryKeyWithoutRanged(position)) {
                 dumpWithStreamingQuery(connection);
             } else {
                 dumpPageByPage(connection);
@@ -128,6 +126,10 @@ public class InventoryDumper extends 
AbstractPipelineLifecycleRunnable implement
         }
     }
     
+    private boolean isPrimaryKeyWithoutRanged(final IngestPosition position) {
+        return position instanceof PrimaryKeyIngestPosition && null == 
((PrimaryKeyIngestPosition<?>) position).getBeginValue() && null == 
((PrimaryKeyIngestPosition<?>) position).getEndValue();
+    }
+    
     /**
      * Initialize.
      */

Reply via email to