Merging upstream version 26.22.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
ecad2ca6a9
commit
3552a78d82
69 changed files with 29194 additions and 28548 deletions
15
tests/fixtures/optimizer/annotate_functions.sql
vendored
15
tests/fixtures/optimizer/annotate_functions.sql
vendored
|
@ -28,6 +28,21 @@ TIME;
|
|||
TIME_SUB(CAST('09:05:03' AS TIME), INTERVAL 2 HOUR);
|
||||
TIME;
|
||||
|
||||
SORT_ARRAY(ARRAY(tbl.str_col));
|
||||
ARRAY<STRING>;
|
||||
|
||||
SORT_ARRAY(ARRAY(tbl.double_col));
|
||||
ARRAY<DOUBLE>;
|
||||
|
||||
SORT_ARRAY(ARRAY(tbl.bigint_col));
|
||||
ARRAY<BIGINT>;
|
||||
|
||||
tbl.bigint || tbl.str_col;
|
||||
VARCHAR;
|
||||
|
||||
tbl.str_col || tbl.bigint;
|
||||
VARCHAR;
|
||||
|
||||
--------------------------------------
|
||||
-- Spark2 / Spark3 / Databricks
|
||||
--------------------------------------
|
||||
|
|
6
tests/fixtures/optimizer/annotate_types.sql
vendored
6
tests/fixtures/optimizer/annotate_types.sql
vendored
|
@ -86,3 +86,9 @@ TIME;
|
|||
# dialect: bigquery
|
||||
EXTRACT(day from x);
|
||||
INT;
|
||||
|
||||
CASE WHEN x THEN CAST(y AS DECIMAL(18, 2)) ELSE NULL END;
|
||||
DECIMAL(18,2);
|
||||
|
||||
CASE WHEN x THEN NULL ELSE CAST(y AS DECIMAL(18, 2)) END;
|
||||
DECIMAL(18,2);
|
||||
|
|
30
tests/fixtures/optimizer/optimizer.sql
vendored
30
tests/fixtures/optimizer/optimizer.sql
vendored
|
@ -693,14 +693,14 @@ PIVOT(MAX("SOURCE"."VALUE") FOR "SOURCE"."KEY" IN ('a', 'b', 'c')) AS "FINAL"("I
|
|||
# dialect: snowflake
|
||||
SELECT * FROM m_sales AS m_sales(empid, dept, jan, feb) UNPIVOT(sales FOR month IN (jan, feb)) ORDER BY empid;
|
||||
SELECT
|
||||
"_Q_0"."EMPID" AS "EMPID",
|
||||
"_Q_0"."DEPT" AS "DEPT",
|
||||
"_Q_0"."MONTH" AS "MONTH",
|
||||
"_Q_0"."SALES" AS "SALES"
|
||||
"M_SALES"."EMPID" AS "EMPID",
|
||||
"M_SALES"."DEPT" AS "DEPT",
|
||||
"M_SALES"."MONTH" AS "MONTH",
|
||||
"M_SALES"."SALES" AS "SALES"
|
||||
FROM "M_SALES" AS "M_SALES"("EMPID", "DEPT", "JAN", "FEB")
|
||||
UNPIVOT("SALES" FOR "MONTH" IN ("JAN", "FEB")) AS "_Q_0"
|
||||
UNPIVOT("SALES" FOR "MONTH" IN ("JAN", "FEB")) AS "M_SALES"
|
||||
ORDER BY
|
||||
"_Q_0"."EMPID";
|
||||
"M_SALES"."EMPID";
|
||||
|
||||
# title: unpivoted table source, unpivot has column aliases
|
||||
# execute: false
|
||||
|
@ -747,28 +747,28 @@ ORDER BY
|
|||
# note: the named columns aren not supported by BQ but we add them here to avoid defining a schema
|
||||
SELECT * FROM produce AS produce(product, q1, q2, q3, q4) UNPIVOT(sales FOR quarter IN (q1, q2, q3, q4));
|
||||
SELECT
|
||||
`_q_0`.`product` AS `product`,
|
||||
`_q_0`.`quarter` AS `quarter`,
|
||||
`_q_0`.`sales` AS `sales`
|
||||
`produce`.`product` AS `product`,
|
||||
`produce`.`quarter` AS `quarter`,
|
||||
`produce`.`sales` AS `sales`
|
||||
FROM `produce` AS `produce`
|
||||
UNPIVOT(`sales` FOR `quarter` IN (`produce`.`q1`, `produce`.`q2`, `produce`.`q3`, `produce`.`q4`)) AS `_q_0`;
|
||||
UNPIVOT(`sales` FOR `quarter` IN (`produce`.`q1`, `produce`.`q2`, `produce`.`q3`, `produce`.`q4`)) AS `produce`;
|
||||
|
||||
# title: unpivoted table source with multiple value columns
|
||||
# execute: false
|
||||
# dialect: bigquery
|
||||
SELECT * FROM produce AS produce(product, q1, q2, q3, q4) UNPIVOT((first_half_sales, second_half_sales) FOR semesters IN ((Q1, Q2) AS 'semester_1', (Q3, Q4) AS 'semester_2'));
|
||||
SELECT
|
||||
`_q_0`.`product` AS `product`,
|
||||
`_q_0`.`semesters` AS `semesters`,
|
||||
`_q_0`.`first_half_sales` AS `first_half_sales`,
|
||||
`_q_0`.`second_half_sales` AS `second_half_sales`
|
||||
`produce`.`product` AS `product`,
|
||||
`produce`.`semesters` AS `semesters`,
|
||||
`produce`.`first_half_sales` AS `first_half_sales`,
|
||||
`produce`.`second_half_sales` AS `second_half_sales`
|
||||
FROM `produce` AS `produce`
|
||||
UNPIVOT((`first_half_sales`, `second_half_sales`) FOR
|
||||
`semesters` IN (
|
||||
(`produce`.`q1`, `produce`.`q2`) AS 'semester_1',
|
||||
(`produce`.`q3`, `produce`.`q4`) AS 'semester_2'
|
||||
)
|
||||
) AS `_q_0`;
|
||||
) AS `produce`;
|
||||
|
||||
# title: quoting is preserved
|
||||
# dialect: snowflake
|
||||
|
|
8
tests/fixtures/optimizer/tpc-ds/tpc-ds.sql
vendored
8
tests/fixtures/optimizer/tpc-ds/tpc-ds.sql
vendored
|
@ -11105,11 +11105,9 @@ LEFT JOIN "ws" AS "ws"
|
|||
AND "ss"."ss_item_sk" = "ws"."ws_item_sk"
|
||||
AND "ss"."ss_sold_year" = "ws"."ws_sold_year"
|
||||
WHERE
|
||||
"cs"."cs_qty" > 0
|
||||
AND "ss"."ss_sold_year" = 1999
|
||||
AND "ws"."ws_qty" > 0
|
||||
AND NOT "cs"."cs_qty" IS NULL
|
||||
AND NOT "ws"."ws_qty" IS NULL
|
||||
"ss"."ss_sold_year" = 1999
|
||||
AND COALESCE("cs"."cs_qty", 0) > 0
|
||||
AND COALESCE("ws"."ws_qty", 0) > 0
|
||||
ORDER BY
|
||||
"ss_item_sk",
|
||||
"ss"."ss_qty" DESC,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue