Rework tuple projection algorithm#15668
Merged
Merged
Conversation
This was referenced Jul 24, 2026
Member
|
💚 💙 💜 💛 ❤️ |
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.
The previous algorithm had a flawed basis, which was creating errors (different representations of the same type gave different results, see issues #15606 and #15491). This addresses both of them.
I added the regressions found in the issues and their respective PRs (#15492 and #15607) into this, thanks a lot @lukaszsamson!
This PR fixes the flaws in the algorithm, along with an explanation of the correct theoretical basis (the inverse image of insertion-- see this pdf that gives a high level math description. This approach will be useful for future similar problems
tuple_delete_at_issue_short.pdf
Other things:
tuple_split_negative_pairs_indextotuple_project_negative_pairs, since the function is not splitting anything but projecting each negative into a value/remainder pair to eliminate itA bit of a big thing: now,
tuple_take_elementdoes not return optional types. So we can get rid of field types completely in the tuple projection computations and useopt_(union|intersection|difference)instead of thefield_*operations.After I do the same modifications to map projection, it will compound and more uses of
field_*should be removed.Since I added a few comments, this PR removes 7 locs of program code.