Skip to content

Commit 210f125

Browse files
committed
fix test
1 parent 8a5a772 commit 210f125

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

tests/unit/core/compile/sqlglot/expressions/snapshots/test_generic_ops/test_coalesce/out.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ WITH `bfcte_0` AS (
66
), `bfcte_1` AS (
77
SELECT
88
*,
9-
COALESCE(`bfcol_0`, `bfcol_1`) AS `bfcol_2`
9+
`bfcol_0` AS `bfcol_2`,
10+
COALESCE(`bfcol_1`, `bfcol_0`) AS `bfcol_3`
1011
FROM `bfcte_0`
1112
)
1213
SELECT
13-
`bfcol_2` AS `int64_col`
14+
`bfcol_2` AS `int64_col`,
15+
`bfcol_3` AS `int64_too`
1416
FROM `bfcte_1`

tests/unit/core/compile/sqlglot/expressions/test_generic_ops.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,15 @@ def test_case_when_op(scalar_types_df: bpd.DataFrame, snapshot):
211211

212212
def test_coalesce(scalar_types_df: bpd.DataFrame, snapshot):
213213
bf_df = scalar_types_df[["int64_col", "int64_too"]]
214-
sql = utils._apply_binary_op(bf_df, ops.coalesce_op, "int64_col", "int64_too")
215214

215+
sql = utils._apply_ops_to_sql(
216+
bf_df,
217+
[
218+
ops.coalesce_op.as_expr("int64_col", "int64_col"),
219+
ops.coalesce_op.as_expr("int64_too", "int64_col"),
220+
],
221+
["int64_col", "int64_too"],
222+
)
216223
snapshot.assert_match(sql, "out.sql")
217224

218225

0 commit comments

Comments
 (0)