diff --git a/src/repr/src/optimize.rs b/src/repr/src/optimize.rs index 120082fdb380f..b7780cfac34fd 100644 --- a/src/repr/src/optimize.rs +++ b/src/repr/src/optimize.rs @@ -123,8 +123,6 @@ optimizer_feature_flags!({ // See the feature flag of the same name. enable_projection_pushdown_after_relation_cse: bool, // See the feature flag of the same name. - enable_let_prefix_extraction: bool, - // See the feature flag of the same name. enable_less_reduce_in_eqprop: bool, }); diff --git a/src/sql/src/plan/statement/ddl.rs b/src/sql/src/plan/statement/ddl.rs index 94c879873d565..94a6cb4397e04 100644 --- a/src/sql/src/plan/statement/ddl.rs +++ b/src/sql/src/plan/statement/ddl.rs @@ -4653,7 +4653,6 @@ pub fn unplan_create_cluster( enable_reduce_reduction: _, enable_join_prioritize_arranged, enable_projection_pushdown_after_relation_cse, - enable_let_prefix_extraction: _, enable_less_reduce_in_eqprop: _, } = optimizer_feature_overrides; // The ones from above that don't occur below are not wired up to cluster features. diff --git a/src/sql/src/plan/statement/dml.rs b/src/sql/src/plan/statement/dml.rs index 8d1803184ef84..0060dc174df7c 100644 --- a/src/sql/src/plan/statement/dml.rs +++ b/src/sql/src/plan/statement/dml.rs @@ -434,7 +434,6 @@ impl TryFrom for ExplainConfig { enable_join_prioritize_arranged: v.enable_join_prioritize_arranged, enable_projection_pushdown_after_relation_cse: v .enable_projection_pushdown_after_relation_cse, - enable_let_prefix_extraction: Default::default(), enable_less_reduce_in_eqprop: Default::default(), }, }) diff --git a/src/sql/src/session/vars/definitions.rs b/src/sql/src/session/vars/definitions.rs index 2cf57c970524a..20e78eee7261c 100644 --- a/src/sql/src/session/vars/definitions.rs +++ b/src/sql/src/session/vars/definitions.rs @@ -1785,12 +1785,6 @@ macro_rules! feature_flags { } feature_flags!( - { - name: enable_let_prefix_extraction, - desc: "Enables hoisting of loop-invariant CTE bindindgs", - default: true, - enable_for_item_parsing: false, - }, // Gates for other feature flags { name: allow_real_time_recency, @@ -2233,7 +2227,6 @@ impl From<&super::SystemVars> for OptimizerFeatures { enable_join_prioritize_arranged: vars.enable_join_prioritize_arranged(), enable_projection_pushdown_after_relation_cse: vars .enable_projection_pushdown_after_relation_cse(), - enable_let_prefix_extraction: vars.enable_let_prefix_extraction(), enable_less_reduce_in_eqprop: vars.enable_less_reduce_in_eqprop(), } } diff --git a/src/transform/src/normalize_lets.rs b/src/transform/src/normalize_lets.rs index 89924bba97b06..71e85e4331893 100644 --- a/src/transform/src/normalize_lets.rs +++ b/src/transform/src/normalize_lets.rs @@ -132,32 +132,6 @@ impl NormalizeLets { // A final bottom-up traversal to normalize the shape of nested LetRec blocks relation.try_visit_mut_post(&mut |relation| -> Result<(), RecursionLimitError> { - if !features.enable_let_prefix_extraction { - // Disassemble `LetRec` into a `Let` stack if possible. - // If a `LetRec` remains, return the would-be `Let` bindings to it. - // This is to maintain `LetRec`-freedom for `LetRec`-free expressions. - let mut bindings = let_motion::harvest_non_recursive(relation); - if let MirRelationExpr::LetRec { - ids, - values, - limits, - body: _, - } = relation - { - bindings.extend(ids.drain(..).zip(values.drain(..).zip(limits.drain(..)))); - support::replace_bindings_from_map(bindings, ids, values, limits); - } else { - for (id, (value, max_iter)) in bindings.into_iter().rev() { - assert_none!(max_iter); - *relation = MirRelationExpr::Let { - id, - value: Box::new(value), - body: Box::new(relation.take_dangerous()), - }; - } - } - } - // Move a non-recursive suffix of bindings from the end of the LetRec // to the LetRec body. // This is unsafe when applied to expressions which contain `ArrangeBy`, @@ -189,20 +163,18 @@ impl NormalizeLets { } } - if features.enable_let_prefix_extraction { - // Extract `Let` prefixes from `LetRec`, to reveal their non-recursive nature. - // This assists with hoisting e.g. arrangements out of `LetRec` blocks, a thing - // we don't promise to do, but it can be helpful to do. This also exposes more - // AST nodes to non-`LetRec` analyses, which don't always have parity with `LetRec`. - let bindings = let_motion::harvest_non_recursive(relation); - for (id, (value, max_iter)) in bindings.into_iter().rev() { - assert_none!(max_iter); - *relation = MirRelationExpr::Let { - id, - value: Box::new(value), - body: Box::new(relation.take_dangerous()), - }; - } + // Extract `Let` prefixes from `LetRec`, to reveal their non-recursive nature. + // This assists with hoisting e.g. arrangements out of `LetRec` blocks, a thing + // we don't promise to do, but it can be helpful to do. This also exposes more + // AST nodes to non-`LetRec` analyses, which don't always have parity with `LetRec`. + let bindings = let_motion::harvest_non_recursive(relation); + for (id, (value, max_iter)) in bindings.into_iter().rev() { + assert_none!(max_iter); + *relation = MirRelationExpr::Let { + id, + value: Box::new(value), + body: Box::new(relation.take_dangerous()), + }; } Ok(()) diff --git a/src/transform/tests/test_transforms.rs b/src/transform/tests/test_transforms.rs index 25b8387c6968e..f4cbb2f6237e8 100644 --- a/src/transform/tests/test_transforms.rs +++ b/src/transform/tests/test_transforms.rs @@ -260,7 +260,6 @@ fn apply_transform( let mut features = mz_repr::optimize::OptimizerFeatures::default(); // Apply a non-default feature flag to test the right implementation. features.enable_letrec_fixpoint_analysis = true; - features.enable_let_prefix_extraction = true; let typecheck_ctx = mz_transform::typecheck::empty_context(); let mut df_meta = DataflowMetainfo::default(); let mut transform_ctx =