diff --git a/regression-test/suites/nereids_p0/cte/test_cte_with_duplicate_consumer.groovy b/regression-test/suites/nereids_p0/cte/test_cte_with_duplicate_consumer.groovy index 4064efcfc6e2e9..b5cb03ea174405 100644 --- a/regression-test/suites/nereids_p0/cte/test_cte_with_duplicate_consumer.groovy +++ b/regression-test/suites/nereids_p0/cte/test_cte_with_duplicate_consumer.groovy @@ -14,12 +14,22 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +import org.junit.Assert; suite("test_cte_with_duplicate_consumer") { - test { + try { sql """ WITH cte1(col1) AS (SELECT 1), cte2(col2_1, col2_2) AS (SELECT col1, col1 FROM cte1) SELECT * FROM cte2 """ + } catch (Exception e) { + // Duplicated inline view column alias: 'col1' in inline view: 'cte2'' + assertTrue(e.message.contains(" Duplicated inline view column alias")) + } + + test { + sql """ + WITH cte1(col1) AS (SELECT 1), cte2(col2_1) AS (SELECT col1 FROM cte1) SELECT * FROM cte2 + """ - result([[1, 1]]) + result([[1]]) } }