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 2022/07/28 06:14:25 UTC

[shardingsphere] branch master updated: Reduce overhead of split empty value in SQLHintUtils (#19632)

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 f96ff1809a2 Reduce overhead of split empty value in SQLHintUtils (#19632)
f96ff1809a2 is described below

commit f96ff1809a2aeb9e53265e1d7ae388bb8ffa837d
Author: 吴伟杰 <wu...@apache.org>
AuthorDate: Thu Jul 28 14:14:18 2022 +0800

    Reduce overhead of split empty value in SQLHintUtils (#19632)
---
 .../main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
index a88b48e30e1..7f338ac5b2d 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
@@ -22,8 +22,9 @@ import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 
 import java.util.Collection;
-import java.util.List;
+import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Properties;
 
 /**
@@ -75,6 +76,6 @@ public final class SQLHintUtils {
      * @return Splitter SQL hint value
      */
     public static Collection<String> getSplitterSQLHintValue(final String value) {
-        return new HashSet<>(Splitter.on(SQLHintUtils.SQL_HINT_VALUE_COLLECTION_SPLIT).omitEmptyStrings().trimResults().splitToList(value));
+        return value.isEmpty() ? Collections.emptySet() : new HashSet<>(Splitter.on(SQLHintUtils.SQL_HINT_VALUE_COLLECTION_SPLIT).omitEmptyStrings().trimResults().splitToList(value));
     }
 }