strongduanmu commented on code in PR #34163: URL: https://github.com/apache/shardingsphere/pull/34163#discussion_r1903200410
########## infra/common/src/main/java/org/apache/shardingsphere/infra/exception/kernel/syntax/DuplicateCommonTableExpressionAliasException.java: ########## @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.exception.kernel.syntax; + +import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; +import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.SyntaxSQLException; + +/** + * Duplicate common table expression alias exception. + */ +public final class DuplicateCommonTableExpressionAliasException extends SyntaxSQLException { + + private static final long serialVersionUID = -8206891094419297634L; + + public DuplicateCommonTableExpressionAliasException(final String alias) { Review Comment: Hi @Yash-cor, can you update this new DuplicateCommonTableExpressionAliasException to doc? ########## test/it/binder/src/test/resources/sqls/dml/select.xml: ########## @@ -20,5 +20,6 @@ <sql-case id="select_with_shorthand_projection" value="SELECT * FROM t_order o" db-types="MySQL"/> <sql-case id="select_with_group_by_order_by" value="SELECT order_id, COUNT(1) count FROM t_order o GROUP BY order_id HAVING count > 1 ORDER BY order_id" db-types="MySQL"/> <sql-case id="select_with_with_clause" value="WITH t_order_tmp AS (SELECT * FROM t_order o) SELECT * FROM t_order_tmp" db-types="MySQL"/> + <sql-case id="select_with_clause_with_multiple_cte_definitions" value="WITH cte1(status, user_id) AS (SELECT status, user_id FROM t_order a), cte2(user_id, item_id) AS (SELECT user_id, item_id FROM t_order_item b) SELECT status, user_id, item_id FROM cte1 INNER JOIN cte2 ON cte1.user_id = cte2.user_id" db-types="MySQL" /> Review Comment: Besides, can you add `with orders as (select * from t_order) select * from orders` to db, tbl e2e scenario? Maybe you need to change the table name and use a single table in E2E to test this problem. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
