Apache DataFusion SQL Query Engine
Consolidate cte_quoted_reference.slt into cte.slt (#19862)
Anjali Choudhary5b122cc0dd73
diff --git a/datafusion/sqllogictest/test_files/cte.slt b/datafusion/sqllogictest/test_files/cte.sltindex 3dac929387..4fd77be045 100644--- a/datafusion/sqllogictest/test_files/cte.slt+++ b/datafusion/sqllogictest/test_files/cte.slt@@ -42,6 +42,63 @@ physical_planstatement error DataFusion error: Error during planning: WITH query name "a" specified more than onceWITH a AS (SELECT 1), a AS (SELECT 2) SELECT * FROM a;+statement ok+CREATE TABLE orders AS VALUES (1), (2);++##########+## CTE Reference Resolution+##########++# These tests exercise CTE reference resolution with and without identifier+# normalization. The session is configured with a strict catalog/schema provider+# (see `datafusion/sqllogictest/src/test_context.rs`) that only provides the+# `orders` table and panics on any unexpected table lookup.+#+# This makes it observable if DataFusion incorrectly treats a CTE reference as a+# catalog lookup.+#+# Refs: https://github.com/apache/datafusion/issues/18932+#+# NOTE: This test relies on a strict catalog/schema provider registered in+# `datafusion/sqllogictest/src/test_context.rs` that provides only the `orders`+# table and panics on unexpected lookups.++statement ok+set datafusion.sql_parser.enable_ident_normalization = true;++query I+with barbaz as (select * from orders) select * from "barbaz";+----+1+2++query I+with BarBaz as (select * from orders) select * from "barbaz";+----+1+2++query I+with barbaz as (select * from orders) select * from barbaz;+----+1+2++statement ok+set datafusion.sql_parser.enable_ident_normalization = false;++query I+with barbaz as (select * from orders) select * from "barbaz";+----+1+2++query I+with barbaz as (select * from orders) select * from barbaz;+----+1+2+# Test disabling recursive CTEstatement okset datafusion.execution.enable_recursive_ctes = false;@@ -996,7 +1053,7 @@ query TTexplain WITH RECURSIVE numbers AS (select 1 as nUNION ALL- select n + 1 FROM numbers WHERE N < 10+ select n + 1 FROM numbers WHERE n < 10) select * from numbers;----logical_plan@@ -1021,7 +1078,7 @@ query TTexplain WITH RECURSIVE numbers AS (select 1 as nUNION ALL- select n + 1 FROM numbers WHERE N < 10+ select n + 1 FROM numbers WHERE n < 10) select * from numbers;----logical_plan@@ -1160,5 +1217,5 @@ query error DataFusion error: This feature is not implemented: Recursive CTEs arexplain WITH RECURSIVE numbers AS (select 1 as nUNION ALL- select n + 1 FROM numbers WHERE N < 10+ select n + 1 FROM numbers WHERE n < 10) select * from numbers;diff --git a/datafusion/sqllogictest/test_files/cte_quoted_reference.slt b/datafusion/sqllogictest/test_files/cte_quoted_reference.sltdeleted file mode 100644index 6142157e5e..0000000000--- a/datafusion/sqllogictest/test_files/cte_quoted_reference.slt+++ /dev/null@@ -1,70 +0,0 @@-# 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.--##########-## CTE Reference Resolution-##########--# These tests exercise CTE reference resolution with and without identifier-# normalization. The session is configured with a strict catalog/schema provider-# (see `datafusion/sqllogictest/src/test_context.rs`) that only provides the-# `orders` table and panics on any unexpected table lookup.-#-# This makes it observable if DataFusion incorrectly treats a CTE reference as a-# catalog lookup.-#-# Refs: https://github.com/apache/datafusion/issues/18932-#-# NOTE: This test relies on a strict catalog/schema provider registered in-# `datafusion/sqllogictest/src/test_context.rs` that provides only the `orders`-# table and panics on unexpected lookups.--statement ok-set datafusion.sql_parser.enable_ident_normalization = true;--query I-with barbaz as (select * from orders) select * from "barbaz";------1-2--query I-with BarBaz as (select * from orders) select * from "barbaz";------1-2--query I-with barbaz as (select * from orders) select * from barbaz;------1-2--statement ok-set datafusion.sql_parser.enable_ident_normalization = false;--query I-with barbaz as (select * from orders) select * from "barbaz";------1-2--query I-with barbaz as (select * from orders) select * from barbaz;------1-2