sql: Convert transforms to use repr types#35073
Draft
mgree wants to merge 2 commits intoMaterializeInc:mainfrom
Draft
sql: Convert transforms to use repr types#35073mgree wants to merge 2 commits intoMaterializeInc:mainfrom
mgree wants to merge 2 commits intoMaterializeInc:mainfrom
Conversation
Pre-merge checklist
|
…onstraints, predicate pushdown, redundant join, MSE::reduce, and a number of helper functions
84ba9fb to
02c81b9
Compare
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 24, 2026
…ationType analysis Partially inspired by MaterializeInc#35073
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 24, 2026
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 24, 2026
…35073) Add infrastructure: - SqlRelationType::from_repr(&ReprRelationType) in src/repr/src/relation.rs - MirRelationExpr::repr_typ() -> ReprRelationType in src/expr/src/relation.rs - MirRelationExpr::repr_typ_with_input_types(&[ReprRelationType]) in src/expr/src/relation.rs Switch the following transform files to work with ReprRelationType/ReprColumnType: - column_knowledge.rs: optimize() now takes &[ReprColumnType], all .typ() sites produce Vec<ReprColumnType>, scalar.repr_typ() for output types. - predicate_pushdown.rs: repr_typ() for nullable checks, extract_equal_or_both_null and helpers take &[ReprColumnType], uses repr_typ()/repr_typ_with_input_types throughout. - fusion/filter.rs: uses input.repr_typ().column_types directly. - join_implementation.rs: input_types is Vec<ReprRelationType> via repr_typ(), uses new_from_input_repr_types. - redundant_join.rs: same pattern as join_implementation.rs. - literal_constraints.rs: inp_typ switched to ReprRelationType, converts back to SqlRelationType only for MIR node construction (Constant, take_safely). Convert back to SqlColumnType/SqlRelationType only where structurally required (reduce() calls, MIR node construction).
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 24, 2026
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 24, 2026
Add infrastructure: - SqlRelationType::from_repr(&ReprRelationType) in src/repr/src/relation.rs - MirRelationExpr::repr_typ() -> ReprRelationType in src/expr/src/relation.rs - MirRelationExpr::repr_typ_with_input_types(&[ReprRelationType]) in src/expr/src/relation.rs Switch the following transform files to work with ReprRelationType/ReprColumnType: - column_knowledge.rs: optimize() now takes &[ReprColumnType], all .typ() sites produce Vec<ReprColumnType>, scalar.repr_typ() for output types. - predicate_pushdown.rs: repr_typ() for nullable checks, extract_equal_or_both_null and helpers take &[ReprColumnType], uses repr_typ()/repr_typ_with_input_types throughout. - fusion/filter.rs: uses input.repr_typ().column_types directly. - join_implementation.rs: input_types is Vec<ReprRelationType> via repr_typ(), uses new_from_input_repr_types. - redundant_join.rs: same pattern as join_implementation.rs. - literal_constraints.rs: inp_typ switched to ReprRelationType, converts back to SqlRelationType only for MIR node construction (Constant, take_safely). Convert back to SqlColumnType/SqlRelationType only where structurally required (reduce() calls, MIR node construction).
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 24, 2026
Add infrastructure: - SqlRelationType::from_repr(&ReprRelationType) in src/repr/src/relation.rs - MirRelationExpr::repr_typ() -> ReprRelationType in src/expr/src/relation.rs - MirRelationExpr::repr_typ_with_input_types(&[ReprRelationType]) in src/expr/src/relation.rs Switch the following transform files to work with ReprRelationType/ReprColumnType: - column_knowledge.rs: optimize() now takes &[ReprColumnType], all .typ() sites produce Vec<ReprColumnType>, scalar.repr_typ() for output types. - predicate_pushdown.rs: repr_typ() for nullable checks, extract_equal_or_both_null and helpers take &[ReprColumnType], uses repr_typ()/repr_typ_with_input_types throughout. - fusion/filter.rs: uses input.repr_typ().column_types directly. - join_implementation.rs: input_types is Vec<ReprRelationType> via repr_typ(), uses new_from_input_repr_types. - redundant_join.rs: same pattern as join_implementation.rs. - literal_constraints.rs: inp_typ switched to ReprRelationType, converts back to SqlRelationType only for MIR node construction (Constant, take_safely). Convert back to SqlColumnType/SqlRelationType only where structurally required (reduce() calls, MIR node construction).
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 25, 2026
…ationType analysis Partially inspired by MaterializeInc#35073
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 25, 2026
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 25, 2026
Add infrastructure: - SqlRelationType::from_repr(&ReprRelationType) in src/repr/src/relation.rs - MirRelationExpr::repr_typ() -> ReprRelationType in src/expr/src/relation.rs - MirRelationExpr::repr_typ_with_input_types(&[ReprRelationType]) in src/expr/src/relation.rs Switch the following transform files to work with ReprRelationType/ReprColumnType: - column_knowledge.rs: optimize() now takes &[ReprColumnType], all .typ() sites produce Vec<ReprColumnType>, scalar.repr_typ() for output types. - predicate_pushdown.rs: repr_typ() for nullable checks, extract_equal_or_both_null and helpers take &[ReprColumnType], uses repr_typ()/repr_typ_with_input_types throughout. - fusion/filter.rs: uses input.repr_typ().column_types directly. - join_implementation.rs: input_types is Vec<ReprRelationType> via repr_typ(), uses new_from_input_repr_types. - redundant_join.rs: same pattern as join_implementation.rs. - literal_constraints.rs: inp_typ switched to ReprRelationType, converts back to SqlRelationType only for MIR node construction (Constant, take_safely). Convert back to SqlColumnType/SqlRelationType only where structurally required (reduce() calls, MIR node construction).
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 26, 2026
…ationType analysis Partially inspired by MaterializeInc#35073
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 26, 2026
ggevay
added a commit
to ggevay/materialize
that referenced
this pull request
Feb 26, 2026
Add infrastructure: - SqlRelationType::from_repr(&ReprRelationType) in src/repr/src/relation.rs - MirRelationExpr::repr_typ() -> ReprRelationType in src/expr/src/relation.rs - MirRelationExpr::repr_typ_with_input_types(&[ReprRelationType]) in src/expr/src/relation.rs Switch the following transform files to work with ReprRelationType/ReprColumnType: - column_knowledge.rs: optimize() now takes &[ReprColumnType], all .typ() sites produce Vec<ReprColumnType>, scalar.repr_typ() for output types. - predicate_pushdown.rs: repr_typ() for nullable checks, extract_equal_or_both_null and helpers take &[ReprColumnType], uses repr_typ()/repr_typ_with_input_types throughout. - fusion/filter.rs: uses input.repr_typ().column_types directly. - join_implementation.rs: input_types is Vec<ReprRelationType> via repr_typ(), uses new_from_input_repr_types. - redundant_join.rs: same pattern as join_implementation.rs. - literal_constraints.rs: inp_typ switched to ReprRelationType, converts back to SqlRelationType only for MIR node construction (Constant, take_safely). Convert back to SqlColumnType/SqlRelationType only where structurally required (reduce() calls, MIR node construction).
ggevay
added a commit
that referenced
this pull request
Feb 26, 2026
… MIR structs (#35084) This is pushing on the repr types work stream. It's on top of #35067, and stealing stuff from #35073. The "Add soft_panic_or_log! canaries for repr type mismatches" commit turns some error logs into soft_panics, and the other commits attempt to make CI not run into any of these panics. Nightlies: - https://buildkite.com/materialize/nightly/builds/15255 (stale) - https://buildkite.com/materialize/nightly/builds/15259 (stale) - https://buildkite.com/materialize/nightly/builds/15260 (stale) - https://buildkite.com/materialize/nightly/builds/15296 (stale) - https://buildkite.com/materialize/nightly/builds/15337 (stale) - https://buildkite.com/materialize/nightly/builds/15346 (stale) - https://buildkite.com/materialize/nightly/builds/15350 (stale) - https://buildkite.com/materialize/nightly/builds/15351 (stale) - https://buildkite.com/materialize/nightly/builds/15355 (limited to RQGs + SLTs) - https://buildkite.com/materialize/nightly/builds/15358 (stale) - https://buildkite.com/materialize/nightly/builds/15359 (slightly stale) - https://buildkite.com/materialize/nightly/builds/15366 Release qualifications: - https://buildkite.com/materialize/release-qualification/builds/1115 (slightly stale) #35219 does some naming/cleanup that we'll keep separate (since it involves touching the `*Func` macros). --------- Co-authored-by: Michael Greenberg <michael.greenberg@materialize.com>
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.
WIP.
Motivation
#27239
Description
#35067 ensures that everyone working at the MIR level will be working with repr types either as canonical SQL types or proper repr types. This PR makes it so that (all!) transforms explicitly use repr types internally throughout, rather than moving in and out of (canonical) SQL types.
NB that some external structures---MRE, MSE, etc., AvailableCollections---will still use SQL types.
Verification
CI + nightly, with special attention during the PR process to determine when we can turn on soft panics for when we "fall back" to repr type comparisons.