Repository navigation
[query] BindingEnv.createAgg/createScan leave the other scope alone - #15910
Conversation
createAgg copied eval into agg but also emptied scan; createScan
emptied agg. So creating both scopes, binding in each as you go,
loses the first scope's bindings:
env.createAgg.bindAgg(x -> t).createScan
before: agg = Some({}), scan = Some(eval)
after: agg = Some({x: t}), scan = Some(eval)
extend's AggEnv.Create already copies eval and leaves the other scope
alone. createAgg and createScan now do the same.
This change does not affect batch.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
🟢 Approval recommended
The two targeted changes match the intended scope-preservation behavior, with no unresolved findings.
No open issues 🎉
What changed in this PR
This PR fixes query binding-environment scope creation so creating an aggregation or scan scope no longer clears bindings in the other scope.
Changes:
createAggcopies evaluation bindings into the aggregation scope while preserving the scan scope.createScancopies evaluation bindings into the scan scope while preserving the aggregation scope, matching existingextendbehavior.
| File | Description |
|---|---|
hail/hail/src/is/hail/expr/ir/Env.scala |
Preserves the other scope’s bindings during aggregation and scan scope creation. |
Review effort: Balanced
patrick-schultz
left a comment
There was a problem hiding this comment.
I was nervous about the change in semantics, so had claude do some digging. Looks like the clearing behavior was introduced in #9041, to fix bugs where environments were merged with incompatible agg/scan environments (one None, one Some). But it looks like this now has no behavior change for any caller, and I agree it is conceptually correct. Good simplification!
createAgg copied eval into agg but also emptied scan; createScan emptied agg. So creating both scopes, binding in each as you go, loses the first scope's bindings:
extend's AggEnv.Create already copies eval and leaves the other scope alone. createAgg and createScan now do the same.
This change does not affect batch.