You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/10/22 12:46:32 UTC

[shardingsphere] branch master updated: fix unit test exception in window system (#13232)

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

panjuan 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 b1f3c5a  fix unit test exception in window system (#13232)
b1f3c5a is described below

commit b1f3c5a436077cb7372d2c16d1c628e510f83507
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Fri Oct 22 20:45:56 2021 +0800

    fix unit test exception in window system (#13232)
---
 .../segment/projection/impl/SubqueryProjectionConverter.java          | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-optimize/src/main/java/org/apache/shardingsphere/infra/optimize/converter/segment/projection/impl/SubqueryProjectionConverter.java b/shardingsphere-infra/shardingsphere-infra-optimize/src/main/java/org/apache/shardingsphere/infra/optimize/converter/segment/projection/impl/SubqueryProjectionConverter.java
index 6a90a0e..9ccf39e 100644
--- a/shardingsphere-infra/shardingsphere-infra-optimize/src/main/java/org/apache/shardingsphere/infra/optimize/converter/segment/projection/impl/SubqueryProjectionConverter.java
+++ b/shardingsphere-infra/shardingsphere-infra-optimize/src/main/java/org/apache/shardingsphere/infra/optimize/converter/segment/projection/impl/SubqueryProjectionConverter.java
@@ -40,6 +40,8 @@ import java.util.Optional;
  */
 public final class SubqueryProjectionConverter implements SQLSegmentConverter<SubqueryProjectionSegment, SqlNode> {
     
+    private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+    
     @Override
     public Optional<SqlNode> convertToSQLNode(final SubqueryProjectionSegment segment) {
         if (null == segment) {
@@ -64,7 +66,7 @@ public final class SubqueryProjectionConverter implements SQLSegmentConverter<Su
             int startIndex = getStartIndex(sqlNode) - 1;
             int stopIndex = getStopIndex(sqlNode) + 1;
             String text = "(" + sqlNode + ")";
-            String originalText = text.replace("\n", " ").replace(Quoting.BACK_TICK.string, "");
+            String originalText = text.replace(LINE_SEPARATOR, " ").replace(Quoting.BACK_TICK.string, "");
             return Optional.of(new SubqueryProjectionSegment(new SubquerySegment(startIndex, stopIndex, selectStatement), originalText));
         }
         return Optional.empty();