This is an automated email from the ASF dual-hosted git repository. chengzhang 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 4d7faf406fa Remove useless openGauss visit logic (#35464) 4d7faf406fa is described below commit 4d7faf406fa2d00e1d9f0d247c3b888d8ab6c7c4 Author: Zhengqiang Duan <duanzhengqi...@apache.org> AuthorDate: Mon May 19 17:29:56 2025 +0800 Remove useless openGauss visit logic (#35464) --- .../visitor/statement/OpenGaussStatementVisitor.java | 10 +--------- .../resources/case/dml/select-special-function.xml | 19 +++++++++++++++++++ .../sql/supported/dml/select-special-function.xml | 3 ++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/parser/sql/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/OpenGaussStatementVisitor.java b/parser/sql/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/OpenGaussStatementVisitor.java index a55766ec17c..1d7facf6381 100644 --- a/parser/sql/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/OpenGaussStatementVisitor.java +++ b/parser/sql/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/OpenGaussStatementVisitor.java @@ -447,15 +447,7 @@ public abstract class OpenGaussStatementVisitor extends OpenGaussStatementBaseVi if (null != ctx.functionExprCommonSubexpr()) { return visit(ctx.functionExprCommonSubexpr()); } - Collection<ExpressionSegment> expressionSegments = getExpressionSegments(getTargetRuleContextFromParseTree(ctx, AExprContext.class)); - // TODO replace aggregation segment - String aggregationType = ctx.funcApplication().funcName().getText(); - if (AggregationType.isAggregationType(aggregationType) && null == ctx.funcApplication().sortClause()) { - return createAggregationSegment(ctx.funcApplication(), aggregationType, expressionSegments); - } - FunctionSegment result = new FunctionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.funcApplication().funcName().getText(), getOriginalText(ctx)); - result.getParameters().addAll(expressionSegments); - return result; + return visit(ctx.funcApplication()); } @Override diff --git a/test/it/parser/src/main/resources/case/dml/select-special-function.xml b/test/it/parser/src/main/resources/case/dml/select-special-function.xml index dfe451a1e12..0e68d5d897a 100644 --- a/test/it/parser/src/main/resources/case/dml/select-special-function.xml +++ b/test/it/parser/src/main/resources/case/dml/select-special-function.xml @@ -36,6 +36,25 @@ </expression-projection> </projections> </select> + <select sql-case-id="select_group_concat_with_order_by_for_opengauss"> + <from> + <simple-table name="t_order" start-index="49" stop-index="55" /> + </from> + <projections start-index="7" stop-index="42"> + <aggregation-projection type="GROUP_CONCAT" expression="GROUP_CONCAT(status ORDER BY status)" start-index="7" stop-index="42"> + <expr> + <function function-name="GROUP_CONCAT" start-index="7" stop-index="42" text="GROUP_CONCAT(status ORDER BY status)"> + <parameter> + <column name="status" start-index="20" stop-index="25" /> + </parameter> + <parameter> + <column name="status" start-index="36" stop-index="41" /> + </parameter> + </function> + </expr> + </aggregation-projection> + </projections> + </select> <select sql-case-id="select_window_function"> <from> <simple-table name="t_order" start-index="42" stop-index="48" /> diff --git a/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml b/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml index 786224cf5b2..261edbf18b1 100644 --- a/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml +++ b/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml @@ -17,7 +17,8 @@ --> <sql-cases> - <sql-case id="select_group_concat_with_order_by" value="SELECT GROUP_CONCAT(status ORDER BY status) FROM t_order" db-types="MySQL,Doris,openGauss" /> + <sql-case id="select_group_concat_with_order_by" value="SELECT GROUP_CONCAT(status ORDER BY status) FROM t_order" db-types="MySQL,Doris" /> + <sql-case id="select_group_concat_with_order_by_for_opengauss" value="SELECT GROUP_CONCAT(status ORDER BY status) FROM t_order" db-types="openGauss" /> <sql-case id="select_window_function" value="SELECT order_id, ROW_NUMBER() OVER() FROM t_order" db-types="MySQL" /> <sql-case id="select_cast_function" value="SELECT CAST('1' AS UNSIGNED)" db-types="MySQL" /> <sql-case id="select_cast_as_year" value="SELECT CAST(-1.1 AS YEAR)" db-types="MySQL" />