Skip to content

Commit eda7239

Browse files
committed
test: pin the tail-return limit of UDF output reading
The tail return is read as the output shape, so a key an earlier branch omits is still treated as guaranteed. Pre-existing and shared with the conditional-required scanner, but newly reachable for FILE tools — pin it so the limit is visible and cannot shift unnoticed. Signed-off-by: Muizz Lateef <lateefmuizz@gmail.com>
1 parent bb8cf78 commit eda7239

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/validation/test_dag_fit_synthesized_fields.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,23 @@ def split(items):
112112
""")
113113
assert unconditional_output_keys(source) == {"shared"}
114114

115+
def test_tail_return_wins_over_earlier_branches(self):
116+
"""Known limit: the tail return is read as the output shape.
117+
118+
Keys emitted only by an earlier branch are not counted, and keys the
119+
earlier branch omits are still treated as guaranteed — so a field the
120+
early path skips can go unwarned. The reading is shared with the
121+
conditional-required scanner; narrowing it belongs with that check,
122+
and the cost here is at most one advisory warning not shown.
123+
"""
124+
source = textwrap.dedent("""
125+
def writer(items):
126+
if not items:
127+
return FileUDFResult(outputs=[{"data": {"written_count": 0}}])
128+
return FileUDFResult(outputs=[{"data": {"written_count": 1,
129+
"output_path": "/x"}}])
130+
""")
131+
assert unconditional_output_keys(source) == {"written_count", "output_path"}
132+
115133
def test_unparsable_source_declines(self):
116134
assert unconditional_output_keys("def broken(:") is None

0 commit comments

Comments
 (0)