Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: "^tests/unit/core/compile/sqlglot/.*snapshots"
exclude: "^tests/.*/snapshots"
- id: check-yaml
- repo: https://github.com/pycqa/isort
rev: 5.12.0
Expand Down
5 changes: 5 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,11 @@ def unit_prerelease(session: nox.sessions.Session):
prerelease(session, os.path.join("tests", "unit"))


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1])
def snapshot(session: nox.sessions.Session):
run_unit(session, os.path.join("tests", "snapshot"))


@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS[-1])
def system_prerelease(session: nox.sessions.Session):
"""Run the system test suite with prerelease dependencies."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ WITH `bfcte_0` AS (
), `bfcte_1` AS (
SELECT
COALESCE(
STRING_AGG(`string_col`, ','
ORDER BY
`string_col` IS NULL ASC,
`string_col` ASC),
STRING_AGG(`string_col` ORDER BY `string_col` IS NULL ASC, `string_col` ASC, ','),
''
) AS `bfcol_1`
FROM `bfcte_0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ WITH `bfcte_0` AS (
CASE
WHEN `int64_col` IS NULL
THEN NULL
ELSE LAST_VALUE(`int64_col`) OVER (
ORDER BY `int64_col` DESC
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
)
ELSE FIRST_VALUE(`int64_col`) OVER (ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
END AS `bfcol_1`
FROM `bfcte_0`
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ WITH `bfcte_0` AS (
), `bfcte_1` AS (
SELECT
*,
LAST_VALUE(`int64_col` IGNORE NULLS) OVER (
ORDER BY `int64_col` ASC NULLS LAST
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
) AS `bfcol_1`
FIRST_VALUE(`int64_col` IGNORE NULLS) OVER (ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `bfcol_1`
FROM `bfcte_0`
)
SELECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ WITH `bfcte_0` AS (
CASE
WHEN `int64_col` IS NULL
THEN NULL
ELSE FIRST_VALUE(`int64_col`) OVER (
ORDER BY `int64_col` DESC
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
)
ELSE LAST_VALUE(`int64_col`) OVER (ORDER BY `int64_col` DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
END AS `bfcol_1`
FROM `bfcte_0`
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ WITH `bfcte_0` AS (
), `bfcte_1` AS (
SELECT
*,
FIRST_VALUE(`int64_col` IGNORE NULLS) OVER (
ORDER BY `int64_col` ASC NULLS LAST
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
) AS `bfcol_1`
LAST_VALUE(`int64_col` IGNORE NULLS) OVER (ORDER BY `int64_col` ASC NULLS LAST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `bfcol_1`
FROM `bfcte_0`
)
SELECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ WITH `bfcte_0` AS (
)
SELECT
`bfcol_1` AS `float64_col`
FROM `bfcte_1`
FROM `bfcte_1`
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ WITH `bfcte_0` AS (
), `bfcte_1` AS (
SELECT
*,
INSTR(`string_col`, 'e', 1) - 1 AS `bfcol_1`,
INSTR(`string_col`, 'e', 3) - 1 AS `bfcol_2`,
INSTR(SUBSTRING(`string_col`, 1, 5), 'e') - 1 AS `bfcol_3`,
INSTR(SUBSTRING(`string_col`, 3, 3), 'e') - 1 AS `bfcol_4`
STRPOS(`string_col`, 'e') - 1 AS `bfcol_1`,
STRPOS(`string_col`, 'e') - 1 AS `bfcol_2`,
STRPOS(SUBSTRING(`string_col`, 1, 5), 'e') - 1 AS `bfcol_3`,
STRPOS(SUBSTRING(`string_col`, 3, 3), 'e') - 1 AS `bfcol_4`
FROM `bfcte_0`
)
SELECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ WITH `bfcte_1` AS (
SELECT
`bfcte_3`.*,
`bfcte_3`.`bfcol_3` IN ((
SELECT
`rowindex_2` AS `bfcol_4`
FROM `bfcte_2`
SELECT
`rowindex_2` AS `bfcol_4`
FROM `bfcte_2`
)) AS `bfcol_5`
FROM `bfcte_3`
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ WITH `bfcte_0` AS (
SELECT
`bfcol_6` AS `rowindex`,
`bfcol_7` AS `int64_col`
FROM `bfcte_3`
FROM `bfcte_3`
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ SELECT
`bfcol_14` AS `duration_col`
FROM `bfcte_1`
ORDER BY
`bfcol_15` ASC NULLS LAST
`bfcol_15` ASC NULLS LAST
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,4 @@ SELECT
`bfcol_15` AS `duration_col`
FROM `bfcte_0`
ORDER BY
`bfcol_16` ASC NULLS LAST
`bfcol_16` ASC NULLS LAST
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ SELECT
`bfcol_7` AS `string_list_col`
FROM `bfcte_0`
ORDER BY
`bfcol_8` ASC NULLS LAST
`bfcol_8` ASC NULLS LAST
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ SELECT
`bfcol_1` AS `person`
FROM `bfcte_0`
ORDER BY
`bfcol_2` ASC NULLS LAST
`bfcol_2` ASC NULLS LAST
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,10 @@ WITH `bfcte_0` AS (
SELECT
*,
CASE
WHEN SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER (
PARTITION BY `bfcol_9`
ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST
ROWS BETWEEN 3 PRECEDING AND CURRENT ROW
) < 3
WHEN SUM(CAST(NOT `bfcol_7` IS NULL AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) < 3
THEN NULL
ELSE COALESCE(
SUM(CAST(`bfcol_7` AS INT64)) OVER (
PARTITION BY `bfcol_9`
ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST
ROWS BETWEEN 3 PRECEDING AND CURRENT ROW
),
SUM(CAST(`bfcol_7` AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW),
0
)
END AS `bfcol_15`
Expand All @@ -48,18 +40,10 @@ WITH `bfcte_0` AS (
SELECT
*,
CASE
WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER (
PARTITION BY `bfcol_9`
ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST
ROWS BETWEEN 3 PRECEDING AND CURRENT ROW
) < 3
WHEN SUM(CAST(NOT `bfcol_8` IS NULL AS INT64)) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) < 3
THEN NULL
ELSE COALESCE(
SUM(`bfcol_8`) OVER (
PARTITION BY `bfcol_9`
ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST
ROWS BETWEEN 3 PRECEDING AND CURRENT ROW
),
SUM(`bfcol_8`) OVER (PARTITION BY `bfcol_9` ORDER BY `bfcol_9` ASC NULLS LAST, `rowindex` ASC NULLS LAST ROWS BETWEEN 3 PRECEDING AND CURRENT ROW),
0
)
END AS `bfcol_21`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@ WITH `bfcte_0` AS (
SELECT
*,
CASE
WHEN SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER (
ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST
RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW
) < 1
WHEN SUM(CAST(NOT `bfcol_1` IS NULL AS INT64)) OVER (ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW) < 1
THEN NULL
ELSE COALESCE(
SUM(`bfcol_1`) OVER (
ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST
RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW
),
SUM(`bfcol_1`) OVER (ORDER BY UNIX_MICROS(`bfcol_0`) ASC NULLS LAST RANGE BETWEEN 2999999 PRECEDING AND CURRENT ROW),
0
)
END AS `bfcol_6`
Expand Down
Loading