summaryrefslogtreecommitdiffstats
path: root/tests/fixtures/optimizer/optimizer.sql
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-04 12:14:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-04 12:14:40 +0000
commitd7f0758e21b5111b5327f3839c5c9f49a04d272b (patch)
treea425f4ebcc159d6bd9443fe4e0e2f9eb20151027 /tests/fixtures/optimizer/optimizer.sql
parentAdding upstream version 18.7.0. (diff)
downloadsqlglot-d7f0758e21b5111b5327f3839c5c9f49a04d272b.tar.xz
sqlglot-d7f0758e21b5111b5327f3839c5c9f49a04d272b.zip
Adding upstream version 18.11.2.upstream/18.11.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/fixtures/optimizer/optimizer.sql')
-rw-r--r--tests/fixtures/optimizer/optimizer.sql22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/fixtures/optimizer/optimizer.sql b/tests/fixtures/optimizer/optimizer.sql
index e59f14d..4cc62c9 100644
--- a/tests/fixtures/optimizer/optimizer.sql
+++ b/tests/fixtures/optimizer/optimizer.sql
@@ -1023,3 +1023,25 @@ SELECT
FROM "table1" AS "table1"
LEFT JOIN "alias3"
ON "table1"."cid" = "alias3"."cid";
+
+# title: CTE with EXPLODE cannot be merged
+# dialect: spark
+# execute: false
+SELECT Name,
+ FruitStruct.`$id`,
+ FruitStruct.value
+ FROM
+ (SELECT Name,
+ explode(Fruits) as FruitStruct
+ FROM fruits_table);
+WITH `_q_0` AS (
+ SELECT
+ `fruits_table`.`name` AS `name`,
+ EXPLODE(`fruits_table`.`fruits`) AS `fruitstruct`
+ FROM `fruits_table` AS `fruits_table`
+)
+SELECT
+ `_q_0`.`name` AS `name`,
+ `_q_0`.`fruitstruct`.`$id` AS `$id`,
+ `_q_0`.`fruitstruct`.`value` AS `value`
+FROM `_q_0` AS `_q_0`;