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 630f86367aa Refactor ColumnProjection.getColumnName() (#35176)
630f86367aa is described below

commit 630f86367aa5be1bd777f3f7d943370c2883b68e
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Sun Apr 13 11:27:16 2025 +0800

    Refactor ColumnProjection.getColumnName() (#35176)
    
    * Refactor ColumnProjection.getColumnName()
    
    * Refactor ColumnProjection.getColumnName()
---
 .../context/segment/select/projection/impl/ColumnProjection.java  | 4 +---
 .../segment/select/projection/impl/ColumnProjectionTest.java      | 8 +-------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/impl/ColumnProjection.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/impl/ColumnProjection.java
index 1100bce1984..e194d33ebb2 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/impl/ColumnProjection.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/impl/ColumnProjection.java
@@ -26,7 +26,6 @@ import 
org.apache.shardingsphere.infra.binder.context.segment.select.projection.
 import 
org.apache.shardingsphere.infra.binder.context.segment.select.projection.extractor.ProjectionIdentifierExtractEngine;
 import 
org.apache.shardingsphere.infra.database.core.metadata.database.enums.QuoteCharacter;
 import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.mysql.type.MySQLDatabaseType;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.ParenthesesSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.bound.ColumnSegmentBoundInfo;
 import 
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
@@ -121,8 +120,7 @@ public final class ColumnProjection implements Projection {
     
     @Override
     public String getColumnName() {
-        ProjectionIdentifierExtractEngine extractEngine = new 
ProjectionIdentifierExtractEngine(databaseType);
-        return databaseType instanceof MySQLDatabaseType ? 
extractEngine.getIdentifierValue(name) : getColumnLabel();
+        return new 
ProjectionIdentifierExtractEngine(databaseType).getIdentifierValue(name);
     }
     
     @Override
diff --git 
a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/impl/ColumnProjectionTest.java
 
b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/impl/ColumnProjectionTest.java
index 4312e963854..19539ae5295 100644
--- 
a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/impl/ColumnProjectionTest.java
+++ 
b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/impl/ColumnProjectionTest.java
@@ -88,15 +88,9 @@ class ColumnProjectionTest {
         assertFalse(new ColumnProjection(new IdentifierValue("owner"), new 
IdentifierValue("name"), new IdentifierValue("alias"), 
databaseType).getRightParentheses().isPresent());
     }
     
-    @Test
-    void assertGetColumnNameWithMySQL() {
-        DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "MySQL");
-        assertThat(new ColumnProjection(null, "name", "alias", 
databaseType).getColumnName(), is("name"));
-    }
-    
     @Test
     void assertGetColumnNameWithAlias() {
-        assertThat(new ColumnProjection(null, "name", "alias", 
databaseType).getColumnName(), is("alias"));
+        assertThat(new ColumnProjection(null, "name", "alias", 
databaseType).getColumnName(), is("name"));
     }
     
     @Test

Reply via email to