You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ch...@apache.org on 2023/07/05 07:48:53 UTC

[shardingsphere] branch master updated: Fix sonar issue in EnumerableScan (#26772)

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

chengzhang 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 9e329a824f7 Fix sonar issue in EnumerableScan (#26772)
9e329a824f7 is described below

commit 9e329a824f733952787bb1e6a74fea2447cf8d4f
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Wed Jul 5 15:48:46 2023 +0800

    Fix sonar issue in EnumerableScan (#26772)
---
 .../sqlfederation/compiler/operator/physical/EnumerableScan.java     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/operator/physical/EnumerableScan.java b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/operator/physical/EnumerableScan.java
index 38584be7cc7..b859a9cc383 100644
--- a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/operator/physical/EnumerableScan.java
+++ b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/operator/physical/EnumerableScan.java
@@ -42,6 +42,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
+import java.util.regex.Pattern;
 
 /**
  * Enumerable scan.
@@ -49,6 +50,8 @@ import java.util.Objects;
 @Getter
 public final class EnumerableScan extends TableScan implements EnumerableRel {
     
+    private static final Pattern LINE_SEPARATOR_PATTERN = Pattern.compile("[\r\n]");
+    
     private final SqlString sqlString;
     
     private final RelDataType pushDownRowType;
@@ -74,7 +77,7 @@ public final class EnumerableScan extends TableScan implements EnumerableRel {
     
     @Override
     public RelWriter explainTerms(final RelWriter relWriter) {
-        return super.explainTerms(relWriter).item("sql", sqlString.getSql().replaceAll("[\r\n]", " "));
+        return super.explainTerms(relWriter).item("sql", LINE_SEPARATOR_PATTERN.matcher(sqlString.getSql()).replaceAll(" "));
     }
     
     @Override