Skip to content

Commit 680bda6

Browse files
ahrzbclaude
authored andcommitted
test: qualify/disambiguate params-join differential SQL
Bare shared column names in ON are ambiguous in DuckDB too; the marginalizer always qualifies — tests now mirror that. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 07e2388 commit 680bda6

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

packages/confit/tests/test_params_joins.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ def test_indf_inner_join_null_joins_null():
3737

3838

3939
def test_indf_string_key_and_nullable_value():
40+
# Same column name on both sides (the marginalizer's shape) — every
41+
# reference qualified, exactly as generated SQL qualifies.
4042
dim = static(
4143
{"country": "str?", "est": "int?"},
4244
[{"country": "de", "est": 0}, {"country": None, "est": 1}],
4345
)
4446
duck_check(
45-
"SELECT country, est FROM __THIS__ "
46-
"LEFT JOIN dim ON country IS NOT DISTINCT FROM dim.country",
47+
"SELECT t.country, est FROM __THIS__ AS t "
48+
"LEFT JOIN dim ON t.country IS NOT DISTINCT FROM dim.country",
4749
{"country": "str?"},
4850
[{"country": "de"}, {"country": None}, {"country": "fr"}],
4951
{"dim": dim},
@@ -52,16 +54,16 @@ def test_indf_string_key_and_nullable_value():
5254

5355
def test_indf_multi_key_conjunction():
5456
dim = static(
55-
{"a": "int?", "b": "str?", "v": "int"},
57+
{"ka": "int?", "kb": "str?", "v": "int"},
5658
[
57-
{"a": 1, "b": "x", "v": 10},
58-
{"a": 1, "b": None, "v": 11},
59-
{"a": None, "b": None, "v": 12},
59+
{"ka": 1, "kb": "x", "v": 10},
60+
{"ka": 1, "kb": None, "v": 11},
61+
{"ka": None, "kb": None, "v": 12},
6062
],
6163
)
6264
duck_check(
6365
"SELECT v FROM __THIS__ LEFT JOIN dim ON "
64-
"(a IS NOT DISTINCT FROM dim.a) AND (b IS NOT DISTINCT FROM dim.b)",
66+
"(a IS NOT DISTINCT FROM dim.ka) AND (b IS NOT DISTINCT FROM dim.kb)",
6567
{"a": "int?", "b": "str?"},
6668
[
6769
{"a": 1, "b": "x"},
@@ -75,12 +77,12 @@ def test_indf_multi_key_conjunction():
7577

7678
def test_indf_mixed_with_eq_key():
7779
dim = static(
78-
{"a": "int", "b": "int?", "v": "int"},
79-
[{"a": 1, "b": 5, "v": 10}, {"a": 1, "b": None, "v": 11}],
80+
{"ka": "int", "kb": "int?", "v": "int"},
81+
[{"ka": 1, "kb": 5, "v": 10}, {"ka": 1, "kb": None, "v": 11}],
8082
)
8183
duck_check(
8284
"SELECT v FROM __THIS__ LEFT JOIN dim ON "
83-
"a = dim.a AND (b IS NOT DISTINCT FROM dim.b)",
85+
"a = dim.ka AND (b IS NOT DISTINCT FROM dim.kb)",
8486
{"a": "int?", "b": "int?"},
8587
[
8688
{"a": 1, "b": 5},

0 commit comments

Comments
 (0)