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

tuichenchuxin 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 e6e3a6f403a Remove useless transformSubqueryProjection in Projection 
(#27321)
e6e3a6f403a is described below

commit e6e3a6f403a97f8259e39c23d8636ac8065a8957
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Thu Jul 20 13:43:52 2023 +0800

    Remove useless transformSubqueryProjection in Projection (#27321)
    
    * Remove useless transformSubqueryProjection in Projection
    
    * remove useless test case
    
    * remove useless test case
    
    * remove useless test case
---
 .../segment/select/projection/Projection.java      | 10 -------
 .../select/projection/engine/ProjectionEngine.java | 34 ---------------------
 .../impl/AggregationDistinctProjection.java        |  7 -----
 .../projection/impl/AggregationProjection.java     | 11 -------
 .../select/projection/impl/ColumnProjection.java   |  8 -----
 .../select/projection/impl/DerivedProjection.java  |  5 ----
 .../projection/impl/ExpressionProjection.java      |  5 ----
 .../projection/impl/ParameterMarkerProjection.java |  5 ----
 .../projection/impl/ShorthandProjection.java       |  5 ----
 .../select/projection/impl/SubqueryProjection.java |  5 ----
 .../projection/engine/ProjectionEngineTest.java    | 35 +---------------------
 .../prepare/MySQLComStmtPrepareExecutorTest.java   | 31 -------------------
 .../cases/dql/dql-integration-select-sub-query.xml | 23 --------------
 .../resources/cases/dql/dql-integration-select.xml |  5 ----
 .../dml/select/select-subquery.xml                 | 15 ----------
 .../scenario/sharding/case/dml/select.xml          |  6 ----
 16 files changed, 1 insertion(+), 209 deletions(-)

diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/Projection.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/Projection.java
index b53f4ec1811..4aa08a95547 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/Projection.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/Projection.java
@@ -53,14 +53,4 @@ public interface Projection {
      * @return alias
      */
     Optional<IdentifierValue> getAlias();
-    
-    /**
-     * Transform subquery projection.
-     * 
-     * @param subqueryTableAlias subquery table alias
-     * @param originalOwner original owner
-     * @param originalName original name
-     * @return new projection
-     */
-    Projection transformSubqueryProjection(IdentifierValue subqueryTableAlias, 
IdentifierValue originalOwner, IdentifierValue originalName);
 }
diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngine.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngine.java
index d318ba9bada..d7740bab541 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngine.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngine.java
@@ -48,9 +48,7 @@ import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.Subquery
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.OwnerSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.JoinTableSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
-import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SubqueryTableSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableSegment;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
 
 import java.util.Collection;
@@ -59,9 +57,7 @@ import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.Map;
-import java.util.Objects;
 import java.util.Optional;
-import java.util.stream.Collectors;
 
 /**
  * Projection engine.
@@ -125,7 +121,6 @@ public final class ProjectionEngine {
         IdentifierValue owner = 
projectionSegment.getOwner().map(OwnerSegment::getIdentifier).orElse(null);
         Collection<Projection> projections = new LinkedHashSet<>();
         projections.addAll(getShorthandColumnsFromSimpleTableSegment(table, 
owner));
-        projections.addAll(getShorthandColumnsFromSubqueryTableSegment(table, 
owner));
         projections.addAll(getShorthandColumnsFromJoinTableSegment(table, 
owner, projectionSegment));
         return new ShorthandProjection(owner, projections);
     }
@@ -181,35 +176,6 @@ public final class ProjectionEngine {
         return result;
     }
     
-    private Collection<Projection> 
getShorthandColumnsFromSubqueryTableSegment(final TableSegment table, final 
IdentifierValue owner) {
-        if (!(table instanceof SubqueryTableSegment) || 
isOwnerNotSameWithTableAlias(owner, table)) {
-            return Collections.emptyList();
-        }
-        SelectStatement subSelectStatement = ((SubqueryTableSegment) 
table).getSubquery().getSelect();
-        Collection<Projection> projections = 
subSelectStatement.getProjections().getProjections().stream().map(each -> 
createProjection(subSelectStatement.getFrom(), each).orElse(null))
-                .filter(Objects::nonNull).collect(Collectors.toList());
-        IdentifierValue subqueryTableAlias = table.getAlias().orElse(null);
-        return getSubqueryTableActualProjections(projections, 
subqueryTableAlias);
-    }
-    
-    private boolean isOwnerNotSameWithTableAlias(final IdentifierValue owner, 
final TableSegment table) {
-        return null != owner && table.getAliasName().isPresent() && 
!table.getAliasName().get().equals(owner.getValue());
-    }
-    
-    private Collection<Projection> getSubqueryTableActualProjections(final 
Collection<Projection> projections, final IdentifierValue subqueryTableAlias) {
-        Collection<Projection> result = new LinkedList<>();
-        for (Projection each : projections) {
-            if (each instanceof ShorthandProjection) {
-                
result.addAll(getSubqueryTableActualProjections(((ShorthandProjection) 
each).getActualColumns(), subqueryTableAlias));
-            } else if (!(each instanceof DerivedProjection)) {
-                IdentifierValue originalOwner = each instanceof 
ColumnProjection ? ((ColumnProjection) each).getOriginalOwner() : null;
-                IdentifierValue originalName = each instanceof 
ColumnProjection ? ((ColumnProjection) each).getOriginalName() : null;
-                
result.add(each.transformSubqueryProjection(subqueryTableAlias, originalOwner, 
originalName));
-            }
-        }
-        return result;
-    }
-    
     private Collection<Projection> 
getShorthandColumnsFromJoinTableSegment(final TableSegment table, final 
IdentifierValue owner, final ProjectionSegment projectionSegment) {
         if (!(table instanceof JoinTableSegment)) {
             return Collections.emptyList();
diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationDistinctProjection.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationDistinctProjection.java
index 7e1e42c2cd6..a03df406afa 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationDistinctProjection.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationDistinctProjection.java
@@ -19,7 +19,6 @@ package 
org.apache.shardingsphere.infra.binder.segment.select.projection.impl;
 
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
-import 
org.apache.shardingsphere.infra.binder.segment.select.projection.Projection;
 import org.apache.shardingsphere.infra.database.spi.DatabaseType;
 import org.apache.shardingsphere.sql.parser.sql.common.enums.AggregationType;
 import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
@@ -44,10 +43,4 @@ public final class AggregationDistinctProjection extends 
AggregationProjection {
         this.stopIndex = stopIndex;
         this.distinctInnerExpression = distinctInnerExpression;
     }
-    
-    @Override
-    public Projection transformSubqueryProjection(final IdentifierValue 
subqueryTableAlias, final IdentifierValue originalOwner, final IdentifierValue 
originalName) {
-        return getAlias().isPresent() ? new 
ColumnProjection(subqueryTableAlias, getAlias().get(), null)
-                : new AggregationDistinctProjection(startIndex, stopIndex, 
getType(), getInnerExpression(), null, distinctInnerExpression, 
getDatabaseType());
-    }
 }
diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationProjection.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationProjection.java
index cd30988df9c..c49b59bc0c9 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationProjection.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/AggregationProjection.java
@@ -73,15 +73,4 @@ public class AggregationProjection implements Projection {
     public final Optional<IdentifierValue> getAlias() {
         return Optional.ofNullable(alias);
     }
-    
-    @Override
-    public Projection transformSubqueryProjection(final IdentifierValue 
subqueryTableAlias, final IdentifierValue originalOwner, final IdentifierValue 
originalName) {
-        if (getAlias().isPresent()) {
-            return new ColumnProjection(subqueryTableAlias, getAlias().get(), 
null);
-        }
-        AggregationProjection result = new AggregationProjection(type, 
innerExpression, alias, databaseType);
-        result.setIndex(index);
-        
result.getDerivedAggregationProjections().addAll(derivedAggregationProjections);
-        return result;
-    }
 }
diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ColumnProjection.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ColumnProjection.java
index b93debb2d42..4ab53d5accf 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ColumnProjection.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ColumnProjection.java
@@ -73,14 +73,6 @@ public final class ColumnProjection implements Projection {
         return Optional.ofNullable(alias);
     }
     
-    @Override
-    public Projection transformSubqueryProjection(final IdentifierValue 
subqueryTableAlias, final IdentifierValue originalOwner, final IdentifierValue 
originalName) {
-        ColumnProjection result = null == alias ? new 
ColumnProjection(subqueryTableAlias, name, null) : new 
ColumnProjection(subqueryTableAlias, alias, null);
-        result.setOriginalOwner(originalOwner);
-        result.setOriginalName(originalName);
-        return result;
-    }
-    
     /**
      * Get owner.
      *
diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/DerivedProjection.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/DerivedProjection.java
index 8d5a3fca1e3..29c427e1067 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/DerivedProjection.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/DerivedProjection.java
@@ -56,9 +56,4 @@ public final class DerivedProjection implements Projection {
     public Optional<IdentifierValue> getAlias() {
         return Optional.ofNullable(alias);
     }
-    
-    @Override
-    public Projection transformSubqueryProjection(final IdentifierValue 
subqueryTableAlias, final IdentifierValue originalOwner, final IdentifierValue 
originalName) {
-        return getAlias().isPresent() ? new 
ColumnProjection(subqueryTableAlias, getAlias().get(), null) : new 
DerivedProjection(expression, alias, derivedProjectionSegment);
-    }
 }
diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ExpressionProjection.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ExpressionProjection.java
index 5659da8c30d..1a414c60123 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ExpressionProjection.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ExpressionProjection.java
@@ -53,9 +53,4 @@ public final class ExpressionProjection implements Projection 
{
     public Optional<IdentifierValue> getAlias() {
         return Optional.ofNullable(alias);
     }
-    
-    @Override
-    public Projection transformSubqueryProjection(final IdentifierValue 
subqueryTableAlias, final IdentifierValue originalOwner, final IdentifierValue 
originalName) {
-        return getAlias().isPresent() ? new 
ColumnProjection(subqueryTableAlias, getAlias().get(), null) : new 
ExpressionProjection(expression, alias);
-    }
 }
diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ParameterMarkerProjection.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ParameterMarkerProjection.java
index 7bb8803f2d0..76078976fe0 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ParameterMarkerProjection.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ParameterMarkerProjection.java
@@ -61,9 +61,4 @@ public final class ParameterMarkerProjection implements 
Projection {
     public Optional<IdentifierValue> getAlias() {
         return Optional.ofNullable(alias);
     }
-    
-    @Override
-    public Projection transformSubqueryProjection(final IdentifierValue 
subqueryTableAlias, final IdentifierValue originalOwner, final IdentifierValue 
originalName) {
-        return getAlias().isPresent() ? new 
ColumnProjection(subqueryTableAlias, getAlias().get(), null) : new 
ParameterMarkerProjection(parameterMarkerIndex, parameterMarkerType, alias);
-    }
 }
diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ShorthandProjection.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ShorthandProjection.java
index 18e125046e0..a0e4c20afca 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ShorthandProjection.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/ShorthandProjection.java
@@ -84,9 +84,4 @@ public final class ShorthandProjection implements Projection {
         }
         return result;
     }
-    
-    @Override
-    public Projection transformSubqueryProjection(final IdentifierValue 
subqueryTableAlias, final IdentifierValue originalOwner, final IdentifierValue 
originalName) {
-        return new ShorthandProjection(subqueryTableAlias, actualColumns);
-    }
 }
diff --git 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/SubqueryProjection.java
 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/SubqueryProjection.java
index d7e74945867..95cc7edd0b5 100644
--- 
a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/SubqueryProjection.java
+++ 
b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/SubqueryProjection.java
@@ -66,9 +66,4 @@ public final class SubqueryProjection implements Projection {
         }
         return Optional.of(new IdentifierValue(expression));
     }
-    
-    @Override
-    public Projection transformSubqueryProjection(final IdentifierValue 
subqueryTableAlias, final IdentifierValue originalOwner, final IdentifierValue 
originalName) {
-        return getAlias().isPresent() ? new 
ColumnProjection(subqueryTableAlias, getAlias().get(), null) : new 
SubqueryProjection(expression, projection, alias, databaseType);
-    }
 }
diff --git 
a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngineTest.java
 
b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngineTest.java
index 68eda945985..ce9fec48757 100644
--- 
a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngineTest.java
+++ 
b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngineTest.java
@@ -28,29 +28,25 @@ import 
org.apache.shardingsphere.infra.database.core.DefaultDatabase;
 import org.apache.shardingsphere.infra.database.spi.DatabaseType;
 import org.apache.shardingsphere.infra.exception.SchemaNotFoundException;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.util.quote.QuoteCharacter;
 import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
 import org.apache.shardingsphere.sql.parser.sql.common.enums.AggregationType;
 import org.apache.shardingsphere.sql.parser.sql.common.enums.JoinType;
-import org.apache.shardingsphere.infra.util.quote.QuoteCharacter;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.complex.CommonExpressionSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
-import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.subquery.SubquerySegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.AggregationDistinctProjectionSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.AggregationProjectionSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.ColumnProjectionSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.ExpressionProjectionSegment;
-import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.ProjectionsSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.ShorthandProjectionSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.AliasSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.OwnerSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.JoinTableSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
-import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SubqueryTableSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
-import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.dml.OracleSelectStatement;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
@@ -216,35 +212,6 @@ class ProjectionEngineTest {
                 DefaultDatabase.LOGIC_NAME, 
Collections.singletonMap(DefaultDatabase.LOGIC_NAME, schema), 
databaseType).createProjection(tableSegment, shorthandProjectionSegment));
     }
     
-    @Test
-    void 
assertCreateProjectionWhenShorthandProjectionContainsColumnProjectionAndExpressionProjection()
 {
-        ProjectionsSegment subQuerySegment = new ProjectionsSegment(0, 0);
-        ColumnSegment columnSegment = new ColumnSegment(0, 0, new 
IdentifierValue("name"));
-        subQuerySegment.getProjections().add(new 
ColumnProjectionSegment(columnSegment));
-        ExpressionProjectionSegment expressionProjectionSegment = new 
ExpressionProjectionSegment(0, 0, "nvl(leave_date, '20991231')");
-        expressionProjectionSegment.setAlias(new AliasSegment(0, 0, new 
IdentifierValue("leave_date")));
-        subQuerySegment.getProjections().add(expressionProjectionSegment);
-        OracleSelectStatement subSelectStatement = new OracleSelectStatement();
-        subSelectStatement.setProjections(subQuerySegment);
-        subSelectStatement.setFrom(new SimpleTableSegment(new 
TableNameSegment(0, 0, new IdentifierValue("staff_info"))));
-        ShorthandProjectionSegment shorthandProjectionSegment = new 
ShorthandProjectionSegment(0, 0);
-        SubqueryTableSegment subqueryTableSegment = new 
SubqueryTableSegment(new SubquerySegment(0, 0, subSelectStatement));
-        Optional<Projection> actual = new 
ProjectionEngine(DefaultDatabase.LOGIC_NAME, 
Collections.singletonMap(DefaultDatabase.LOGIC_NAME, schema), databaseType)
-                .createProjection(subqueryTableSegment, 
shorthandProjectionSegment);
-        assertTrue(actual.isPresent());
-        assertThat(actual.get(), instanceOf(ShorthandProjection.class));
-        assertThat(((ShorthandProjection) 
actual.get()).getColumnProjections().size(), is(2));
-        assertThat(((ShorthandProjection) 
actual.get()).getActualColumns().size(), is(2));
-        Collection<ColumnProjection> columnProjections = new LinkedList<>();
-        columnProjections.add(new ColumnProjection(null, "name", null));
-        columnProjections.add(new ColumnProjection(null, "leave_date", null));
-        assertThat(((ShorthandProjection) 
actual.get()).getColumnProjections(), is(columnProjections));
-        Collection<Projection> expectedColumnProjections = new 
LinkedHashSet<>();
-        expectedColumnProjections.add(new ColumnProjection(null, "name", 
null));
-        expectedColumnProjections.add(new ColumnProjection(null, "leave_date", 
null));
-        assertThat(((ShorthandProjection) actual.get()).getActualColumns(), 
is(expectedColumnProjections));
-    }
-    
     @Test
     void 
assertCreateProjectionWhenShorthandProjectionContainsJoinUsingColumnForPostgreSQL()
 {
         
when(schema.getVisibleColumnNames("t_order")).thenReturn(Arrays.asList("order_id",
 "user_id", "status", "merchant_id", "remark", "creation_date"));
diff --git 
a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java
 
b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java
index 7f48cfce334..72538b4e789 100644
--- 
a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java
+++ 
b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java
@@ -122,37 +122,6 @@ class MySQLComStmtPrepareExecutorTest {
         MySQLStatementIdGenerator.getInstance().unregisterConnection(1);
     }
     
-    @Test
-    void assertPrepareSelectSubqueryStatement() {
-        String sql = "select *, '' from (select u.id id_alias, name, age from 
foo_db.user u where id = ?) t";
-        when(packet.getSQL()).thenReturn(sql);
-        int connectionId = 2;
-        when(connectionSession.getConnectionId()).thenReturn(connectionId);
-        
MySQLStatementIdGenerator.getInstance().registerConnection(connectionId);
-        ContextManager contextManager = mockContextManager();
-        
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
-        Iterator<DatabasePacket> actualIterator = new 
MySQLComStmtPrepareExecutor(packet, connectionSession).execute().iterator();
-        assertThat(actualIterator.next(), 
instanceOf(MySQLComStmtPrepareOKPacket.class));
-        assertThat(actualIterator.next(), 
instanceOf(MySQLColumnDefinition41Packet.class));
-        assertThat(actualIterator.next(), instanceOf(MySQLEofPacket.class));
-        DatabasePacket idColumnDefinitionPacket = actualIterator.next();
-        assertThat(idColumnDefinitionPacket, 
instanceOf(MySQLColumnDefinition41Packet.class));
-        assertThat(getColumnDefinitionFlag((MySQLColumnDefinition41Packet) 
idColumnDefinitionPacket),
-                is(MySQLColumnDefinitionFlag.PRIMARY_KEY.getValue() | 
MySQLColumnDefinitionFlag.UNSIGNED.getValue()));
-        assertThat(actualIterator.next(), 
instanceOf(MySQLColumnDefinition41Packet.class));
-        DatabasePacket ageColumnDefinitionPacket = actualIterator.next();
-        assertThat(ageColumnDefinitionPacket, 
instanceOf(MySQLColumnDefinition41Packet.class));
-        assertThat(getColumnDefinitionFlag((MySQLColumnDefinition41Packet) 
ageColumnDefinitionPacket), is(MySQLColumnDefinitionFlag.UNSIGNED.getValue()));
-        assertThat(actualIterator.next(), 
instanceOf(MySQLColumnDefinition41Packet.class));
-        assertThat(actualIterator.next(), instanceOf(MySQLEofPacket.class));
-        assertFalse(actualIterator.hasNext());
-        MySQLServerPreparedStatement actualPreparedStatement = 
connectionSession.getServerPreparedStatementRegistry().getPreparedStatement(1);
-        assertThat(actualPreparedStatement.getSql(), is(sql));
-        assertThat(actualPreparedStatement.getSqlStatementContext(), 
instanceOf(SelectStatementContext.class));
-        
assertThat(actualPreparedStatement.getSqlStatementContext().getSqlStatement(), 
instanceOf(MySQLSelectStatement.class));
-        
MySQLStatementIdGenerator.getInstance().unregisterConnection(connectionId);
-    }
-    
     @Test
     void assertPrepareInsertStatement() {
         String sql = "insert into user (id, name, age) values (1, ?, ?), (?, 
'bar', ?)";
diff --git 
a/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select-sub-query.xml
 
b/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select-sub-query.xml
index 928c0eabcfd..8a297c73f62 100644
--- 
a/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select-sub-query.xml
+++ 
b/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select-sub-query.xml
@@ -57,19 +57,6 @@
         <assertion expected-data-source-name="read_dataset" />
     </test-case>
     
-    <test-case sql="SELECT * FROM (SELECT m1.* FROM t_merchant m1 INNER JOIN 
t_merchant m2 ON m1.merchant_id = m2.merchant_id) temp" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="encrypt"
-               scenario-comments="Test encrypt shorthand expansion for 
subquery with select join statement when use encrypt feature.">
-        <assertion expected-data-source-name="read_dataset" />
-    </test-case>
-    
-    <test-case sql="SELECT * FROM (SELECT * FROM t_user) temp ORDER BY 
user_id" db-types="MySQL,PostgreSQL,openGauss" 
scenario-types="mask,mask_encrypt,mask_sharding,mask_encrypt_sharding">
-        <assertion expected-data-source-name="expected_dataset" />
-    </test-case>
-    
-    <test-case sql="SELECT * FROM (SELECT u1.* FROM t_user u1 INNER JOIN 
t_user u2 ON u1.user_id = u2.user_id) temp ORDER BY user_id" 
db-types="MySQL,PostgreSQL,openGauss" 
scenario-types="mask,mask_encrypt,mask_sharding,mask_encrypt_sharding">
-        <assertion expected-data-source-name="expected_dataset" />
-    </test-case>
-    
     <test-case sql="SELECT * FROM t_order o WHERE o.order_id IN (SELECT 
i.order_id FROM t_order_item i INNER JOIN t_product p ON i.product_id = 
p.product_id WHERE p.product_id = ?) ORDER BY order_id" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="db">
         <assertion parameters="10:int" 
expected-data-source-name="read_dataset" />
     </test-case>
@@ -88,19 +75,9 @@
                scenario-comments="Test subquery projection contains encrypt 
column and config alias when use encrypt feature.">
         <assertion expected-data-source-name="read_dataset" />
     </test-case>
-    
-    <test-case sql="SELECT * FROM (SELECT business_code, telephone, (SELECT 
password FROM t_user LIMIT 1) AS password FROM t_merchant) AS temp" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="encrypt"
-               scenario-comments="Test shorthand expansion contains subquery 
projection and subquery projection contains encrypt column and config alias 
when use encrypt feature.">
-        <assertion expected-data-source-name="read_dataset" />
-    </test-case>
 
     <test-case sql="SELECT m.business_code, m.telephone, u.user_id FROM 
t_merchant AS m INNER JOIN t_user AS u ON m.merchant_id = u.user_id" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="encrypt"
                scenario-comments="Test join contains some encrypt columns in 
multi tables when use encrypt feature.">
         <assertion expected-data-source-name="read_dataset" />
     </test-case>
-
-    <test-case sql="SELECT * FROM (SELECT m.business_code, m.telephone, 
u.user_id FROM t_merchant AS m INNER JOIN t_user AS u ON m.merchant_id = 
u.user_id) AS temp" db-types="MySQL,PostgreSQL,openGauss" 
scenario-types="encrypt"
-               scenario-comments="Test shorthand expansion contains subquery 
join and join contains some encrypt columns in multi tables when use encrypt 
feature.">
-        <assertion expected-data-source-name="read_dataset" />
-    </test-case>
 </integration-test-cases>
diff --git 
a/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml 
b/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
index 03f3f181d76..1ccf5bda891 100644
--- a/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
+++ b/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
@@ -189,11 +189,6 @@
         <assertion expected-data-source-name="read_dataset" />
     </test-case>
     
-    <test-case sql="SELECT * FROM (SELECT * FROM t_merchant) temp" 
db-types="MySQL,PostgreSQL,openGauss" scenario-types="encrypt"
-               scenario-comments="Test encrypt shorthand expansion for 
subquery with simple select statement when use encrypt feature.">
-        <assertion expected-data-source-name="read_dataset" />
-    </test-case>
-    
     <test-case sql="SELECT * FROM t_data_type_integer_unsigned" 
db-types="MySQL" scenario-types="passthrough" scenario-comments="Test 
ShardingSphere-Proxy MySQL compatibility for unsigned integer data types">
         <assertion expected-data-source-name="expected_dataset" />
     </test-case>
diff --git 
a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-subquery.xml
 
b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-subquery.xml
index 52f6d8768cc..30fbfde0f48 100644
--- 
a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-subquery.xml
+++ 
b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-subquery.xml
@@ -92,11 +92,6 @@
         <output sql="SELECT b.certificate_number, b.amount FROM (SELECT 
a.cipher_certificate_number AS certificate_number, 
a.assisted_query_certificate_number, a.cipher_amount AS amount FROM t_account a 
WHERE a.cipher_amount = 'encrypt_1373') b" />
     </rewrite-assertion>
 
-    <rewrite-assertion 
id="select_not_nested_subquery_in_tablesegment_ref_shorthand" db-types="MySQL">
-        <input sql="SELECT b.* FROM (SELECT a.certificate_number as 
certificate_number, a.amount FROM t_account a WHERE a.amount = 1373) b" />
-        <output sql="SELECT b.certificate_number, b.amount FROM (SELECT 
a.cipher_certificate_number AS certificate_number, 
a.assisted_query_certificate_number, a.cipher_amount AS amount FROM t_account a 
WHERE a.cipher_amount = 'encrypt_1373') b" />
-    </rewrite-assertion>
-
     <rewrite-assertion id="select_with_exists_sub_query" db-types="MySQL">
         <input sql="SELECT out_table.amount FROM t_account out_table WHERE 
EXISTS (SELECT inner_table.amount FROM t_account inner_table)" />
         <output sql="SELECT out_table.cipher_amount AS amount FROM t_account 
out_table WHERE EXISTS (SELECT inner_table.cipher_amount FROM t_account 
inner_table)" />
@@ -106,14 +101,4 @@
         <input sql="SELECT COUNT(1) AS cnt FROM (SELECT a.amount FROM 
t_account a ORDER BY a.amount DESC ) AS tmp" />
         <output sql="SELECT COUNT(1) AS cnt FROM (SELECT a.cipher_amount AS 
amount FROM t_account a ORDER BY a.cipher_amount DESC ) AS tmp" />
     </rewrite-assertion>
-
-    <rewrite-assertion id="select_shorthand_from_sub_query_with_simple_select" 
db-types="MySQL">
-        <input sql="SELECT * FROM (SELECT * FROM t_account a) AS temp" />
-        <output sql="SELECT temp.`account_id`, temp.`certificate_number`, 
temp.`password`, temp.`amount` FROM (SELECT a.`account_id`, 
a.`cipher_certificate_number` AS `certificate_number`, 
a.`assisted_query_certificate_number`, a.`cipher_password` AS `password`, 
a.`assisted_query_password`, a.`cipher_amount` AS `amount` FROM t_account a) AS 
temp" />
-    </rewrite-assertion>
-
-    <rewrite-assertion id="select_shorthand_from_sub_query_with_select_join" 
db-types="MySQL">
-        <input sql="SELECT * FROM (SELECT a1.* FROM t_account a1 INNER JOIN 
t_account a2) AS temp" />
-        <output sql="SELECT temp.`account_id`, temp.`certificate_number`, 
temp.`password`, temp.`amount` FROM (SELECT a1.`account_id`, 
a1.`cipher_certificate_number` AS `certificate_number`, 
a1.`assisted_query_certificate_number`, a1.`cipher_password` AS `password`, 
a1.`assisted_query_password`, a1.`cipher_amount` AS `amount` FROM t_account a1 
INNER JOIN t_account a2) AS temp" />
-    </rewrite-assertion>
 </rewrite-assertions>
diff --git 
a/test/it/rewriter/src/test/resources/scenario/sharding/case/dml/select.xml 
b/test/it/rewriter/src/test/resources/scenario/sharding/case/dml/select.xml
index 3cf0f7a0bf2..548e2b63034 100644
--- a/test/it/rewriter/src/test/resources/scenario/sharding/case/dml/select.xml
+++ b/test/it/rewriter/src/test/resources/scenario/sharding/case/dml/select.xml
@@ -507,12 +507,6 @@
         <output sql="SELECT account_id , CASE WHEN account_id > 0 AND 
account_id &lt;= 10 THEN '(0,10]' WHEN account_id > 10 THEN '(10,+∞)' ELSE '' 
END AS GROUP_BY_DERIVED_0 FROM t_account_1 GROUP BY CASE WHEN account_id > 0 
AND account_id &lt;= 10 THEN '(0,10]' WHEN account_id > 10 THEN '(10,+∞)' ELSE 
'' END ORDER BY CASE WHEN account_id > 0 AND account_id &lt;= 10 THEN '(0,10]' 
WHEN account_id > 10 THEN '(10,+∞)' ELSE '' END" parameters="100" />
     </rewrite-assertion>
 
-    <rewrite-assertion id="select_sub_query_with_no_alias" db-types="Oracle">
-        <input sql="SELECT * FROM ( SELECT TMP.*, ROWNUM ROW_ID FROM ( SELECT  
account_id  FROM t_account ) TMP WHERE ROWNUM &lt;=?) WHERE ROW_ID &gt; ?" 
parameters="10,5" />
-        <output sql="SELECT * FROM ( SELECT TMP.*, ROWNUM ROW_ID FROM ( SELECT 
 account_id  FROM t_account_0 ) TMP WHERE ROWNUM &lt;=?) WHERE ROW_ID &gt; ?" 
parameters="10,0" />
-        <output sql="SELECT * FROM ( SELECT TMP.*, ROWNUM ROW_ID FROM ( SELECT 
 account_id  FROM t_account_1 ) TMP WHERE ROWNUM &lt;=?) WHERE ROW_ID &gt; ?" 
parameters="10,0" />
-    </rewrite-assertion>
-
     <rewrite-assertion 
id="select_with_sharding_value_and_binary_column_for_parameters" 
db-types="MySQL">
         <input sql="SELECT * FROM t_account WHERE BINARY account_id = ?" 
parameters="100" />
         <output sql="SELECT * FROM t_account_0 WHERE BINARY account_id = ?" 
parameters="100" />


Reply via email to