Reject record UDT pairs whose leaf counts differ - #591
Open
eriknw wants to merge 2 commits into
Open
Conversation
eriknw
marked this pull request as ready for review
August 4, 2026 16:07
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
from
August 4, 2026 16:12
7d55403 to
d4c4481
Compare
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
from
August 5, 2026 00:06
d4c4481 to
0bd9607
Compare
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
2 times, most recently
from
August 5, 2026 17:44
479c26c to
563b80a
Compare
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
from
August 5, 2026 18:03
563b80a to
123b148
Compare
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
2 times, most recently
from
August 6, 2026 07:59
683dcc9 to
ec062f1
Compare
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
from
August 6, 2026 15:39
ec062f1 to
b8e797f
Compare
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
from
August 6, 2026 15:41
b8e797f to
17bc219
Compare
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
from
August 6, 2026 20:36
17bc219 to
da41e30
Compare
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
from
August 6, 2026 20:42
da41e30 to
15b9955
Compare
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
from
August 7, 2026 02:48
15b9955 to
02464a8
Compare
`_check_udt_pair` rejects two record operands that disagree on shape, but it
compared only top-level field names. Two records can share those and still
nest differently: `[("a", f8), ("b", f8)]` against
`[("a", [("n1", f8), ("n2", f8)]), ("b", f8)]` both report fields
`["a", "b"]` while contributing two leaves and three. The codegen walks one
operand's leaf paths and applies them to both, so applying the scalar path
`["a"]` to the nested side asks Numba to add a float to a record.
Measured before this change, that pair gets through the checks and comes
back from Numba's typing pass as:
UdfParseError: binary.plus does not work with (_NestFlat, _NestDeep):
No implementation of function Function(<built-in function add>) found
for signature: >>> add(float64, Record(nst_n1[type=float64;offset=0],
nst_n2[type=float64;offset=8];16;False))
That reports a compile failure for what is the same shape disagreement the
three sibling checks in the same function already report as a KeyError.
Comparing leaf counts makes it the fourth of those checks.
The exception class changes, and that is visible in both directions:
UdfParseError derives from GraphblasException, not from KeyError, so code
catching KeyError to mean "no such op" now catches this pair, and code
catching UdfParseError no longer does. `OpBase.__contains__` catches both,
so `udt in binary.plus` is unaffected either way.
eriknw
force-pushed
the
11-udt-record-leaf-count
branch
from
August 7, 2026 05:09
02464a8 to
2f6fb4d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_check_udt_pairrejects two record operands that disagree on shape, but itcompared only top-level field names. Two records can share those and still
nest differently:
[("a", f8), ("b", f8)]against[("a", [("n1", f8), ("n2", f8)]), ("b", f8)]both report fields["a", "b"]while contributing two leaves and three. The codegen walks oneoperand's leaf paths and applies them to both, so applying the scalar path
["a"]to the nested side asks Numba to add a float to a record.Measured before this change, that pair gets through the checks and comes
back from Numba's typing pass as:
That reports a compile failure for what is the same shape disagreement the
three sibling checks in the same function already report as a KeyError.
Comparing leaf counts makes it the fourth of those checks.
The exception class changes, and that is visible in both directions:
UdfParseError derives from GraphblasException, not from KeyError, so code
catching KeyError to mean "no such op" now catches this pair, and code
catching UdfParseError no longer does.
OpBase.__contains__catches both,so
udt in binary.plusis unaffected either way.Stack created with GitHub Stacks CLI • Give Feedback 💬