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

(shardingsphere) branch master updated: Add QuoteCharacter.unwrapText() (#33753)

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

zhangliang 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 7e0b71fc74c Add QuoteCharacter.unwrapText() (#33753)
7e0b71fc74c is described below

commit 7e0b71fc74c06bff49a65cc40db425c6950bdc11
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu Nov 21 15:10:59 2024 +0800

    Add QuoteCharacter.unwrapText() (#33753)
    
    * Add QuoteCharacter.unwrapText()
    
    * Add QuoteCharacter.unwrapText()
---
 .../core/EncryptDistSQLStatementVisitor.java       |  3 ++-
 .../parser/core/MaskDistSQLStatementVisitor.java   |  3 ++-
 .../ReadwriteSplittingDistSQLStatementVisitor.java |  3 ++-
 .../parser/core/ShadowDistSQLStatementVisitor.java |  3 ++-
 .../core/ShardingDistSQLStatementVisitor.java      |  3 ++-
 .../metadata/database/enums/QuoteCharacter.java    | 27 +++++++++++++++++++---
 .../database/enums/QuoteCharacterTest.java         | 11 +++++++++
 .../parser/core/CDCDistSQLStatementVisitor.java    |  7 +++---
 .../core/MigrationDistSQLStatementVisitor.java     |  3 ++-
 .../core/GlobalClockDistSQLStatementVisitor.java   |  3 ++-
 .../core/SQLTranslatorDistSQLStatementVisitor.java |  3 ++-
 .../core/TransactionDistSQLStatementVisitor.java   |  3 ++-
 .../core/kernel/KernelDistSQLStatementVisitor.java |  5 ++--
 .../core/value/identifier/IdentifierValue.java     |  2 +-
 14 files changed, 61 insertions(+), 18 deletions(-)

diff --git a/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java b/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
index 7fc46353110..75bd81c31af 100644
--- a/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
+++ b/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
@@ -42,6 +42,7 @@ import org.apache.shardingsphere.encrypt.distsql.statement.AlterEncryptRuleState
 import org.apache.shardingsphere.encrypt.distsql.statement.CreateEncryptRuleStatement;
 import org.apache.shardingsphere.encrypt.distsql.statement.DropEncryptRuleStatement;
 import org.apache.shardingsphere.encrypt.distsql.statement.ShowEncryptRulesStatement;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.sql.parser.api.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.DatabaseSegment;
@@ -120,7 +121,7 @@ public final class EncryptDistSQLStatementVisitor extends EncryptDistSQLStatemen
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/core/MaskDistSQLStatementVisitor.java b/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/core/MaskDistSQLStatementVisitor.java
index 4bd4410690c..217d10ef84b 100644
--- a/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/core/MaskDistSQLStatementVisitor.java
+++ b/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/core/MaskDistSQLStatementVisitor.java
@@ -34,6 +34,7 @@ import org.apache.shardingsphere.distsql.parser.autogen.MaskDistSQLStatementPars
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
 import org.apache.shardingsphere.distsql.statement.ral.queryable.show.ShowPluginsStatement;
 import org.apache.shardingsphere.distsql.statement.rql.rule.database.CountRuleStatement;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.mask.distsql.segment.MaskColumnSegment;
 import org.apache.shardingsphere.mask.distsql.segment.MaskRuleSegment;
 import org.apache.shardingsphere.mask.distsql.statement.AlterMaskRuleStatement;
@@ -104,7 +105,7 @@ public final class MaskDistSQLStatementVisitor extends MaskDistSQLStatementBaseV
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java b/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java
index 9d4050754b7..c1d1cd5878f 100644
--- a/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java
+++ b/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java
@@ -33,6 +33,7 @@ import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingDistSQ
 import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingDistSQLStatementParser.ShowStatusFromReadwriteSplittingRulesContext;
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
 import org.apache.shardingsphere.distsql.statement.rql.rule.database.CountRuleStatement;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.readwritesplitting.distsql.segment.ReadwriteSplittingRuleSegment;
 import org.apache.shardingsphere.readwritesplitting.distsql.statement.AlterReadwriteSplittingRuleStatement;
 import org.apache.shardingsphere.readwritesplitting.distsql.statement.AlterReadwriteSplittingStorageUnitStatusStatement;
@@ -121,7 +122,7 @@ public final class ReadwriteSplittingDistSQLStatementVisitor extends ReadwriteSp
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java b/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java
index f8eb9a9d0ec..31802ff6d19 100644
--- a/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java
+++ b/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java
@@ -40,6 +40,7 @@ import org.apache.shardingsphere.distsql.parser.autogen.ShadowDistSQLStatementPa
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
 import org.apache.shardingsphere.distsql.statement.ral.queryable.show.ShowPluginsStatement;
 import org.apache.shardingsphere.distsql.statement.rql.rule.database.CountRuleStatement;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.shadow.distsql.segment.ShadowAlgorithmSegment;
 import org.apache.shardingsphere.shadow.distsql.segment.ShadowRuleSegment;
 import org.apache.shardingsphere.shadow.distsql.statement.AlterDefaultShadowAlgorithmStatement;
@@ -117,7 +118,7 @@ public final class ShadowDistSQLStatementVisitor extends ShadowDistSQLStatementB
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java b/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
index 9a0b108b862..ac4f808d994 100644
--- a/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
+++ b/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
@@ -66,6 +66,7 @@ import org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatement
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
 import org.apache.shardingsphere.distsql.statement.ral.queryable.show.ShowPluginsStatement;
 import org.apache.shardingsphere.distsql.statement.rql.rule.database.CountRuleStatement;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.sharding.distsql.segment.strategy.AuditStrategySegment;
 import org.apache.shardingsphere.sharding.distsql.segment.strategy.KeyGenerateStrategySegment;
 import org.apache.shardingsphere.sharding.distsql.segment.strategy.ShardingAuditorSegment;
@@ -311,7 +312,7 @@ public final class ShardingDistSQLStatementVisitor extends ShardingDistSQLStatem
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/metadata/database/enums/QuoteCharacter.java b/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/metadata/database/enums/QuoteCharacter.java
index 7cd9cd00374..501c5de34b7 100644
--- a/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/metadata/database/enums/QuoteCharacter.java
+++ b/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/metadata/database/enums/QuoteCharacter.java
@@ -47,10 +47,9 @@ public enum QuoteCharacter {
     
     static {
         for (QuoteCharacter each : values()) {
-            if (NONE == each) {
-                continue;
+            if (NONE != each) {
+                BY_FIRST_CHAR.put(each.startDelimiter.charAt(0), each);
             }
-            BY_FIRST_CHAR.put(each.startDelimiter.charAt(0), each);
         }
     }
     
@@ -97,4 +96,26 @@ public enum QuoteCharacter {
     public boolean isWrapped(final String value) {
         return value.startsWith(startDelimiter) && value.endsWith(endDelimiter);
     }
+    
+    /**
+     * Unwrap text.
+     *
+     * @param text text to be unwrapped
+     * @return unwrapped text
+     */
+    public static String unwrapText(final String text) {
+        return QuoteCharacter.getQuoteCharacter(text).unwrap(text);
+    }
+    
+    /**
+     * Unwrap and trim text.
+     *
+     * @param text text to be unwrapped and trimmed
+     * @return unwrapped and trimmed test
+     */
+    // TODO Should use unwrap instead of this method after new rules defined in G4's property key and property key, which should include string but cannot permit blank on first and last of the value
+    // TODO @longtao
+    public static String unwrapAndTrimText(final String text) {
+        return unwrapText(text).trim();
+    }
 }
diff --git a/infra/database/core/src/test/java/org/apache/shardingsphere/infra/database/core/metadata/database/enums/QuoteCharacterTest.java b/infra/database/core/src/test/java/org/apache/shardingsphere/infra/database/core/metadata/database/enums/QuoteCharacterTest.java
index f29fff4d3c8..87a010eee30 100644
--- a/infra/database/core/src/test/java/org/apache/shardingsphere/infra/database/core/metadata/database/enums/QuoteCharacterTest.java
+++ b/infra/database/core/src/test/java/org/apache/shardingsphere/infra/database/core/metadata/database/enums/QuoteCharacterTest.java
@@ -85,4 +85,15 @@ class QuoteCharacterTest {
     void assertIsNotWrapped() {
         assertFalse(QuoteCharacter.SINGLE_QUOTE.isWrapped("'test\""));
     }
+    
+    @Test
+    void assertUnwrapText() {
+        assertThat(QuoteCharacter.unwrapText("test"), is("test"));
+        assertThat(QuoteCharacter.unwrapText("`test`"), is("test"));
+        assertThat(QuoteCharacter.unwrapText("'test'"), is("test"));
+        assertThat(QuoteCharacter.unwrapText("\"test\""), is("test"));
+        assertThat(QuoteCharacter.unwrapText("[test]"), is("test"));
+        assertThat(QuoteCharacter.unwrapText("(test)"), is("test"));
+        assertThat(QuoteCharacter.unwrapText("{test}"), is("{test}"));
+    }
 }
diff --git a/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/parser/core/CDCDistSQLStatementVisitor.java b/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/parser/core/CDCDistSQLStatementVisitor.java
index 1c939da7d05..4e0b562be54 100644
--- a/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/parser/core/CDCDistSQLStatementVisitor.java
+++ b/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/distsql/parser/core/CDCDistSQLStatementVisitor.java
@@ -18,10 +18,11 @@
 package org.apache.shardingsphere.data.pipeline.cdc.distsql.parser.core;
 
 import org.antlr.v4.runtime.tree.ParseTree;
-import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.updatable.DropStreamingStatement;
 import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.queryable.ShowStreamingListStatement;
 import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.queryable.ShowStreamingRuleStatement;
 import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.queryable.ShowStreamingStatusStatement;
+import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.updatable.DropStreamingStatement;
+import org.apache.shardingsphere.data.pipeline.distsql.statement.updatable.AlterTransmissionRuleStatement;
 import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementBaseVisitor;
 import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.AlgorithmDefinitionContext;
 import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.AlterStreamingRuleContext;
@@ -42,7 +43,7 @@ import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParse
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
 import org.apache.shardingsphere.distsql.segment.ReadOrWriteSegment;
 import org.apache.shardingsphere.distsql.segment.TransmissionRuleSegment;
-import org.apache.shardingsphere.data.pipeline.distsql.statement.updatable.AlterTransmissionRuleStatement;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.sql.parser.api.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
@@ -145,7 +146,7 @@ public final class CDCDistSQLStatementVisitor extends CDCDistSQLStatementBaseVis
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java b/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
index a3a17442a42..96476718442 100644
--- a/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
+++ b/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
@@ -79,6 +79,7 @@ import org.apache.shardingsphere.distsql.segment.TransmissionRuleSegment;
 import org.apache.shardingsphere.distsql.segment.URLBasedDataSourceSegment;
 import org.apache.shardingsphere.distsql.statement.ral.queryable.show.ShowPluginsStatement;
 import org.apache.shardingsphere.data.pipeline.distsql.statement.updatable.AlterTransmissionRuleStatement;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.infra.datanode.DataNode;
 import org.apache.shardingsphere.sql.parser.api.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
@@ -250,7 +251,7 @@ public final class MigrationDistSQLStatementVisitor extends MigrationDistSQLStat
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/kernel/global-clock/distsql/parser/src/main/java/org/apache/shardingsphere/globalclock/distsql/parser/core/GlobalClockDistSQLStatementVisitor.java b/kernel/global-clock/distsql/parser/src/main/java/org/apache/shardingsphere/globalclock/distsql/parser/core/GlobalClockDistSQLStatementVisitor.java
index ce5c55c659f..71ca6c7cc97 100644
--- a/kernel/global-clock/distsql/parser/src/main/java/org/apache/shardingsphere/globalclock/distsql/parser/core/GlobalClockDistSQLStatementVisitor.java
+++ b/kernel/global-clock/distsql/parser/src/main/java/org/apache/shardingsphere/globalclock/distsql/parser/core/GlobalClockDistSQLStatementVisitor.java
@@ -26,6 +26,7 @@ import org.apache.shardingsphere.distsql.parser.autogen.GlobalClockDistSQLStatem
 import org.apache.shardingsphere.distsql.parser.autogen.GlobalClockDistSQLStatementParser.ShowGlobalClockRuleContext;
 import org.apache.shardingsphere.globalclock.distsql.statement.queryable.ShowGlobalClockRuleStatement;
 import org.apache.shardingsphere.globalclock.distsql.statement.updatable.AlterGlobalClockRuleStatement;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.sql.parser.api.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
@@ -59,7 +60,7 @@ public final class GlobalClockDistSQLStatementVisitor extends GlobalClockDistSQL
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/kernel/sql-translator/distsql/parser/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/parser/core/SQLTranslatorDistSQLStatementVisitor.java b/kernel/sql-translator/distsql/parser/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/parser/core/SQLTranslatorDistSQLStatementVisitor.java
index df387050617..3791f56b71c 100644
--- a/kernel/sql-translator/distsql/parser/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/parser/core/SQLTranslatorDistSQLStatementVisitor.java
+++ b/kernel/sql-translator/distsql/parser/src/main/java/org/apache/shardingsphere/sqltranslator/distsql/parser/core/SQLTranslatorDistSQLStatementVisitor.java
@@ -26,6 +26,7 @@ import org.apache.shardingsphere.distsql.parser.autogen.SQLTranslatorDistSQLStat
 import org.apache.shardingsphere.distsql.parser.autogen.SQLTranslatorDistSQLStatementParser.ShowSQLTranslatorRuleContext;
 import org.apache.shardingsphere.distsql.parser.autogen.SQLTranslatorDistSQLStatementParser.UseOriginalSQLDefinitionContext;
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.sql.parser.api.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
@@ -61,7 +62,7 @@ public final class SQLTranslatorDistSQLStatementVisitor extends SQLTranslatorDis
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/kernel/transaction/distsql/parser/src/main/java/org/apache/shardingsphere/transaction/distsql/parser/core/TransactionDistSQLStatementVisitor.java b/kernel/transaction/distsql/parser/src/main/java/org/apache/shardingsphere/transaction/distsql/parser/core/TransactionDistSQLStatementVisitor.java
index 7be7e46d520..3240f32da44 100644
--- a/kernel/transaction/distsql/parser/src/main/java/org/apache/shardingsphere/transaction/distsql/parser/core/TransactionDistSQLStatementVisitor.java
+++ b/kernel/transaction/distsql/parser/src/main/java/org/apache/shardingsphere/transaction/distsql/parser/core/TransactionDistSQLStatementVisitor.java
@@ -25,6 +25,7 @@ import org.apache.shardingsphere.distsql.parser.autogen.TransactionDistSQLStatem
 import org.apache.shardingsphere.distsql.parser.autogen.TransactionDistSQLStatementParser.ProviderDefinitionContext;
 import org.apache.shardingsphere.distsql.parser.autogen.TransactionDistSQLStatementParser.ShowTransactionRuleContext;
 import org.apache.shardingsphere.distsql.parser.autogen.TransactionDistSQLStatementParser.TransactionRuleDefinitionContext;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.sql.parser.api.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
@@ -66,7 +67,7 @@ public final class TransactionDistSQLStatementVisitor extends TransactionDistSQL
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java b/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
index 4968e9b360c..52f1886e1a4 100644
--- a/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
+++ b/parser/distsql/engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
@@ -95,6 +95,7 @@ import org.apache.shardingsphere.distsql.statement.rdl.resource.unit.type.Unregi
 import org.apache.shardingsphere.distsql.statement.rql.resource.ShowLogicalTablesStatement;
 import org.apache.shardingsphere.distsql.statement.rql.resource.ShowStorageUnitsStatement;
 import org.apache.shardingsphere.distsql.statement.rql.rule.database.ShowRulesUsedStorageUnitStatement;
+import org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.sql.parser.api.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.DatabaseSegment;
@@ -203,7 +204,7 @@ public final class KernelDistSQLStatementVisitor extends KernelDistSQLStatementB
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
@@ -318,7 +319,7 @@ public final class KernelDistSQLStatementVisitor extends KernelDistSQLStatementB
             return result;
         }
         for (PropertyContext each : ctx.properties().property()) {
-            result.setProperty(IdentifierValue.getQuotedContent(each.key.getText()), IdentifierValue.getQuotedContent(each.value.getText()));
+            result.setProperty(QuoteCharacter.unwrapAndTrimText(each.key.getText()), QuoteCharacter.unwrapAndTrimText(each.value.getText()));
         }
         return result;
     }
diff --git a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/value/identifier/IdentifierValue.java b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/value/identifier/IdentifierValue.java
index 9c342e7deb0..beed7c43aa8 100644
--- a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/value/identifier/IdentifierValue.java
+++ b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/value/identifier/IdentifierValue.java
@@ -63,6 +63,6 @@ public final class IdentifierValue implements ValueASTNode<String> {
      * @return quote content
      */
     public static String getQuotedContent(final String text) {
-        return Strings.isNullOrEmpty(text) ? text : QuoteCharacter.getQuoteCharacter(text).unwrap(text).trim();
+        return Strings.isNullOrEmpty(text) ? text : QuoteCharacter.unwrapAndTrimText(text);
     }
 }