Skip to content

Commit fd37864

Browse files
rustyconoverclaude
andcommitted
sum_all_columns: reject all-non-numeric input at bind time
The fixture's on_bind() silently filtered non-numeric columns out of the output schema. If the input had NO numeric columns the output schema was empty — bind succeeded with zero columns, then the query crashed downstream with an internal-assertion failure when DuckDB encountered a zero-column scan. Now raise ValueError with a clear message identifying which input columns were present and their types. Bind fails cleanly; the user sees a real error. Surfaced by the buffered_table bench (scripts/bench_buffered_table.py) which tried to push 1KB VARCHAR values through sum_all_columns — incompatible by design but previously crashed instead of erroring. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e64992a commit fd37864

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎vgi/_test_fixtures/table_in_out.py‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,14 @@ def cardinality(cls, params: BindParams[SumAllColumnsFunctionArguments]) -> Tabl
454454

455455
@classmethod
456456
def on_bind(cls, params: BindParams[SumAllColumnsFunctionArguments]) -> BindResponse:
457-
"""Produce the output schema with only numeric columns."""
457+
"""Produce the output schema with only numeric columns.
458+
459+
Raises ValueError if the input has zero numeric (integer or float)
460+
columns. The function has nothing to sum in that case and would
461+
otherwise produce an empty output schema, which crashes downstream
462+
operators with an internal assertion. Reject loudly at bind time
463+
instead so the user sees a clear "no numeric columns" error.
464+
"""
458465
assert params.bind_call.input_schema is not None
459466
output_fields: dict[str, pa.DataType] = {}
460467
for field in params.bind_call.input_schema:
@@ -467,6 +474,15 @@ def on_bind(cls, params: BindParams[SumAllColumnsFunctionArguments]) -> BindResp
467474
continue
468475
output_fields[field.name] = out_type
469476

477+
if not output_fields:
478+
input_summary = ", ".join(
479+
f"{f.name}: {f.type}" for f in params.bind_call.input_schema
480+
)
481+
raise ValueError(
482+
"sum_all_columns requires at least one numeric (integer or "
483+
"float) input column, got [" + input_summary + "]"
484+
)
485+
470486
return BindResponse(output_schema=schema(output_fields))
471487

472488
@staticmethod

0 commit comments

Comments
 (0)