From a299be925028c6243d34b020920dfd0135bb9574 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Thu, 29 Jun 2023 15:02:26 +0200
Subject: Adding upstream version 16.7.3.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
---
 tests/fixtures/optimizer/optimizer.sql | 38 ++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 13 deletions(-)

(limited to 'tests/fixtures/optimizer/optimizer.sql')

diff --git a/tests/fixtures/optimizer/optimizer.sql b/tests/fixtures/optimizer/optimizer.sql
index 214535a..f71ddde 100644
--- a/tests/fixtures/optimizer/optimizer.sql
+++ b/tests/fixtures/optimizer/optimizer.sql
@@ -577,10 +577,10 @@ FROM `u_cte` AS `u_cte` PIVOT(SUM(`u_cte`.`f`) AS `sum` FOR `u_cte`.`h` IN ('x',
 # dialect: snowflake
 SELECT * FROM u PIVOT (SUM(f) FOR h IN ('x', 'y'));
 SELECT
-  "_q_0"."G" AS "G",
-  "_q_0"."'x'" AS "'x'",
-  "_q_0"."'y'" AS "'y'"
-FROM "U" AS "U" PIVOT(SUM("U"."F") FOR "U"."H" IN ('x', 'y')) AS "_q_0"
+  "_Q_0"."G" AS "G",
+  "_Q_0"."'x'" AS "'x'",
+  "_Q_0"."'y'" AS "'y'"
+FROM "U" AS "U" PIVOT(SUM("U"."F") FOR "U"."H" IN ('x', 'y')) AS "_Q_0"
 ;
 
 # title: selecting all columns from a pivoted source and generating spark
@@ -668,16 +668,28 @@ WHERE
 GROUP BY `dAy`, `top_term`, rank
 ORDER BY `DaY` DESC;
 SELECT
-  `TOp_TeRmS`.`refresh_date` AS `day`,
-  `TOp_TeRmS`.`term` AS `top_term`,
-  `TOp_TeRmS`.`rank` AS `rank`
-FROM `bigquery-public-data`.`GooGle_tReNDs`.`TOp_TeRmS` AS `TOp_TeRmS`
+  `top_terms`.`refresh_date` AS `day`,
+  `top_terms`.`term` AS `top_term`,
+  `top_terms`.`rank` AS `rank`
+FROM `bigquery-public-data`.`GooGle_tReNDs`.`TOp_TeRmS` AS `top_terms`
 WHERE
-  `TOp_TeRmS`.`rank` = 1
-  AND CAST(`TOp_TeRmS`.`refresh_date` AS DATE) >= DATE_SUB(CURRENT_DATE, INTERVAL 2 WEEK)
+  `top_terms`.`rank` = 1
+  AND CAST(`top_terms`.`refresh_date` AS DATE) >= DATE_SUB(CURRENT_DATE, INTERVAL 2 WEEK)
 GROUP BY
-  `TOp_TeRmS`.`refresh_date`,
-  `TOp_TeRmS`.`term`,
-  `TOp_TeRmS`.`rank`
+  `day`,
+  `top_term`,
+  `rank`
 ORDER BY
   `day` DESC;
+
+
+# title: group by keys cannot be simplified
+SELECT a + 1 + 1 + 1 + 1 AS b, 2 + 1 AS c FROM x GROUP BY a + 1 + 1 HAVING a + 1 + 1 + 1 + 1 > 1;
+SELECT
+  "x"."a" + 1 + 1 + 1 + 1 AS "b",
+  3 AS "c"
+FROM "x" AS "x"
+GROUP BY
+  "x"."a" + 1 + 1
+HAVING
+  "x"."a" + 1 + 1 + 1 + 1 > 1;
-- 
cgit v1.2.3

