Repository navigation
Commit b02a467
arguments: reject SQL NULL for non-Optional Args at bind time
Passing `NULL` as a non-vararg argument to a VGI table function was
silently propagating past validation and crashing in user
process()/update() code with an opaque Python TypeError, e.g.::
SELECT * FROM example.main.sequence(NULL);
-- TypeError: '<=' not supported between instances of 'NoneType' and 'int'
The C++ extension surfaces that as a generic VGI worker exception
without a hint at the cause. The same trap fires for any numeric arg
under any constraint (positional or named, with or without ge/le)
because the worker does not advertise nullability of its arguments
and the framework's Arg validation explicitly skips None values
(it would itself TypeError if it tried to compare).
Add a small `_accepts_none(annotated_inner_type)` helper that returns
True iff the user's declared type is `T | None` / `Optional[T]` /
`Union[T, ..., None]`, and call it from `_parse_arguments` to raise a
structured `ArgumentValidationError` ("Argument ... cannot be NULL")
before reaching `_validate`. Users that want to accept SQL NULL can
opt in by declaring the field as `Annotated[int | None, Arg(...)]` —
the existing skip-validation-for-None path keeps working for those.
Varargs are intentionally left as-is: callers opt into varargs
explicitly and may want to inspect the raw pa.Scalar entries
(including null scalars), which is the existing behavior of
constant_columns.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b77ce27 commit b02a467
2 files changed
Lines changed: 63 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
194 | 196 | | |
195 | 197 | | |
196 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
197 | 218 | | |
198 | 219 | | |
199 | 220 | | |
| |||
1077 | 1098 | | |
1078 | 1099 | | |
1079 | 1100 | | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
1080 | 1124 | | |
1081 | 1125 | | |
1082 | 1126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
| |||
476 | 484 | | |
477 | 485 | | |
478 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
479 | 496 | | |
480 | | - | |
| 497 | + | |
481 | 498 | | |
482 | 499 | | |
483 | 500 | | |
| |||
0 commit comments