[repr types] Fallback to repr type checks before failing#34958
Merged
mgree merged 8 commits intoMaterializeInc:mainfrom Feb 10, 2026
Merged
[repr types] Fallback to repr type checks before failing#34958mgree merged 8 commits intoMaterializeInc:mainfrom
mgree merged 8 commits intoMaterializeInc:mainfrom
Conversation
889b157 to
49786cd
Compare
Contributor
|
For the test fails:
|
ggevay
approved these changes
Feb 9, 2026
src/expr/src/scalar.rs
Outdated
| && e1 | ||
| .typ(column_types) | ||
| .union(&e2.typ(column_types)) | ||
| .sql_union(&e2.typ(column_types)) |
Contributor
There was a problem hiding this comment.
Here and the below two changed calls, why not try_union? I think the important thing for these calls (see code comment above) is to match typ's handling of If, which does a proper repr union, not a sql_union.
Contributor
Author
There was a problem hiding this comment.
Good catch, thank you! I found two more instances in there. I thought I got all these... I must have not saved properly or something.
I'll trigger another nightly run including the relevant tests (sqllogictest with and without multiple replicas, testdrives) and then merge.
3235085 to
3785218
Compare
This was referenced Feb 12, 2026
mgree
added a commit
that referenced
this pull request
Feb 13, 2026
This PR combines two bugfixes to give the best fix, allowing for multireplica tests. ### Motivation #34966 fixes an SLT test from #34905 that broke in nightly when run with multiple replicas. The fix there is better than the fix I put in #34958, which forces the test to only run in single replica mode. ### Description Takes the `singlereplica_` out of the name, so we'll actually run multi-replica tests. ### Verification Running appropriate 4-replica slt tests from nightly.
This was referenced Feb 13, 2026
ggevay
pushed a commit
that referenced
this pull request
Feb 13, 2026
) ### Motivation #34958 removed many possible panics; #35003 sussed out another. ### Description We should only panic when types well and truly don't match---if SQL types don't align but repr types do, there is no possibility of runtime error. ### Verification Nightly, baby! This failure got sussed out by #35003, which pushes repr types into many new locations---it is likely not a reachable failure in the existing code.
ggevay
pushed a commit
that referenced
this pull request
Feb 13, 2026
### Motivation #27239 ### Description Changes `MirRelationExpr::typ()` to actually do repr type inference, not SQL type. While it still returns a SQL type (to be fixed in a later PR), it's a _canonical_ SQL type, obtained by mapping repr types back up to SQL types. This draft PR is on top of #35005, which should merge first. ### Verification Currently WIP. Will with nightly that #34958 successfully avoids all panics.
def-
added a commit
to def-/materialize
that referenced
this pull request
Feb 17, 2026
…erializeInc#34958)" This reverts commit 201dcae.
patrickwwbutler
pushed a commit
to patrickwwbutler/materialize
that referenced
this pull request
Feb 19, 2026
…Inc#34958) Recent ([reverted]()) changes to [`ColumnKnowledge`]() and [`enable_cast_elimination`]() tickled some assertions we have in our code that assume we will have SQL typechecking at the MIR level. This PR relaxes those checks to try for repr typing as a fallback, using `tracing::error!` to notify when this fallback occurs (so we can track it in Sentry). There were two places these checks were happening: - In `SqlColumnType::union`, which was frequently `.unwrap()`ed. - In an assertion for `normalize_lets`. Scanning through 1055 assertions in the `expr`, `repr`, `sql`, and `transform` crates found no others, nor were the 42 uses of `base_eq` across the codebase suspect. ### Motivation * This PR fixes a recognized bug. MaterializeInc/database-issues#10045 MaterializeInc/database-issues#10046 MaterializeInc/database-issues#10052
patrickwwbutler
pushed a commit
to patrickwwbutler/materialize
that referenced
this pull request
Feb 19, 2026
…nc#34991) This PR combines two bugfixes to give the best fix, allowing for multireplica tests. ### Motivation MaterializeInc#34966 fixes an SLT test from MaterializeInc#34905 that broke in nightly when run with multiple replicas. The fix there is better than the fix I put in MaterializeInc#34958, which forces the test to only run in single replica mode. ### Description Takes the `singlereplica_` out of the name, so we'll actually run multi-replica tests. ### Verification Running appropriate 4-replica slt tests from nightly.
patrickwwbutler
pushed a commit
to patrickwwbutler/materialize
that referenced
this pull request
Feb 19, 2026
…erializeInc#35005) ### Motivation MaterializeInc#34958 removed many possible panics; MaterializeInc#35003 sussed out another. ### Description We should only panic when types well and truly don't match---if SQL types don't align but repr types do, there is no possibility of runtime error. ### Verification Nightly, baby! This failure got sussed out by MaterializeInc#35003, which pushes repr types into many new locations---it is likely not a reachable failure in the existing code.
patrickwwbutler
pushed a commit
to patrickwwbutler/materialize
that referenced
this pull request
Feb 19, 2026
…c#35003) ### Motivation MaterializeInc#27239 ### Description Changes `MirRelationExpr::typ()` to actually do repr type inference, not SQL type. While it still returns a SQL type (to be fixed in a later PR), it's a _canonical_ SQL type, obtained by mapping repr types back up to SQL types. This draft PR is on top of MaterializeInc#35005, which should merge first. ### Verification Currently WIP. Will with nightly that MaterializeInc#34958 successfully avoids all panics.
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.
Recent (reverted) changes to
ColumnKnowledgeandenable_cast_eliminationtickled some assertions we have in our code that assume we will have SQL typechecking at the MIR level. This PR relaxes those checks to try for repr typing as a fallback, usingtracing::error!to notify when this fallback occurs (so we can track it in Sentry).There were two places these checks were happening:
SqlColumnType::union, which was frequently.unwrap()ed.normalize_lets.Scanning through 1055 assertions in the
expr,repr,sql, andtransformcrates found no others, nor were the 42 uses ofbase_eqacross the codebase suspect.Motivation
https://github.com/MaterializeInc/database-issues/issues/10045
https://github.com/MaterializeInc/database-issues/issues/10046
https://github.com/MaterializeInc/database-issues/issues/10052
Checklist
$T ⇔ Proto$Tmapping (possibly in a backwards-incompatible way), then it is tagged with aT-protolabel.