Skip to content

Commit 952918e

Browse files
murray-dsclaude
authored andcommitted
test(segstats): cover unknown_customer_value with extra_aggs on the native path
The parity suite exercised unknown-customer tracking and extra_aggs separately but not together, where _build_unknown_aggs emits three filtered variants per extra agg under GROUPING SETS. Native output matches the union fallback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 562c682 commit 952918e

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

tests/segmentation/test_segstats.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,14 +2042,32 @@ def test_native_path_selection(self, native_opt, use_memtable, expect_grouping_s
20422042
_NATIVE_SEGMENTS,
20432043
{"grouping_sets": "cube", "extra_aggs": {"unique_stores": (cols.store_id, "nunique")}},
20442044
),
2045+
(
2046+
_native_sample_df(),
2047+
_NATIVE_SEGMENTS,
2048+
{
2049+
"grouping_sets": "rollup",
2050+
"unknown_customer_value": -1,
2051+
"extra_aggs": {"unique_stores": (cols.store_id, "nunique")},
2052+
},
2053+
),
20452054
# A segment column literally named like the internal GROUPING() flag must not break the rewrite.
20462055
(
20472056
_native_sample_df().rename(columns={"region": "grouping_flag_0"}),
20482057
["grouping_flag_0", "category"],
20492058
{"grouping_sets": "rollup"},
20502059
),
20512060
],
2052-
ids=["rollup", "cube", "total", "custom", "unknown_customer", "extra_aggs", "flag_name_collision"],
2061+
ids=[
2062+
"rollup",
2063+
"cube",
2064+
"total",
2065+
"custom",
2066+
"unknown_customer",
2067+
"extra_aggs",
2068+
"unknown_with_extra_aggs",
2069+
"flag_name_collision",
2070+
],
20532071
)
20542072
def test_native_output_matches_union_fallback(self, df, segments, kwargs):
20552073
"""The native single-scan output is identical to the portable union fallback across configurations."""

0 commit comments

Comments
 (0)