Skip to content

[CALCITE-7914] RelDecorrelator produces wrong results for non-deterministic inputs - #5385

Open
zzwqqq wants to merge 12 commits into
apache:mainfrom
zzwqqq:fix-decorrelation-volatility
Open

zzwqqq wants to merge 12 commits into
apache:mainfrom
zzwqqq:fix-decorrelation-volatility

Conversation

@zzwqqq

@zzwqqq zzwqqq commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Jira Link

CALCITE-7914

Changes Proposed

RelDecorrelator can recompute a non-deterministic correlation key and lose the subquery result when joining it back. It can also incorrectly share a non-deterministic inner result between outer rows with equal bindings.

The fix is to check determinism before extracting expressions or sharing inputs. For the general rewrite, the check covers the rebuilt right input, including any copied outer inputs. Unused expressions can be trimmed locally before retrying the checks. Trimming leaves correlation inputs unchanged.

RelDecorrelator.decorrelateQuery
├─ Scalar rules: removeCorrelationViaRule
│  ├─ [Added] Check the right input for determinism before sharing it
│  ├─ [Changed] Check scalar source via CorrelationReferences.isUncorrelated
│  └─ If either check fails:
│     └─ [Added] trimRightInput -> RelFieldTrimmer.trimPreservingBindings
│        └─ Re-submit only if the right input changed and is deterministic
└─ Remaining Correlates: decorrelate
   ├─ [Changed] CorrelateProjectExtractor
   │  └─ Extract deterministic expressions; keep fields still referenced
   └─ decorrelateRel(Correlate, ...)
      ├─ Build the new right input
      ├─ [Added] Check its determinism, including copied outer inputs
      │  └─ On failure: trimPreservingBindings -> recheck
      └─ [Added] Reject if CorrelationReferences.mayUse finds a possible
                 reference to the binding being removed

Both trimming sites use the new RelFieldTrimmer.trimPreservingBindings, which also preserves the trimmed subtree's output fields.

The checks use the new RelOptUtil.isDeterministic and CorrelationReferences analyses. Existing rule patterns and uniqueness checks still apply. If no safe rewrite applies, the Correlate is retained.

* The checked input must also be the input used by the rewrite.
*/
private RelNode prepareCorrelates(RelNode root) {
final RelNode prepared = root.accept(new RelHomogeneousShuttle() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shuttle looks important enough to be in its own class with proper javadoc.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've removed the preparation shuttle. The scalar rules and general rewrite now trim their right inputs locally.

RelNode right = correlate.getRight();
if (!isDeterministic(right)) {
final RelBuilder trimBuilder = relBuilderFactory().create(right.getCluster(), null);
final RelNode trimmed = new RelFieldTrimmer(null, trimBuilder).trim(right);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the best way to do it?
How about trimming fields in a global pass before you even start the decorrelation?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I tried global trimming before decorrelation, but it removed a key needed by the scalar uniqueness check. I've kept trimming local to the RHS to preserve it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a bug in the trimmer. Maybe you need to file an issue?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my earlier explanation was incomplete: Using RelFieldTrimmer.trim on the whole plan before decorrelation can remove a key that is unused by the query but needed by the scalar uniqueness check. trimPreservingBindings leaves the Correlate's left input unchanged, so that key is preserved.

However, applying trimPreservingBindings globally can remove the Project below a SINGLE_VALUE aggregate, preventing the scalar rule from eliminating that aggregate. I'd prefer to keep trimming local in this PR. Does that sound good?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I understand your explanation. If the trimmer converts valid queries to valid queries, there is no trimmer bug. Bug you are saying: "a key that is unused by the query but needed by the scalar uniqueness check". This suggests that there are valid queries that the "scalar uniqueness check" cannot correctly analyze.

In principle any analysis should be able to handle any well-formed query; if it cannot, it's a bug in that analysis.

These comments are not really related to your PR, which I haven't yet re-reviewed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. I should have been clearer: the query result is unchanged, but we lose the opportunity to apply this scalar rewrite. Running ordinary RelFieldTrimmer.trim first can remove an unused key and leave the outer rows non-unique. The uniqueness check then skips the rewrite as expected.

return rel;
}
// Trimming can also remove references to the correlation variable.
final ImmutableBitSet requiredColumns =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this functionality be part of the trimmer?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The cleanup now uses RelFieldTrimmer.trimPreservingBindings, keeping binding inputs intact so references need no remapping. CorrelateProjectExtractor updates dependencies after extraction; default trimming is unchanged.

.build();
if (!isDeterministic(projected)) {
// Only values and row-producing operations needed by the parameter
// domain are repeated. Unused volatile projections need not prevent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does "volatile" mean "non-deterministic"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've corrected the wording.

* Ordinary table scans assume stable contents within a query; unknown
* operators are not assumed deterministic.
*/
private boolean isDeterministic(RelNode rel) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a very useful function. This should be public someplace so other passes can reuse it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But again, as we discussed elsewhere, there are two kinds of determinism: RAND() and NOW(). The latter can actually be duplicated. That problem still hasn't been fixed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've exposed it as RelOptUtil.isDeterministic(RelNode). It follows the existing SqlOperator.isDeterministic() declarations: query-stable CURRENT_TIMESTAMP is allowed, while RAND() is rejected.

|| rel instanceof Snapshot
|| rel instanceof Collect
|| rel instanceof Uncollect)) {
return false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a strange way to do it.
I would think that these all return true, and the default is 'false'. It's easier to understand.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, changed as suggested.

!if (use_old_decorr) {
EnumerableValues(tuples=[[]])
EnumerableCalc(expr#0..1=[{inputs}], SAL=[$t0])
EnumerableCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{}])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain this change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing. That plan change was unintended. I've removed the global trimming pass and restored the original empty Values plan.

@zzwqqq
zzwqqq marked this pull request as draft November 4, 2026 08:58
@zzwqqq
zzwqqq force-pushed the fix-decorrelation-volatility branch 2 times, most recently from 4904722 to d20108b Compare November 8, 2026 03:40
@zzwqqq
zzwqqq marked this pull request as ready for review November 8, 2026 03:43

@mihaibudiu mihaibudiu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only left a few superficial comments.

This is a very complicated change. It could benefit from a high-level description of the strategy employed. The way I imagine I may approach this is by rewriting queries to segregate non-deterministic computations only to appear in some specific query operators (e.g., project) to simplify the job of the decorrelator.



!if (use_old_decorr) {
# Test case for [CALCITE-7914] Correlation keys must use the values already

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically [CALCITE-7914] is always followed by the issue title.
The description of the test can come next.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please describe how the results were validated.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've updated the test comments. I've verified the results in postgresql https://onecompiler.com/postgresql/458u9g9gc

* deterministic according to their operator declarations.
*
* <p>Assumes parameters, correlation bindings, query context and table contents
* stay fixed within the query. Function calls use

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does it mean "they stay fixed"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've removed that wording. The definition now says that a deterministic call returns the same result for the same operands within one query execution.

*
* <p>Input order must also be stable where it affects the result. This method
* does not establish that property, for example for an unordered FETCH.
* It does not trim fields or modify the expression.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would it modify the expression? It is supposed to be a read-only analysis.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The sentence is redundant. I've removed it.

}

/** Returns whether a relational expression, its inputs and sub-queries are
* deterministic according to their operator declarations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, you need to describe what non-deterministic means, or @link to its definition.
We agreed there are multiple possible definitions.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've added the definition and a link to SqlOperator.isDeterministic().

return false;
}

/** Visits a supported node's expression fields for read-only analysis.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applies a Shuttle to the expression fields of a Rel node (but not to its inputs)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It visits the node's expression fields, but not its relational inputs. The returned expressions are not applied to the node. I've clarified the Javadoc.

if (other instanceof Correlate
&& ((Correlate) other).getCorrelationId().equals(corrId)) {
return other;
/** Applies the visitor within the specified correlation scope. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this notion of a "correlation scope" defined?
If not, maybe you can define it here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've defined the scope here: the part of root where id refers to a binding outside root. References to nested bindings with the same id are excluded.


/**
* A collector of simply correlated row expressions.
/** Selects outermost deterministic computations over one correlation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens to the selected ones? How are they represented?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Each selected expression is stored in a Map<RexNode, Integer>. The integer is its offset among the fields added to the left input. A Project computes those fields. Selected occurrences in the right input are replaced with RexFieldAccess references to the new fields. I've documented this in the Javadoc.


import java.util.Set;

/** Conservatively analyzes references to correlation bindings outside a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the result of the analysis?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The analysis records whether outer bindings may be referenced and which declared fields may still be needed. The class Javadoc now states these results; each method documents its own return value.

}

/** Trims the right input, preserving its output fields and the left input.
* Submits an equivalent Correlate if the plan changes and the trimmed right

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does it submit the correlate?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. It goes to the rule's planner via RelOptRuleCall.transformTo. I've added that to the Javadoc.

final Frame frame = dispatcher.invoke(r, isCorVarDefined, parentPropagatesNullValues);
final Frame frame;
if (!(r instanceof Correlate) && !r.getVariablesSet().isEmpty()) {
// Local bindings need their own field remapping. Only the Correlate

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this comment relates to the code.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guard skips nodes that define correlation variables, except Correlate. Decorrelation can change the positions of their input fields. References through those variables are not remapped, so they could still use the old positions. Returning null prevents this rewrite. I've made the comment clearer.

@zzwqqq
zzwqqq force-pushed the fix-decorrelation-volatility branch from d5ddd67 to d275c16 Compare November 11, 2026 06:24
@zzwqqq

zzwqqq commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

I only left a few superficial comments.

This is a very complicated change. It could benefit from a high-level description of the strategy employed. The way I imagine I may approach this is by rewriting queries to segregate non-deterministic computations only to appear in some specific query operators (e.g., project) to simplify the job of the decorrelator.

Thanks for the review. I've added a strategy overview to the PR description.

I tried a small prototype based on your suggestion, covering Filter and INNER JOIN conditions. It let the determinism scan skip those operators' conditions, but added a normalization pass and still needed the shared expression visitor for correlation analysis. I haven't found an overall simplification in this prototype, so I'd lean toward keeping the current approach for this PR. Curious what you think.

@mihaibudiu

Copy link
Copy Markdown
Contributor

Since I am not an expert in the decorrelator implementation I have used an agent to perform a review. I am trying to understand the feedback and post it here.

@mihaibudiu

Copy link
Copy Markdown
Contributor

The agent review complains about the fact that there are some query operators which are also in essence non-deterministic, but which are not functions, e.g., LIMIT without ORDER BY. But I think that should be in the scope of a different issue.

@mihaibudiu

Copy link
Copy Markdown
Contributor

The agent also found the following counterexample:

select count(*) from (values 1) as t(k),
  lateral (select a.x from <1000 rows> where a.x + t.k > 0) as s
where rand() < 0.5

The plan moves the filter into the left input. RAND() then runs once per outer row, not once per joined row, so the query keeps all 1,000 rows or none:

EnumerableCorrelate(correlation=[$cor0], joinType=[inner], ...)
  EnumerableCalc(expr#1=[RAND()], ..., $condition=[$t3])   -- the filter, now below the Correlate
    EnumerableValues(tuples=[[{ 1 }]])

The cause is FilterCorrelateRule, which the decorrelator runs before it decorrelates. The rule only refuses conjuncts that contain a correlation variable. It does not refuse non-deterministic ones, as FilterJoinRule does.

Here the PR refuses to decorrelate, because the copied left input now contains RAND(), and keeps the Correlate. But decorrelate() returns the plan that the early rules already changed. So "keep the Correlate" does not mean "keep the original plan".

Suggested changes for the non-deterministic part:

Fix FilterCorrelateRule: skip non-deterministic conjuncts, as FilterJoinRule does. Add T1 as a test. A RAND() count is random, so the test should check the plan: the RAND() filter must stay above the Correlate.

Optional: the PR keeps the whole Correlate when any part of the inner input is non-deterministic. In T4, the RAND() projection could run after the join back, and the rest could still be decorrelated. This is an optimization, not a correctness issue.
FilterProjectTransposeRule also has no determinism check, and the decorrelator runs it too. It is also in Calcite's default Volcano rule set, so that is a general rule bug, not part of this PR.

@zzwqqq

zzwqqq commented Nov 15, 2026

Copy link
Copy Markdown
Member Author

The agent also found the following counterexample:

select count(*) from (values 1) as t(k),
  lateral (select a.x from <1000 rows> where a.x + t.k > 0) as s
where rand() < 0.5

The plan moves the filter into the left input. RAND() then runs once per outer row, not once per joined row, so the query keeps all 1,000 rows or none:

EnumerableCorrelate(correlation=[$cor0], joinType=[inner], ...)
  EnumerableCalc(expr#1=[RAND()], ..., $condition=[$t3])   -- the filter, now below the Correlate
    EnumerableValues(tuples=[[{ 1 }]])

The cause is FilterCorrelateRule, which the decorrelator runs before it decorrelates. The rule only refuses conjuncts that contain a correlation variable. It does not refuse non-deterministic ones, as FilterJoinRule does.

Here the PR refuses to decorrelate, because the copied left input now contains RAND(), and keeps the Correlate. But decorrelate() returns the plan that the early rules already changed. So "keep the Correlate" does not mean "keep the original plan".

Suggested changes for the non-deterministic part:

Fix FilterCorrelateRule: skip non-deterministic conjuncts, as FilterJoinRule does. Add T1 as a test. A RAND() count is random, so the test should check the plan: the RAND() filter must stay above the Correlate.

Optional: the PR keeps the whole Correlate when any part of the inner input is non-deterministic. In T4, the RAND() projection could run after the join back, and the rest could still be decorrelated. This is an optimization, not a correctness issue. FilterProjectTransposeRule also has no determinism check, and the decorrelator runs it too. It is also in Calcite's default Volcano rule set, so that is a general rule bug, not part of this PR.

Thanks for catching this. I've updated FilterCorrelateRule to skip non-deterministic conjuncts and added a plan test based on your example.

@sonarqubecloud

Copy link
Copy Markdown

* visitor. A supported operator may have no expressions to visit. Exceptions
* thrown by the visitor are propagated.
* <p>The shuttle controls visits to expression children and sub-query plans.
* Rewritten expressions are ignored. An expression may be visited more than once.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean "rewritten expressions are ignored"?
Who ignores them?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This method discards any replacements produced by the shuttle. I've clarified that in the Javadoc.

* @param visitor Visitor used for read-only analysis
* @return Whether the operator family is supported; true after visiting its
* expression fields, false without invoking the visitor
* @return True if this method can visit expressions for the node type, even

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"for the node type" -- what node type?
Maybe "kind"?
Moreover, there is no "node", only a "rel".
"type" means many things.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've used rel and kind in the return description.

/** Applies the visitor within the scope of an outer correlation binding.
*
* <p>The scope is the part of {@code root} where {@code id} refers to the
* binding defined outside {@code root}. References to nested bindings

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never understood this business about nested bindings with the same id. I think these should be illegal plans. The plans are complicated enough as it is. We should use alpha-renaming if there is a confusion about reused names.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that distinct IDs for distinct bindings would simplify the analysis. This PR preserves the existing IDs and scope handling in findInputRel. CALCITE-7753 also covers nested Correlates reusing an ID. I think alpha-renaming would be a very worthwhile improvement.

/** Selects outermost deterministic computations over one correlation.
/** Selects deterministic expressions for evaluation on the outer input.
*
* <p>The collector stores each selected {@link RexNode} with its offset among

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the collector?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. collector is a CorrelatedExpressionSelector whose selected method records the expression in expressions and returns it unchanged. I've documented the map's offsets beside its declaration.

*
* <p>The collector stores each selected {@link RexNode} with its offset among
* the fields added to the left input. A Project computes these fields.
* The replacement visitor replaces their uses on the right with

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the replacement visitor?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I meant replacements, the CorrelatedExpressionSelector used to rewrite the right input. Its selected method replaces each selected expression with a RexFieldAccess pointing to the corresponding field on the left.

* The replacement visitor replaces their uses on the right with
* {@link RexFieldAccess} references.
*
* <p>Selected expressions go to {@link #selected(RexNode)} without visiting

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be part of the JavaDoc of "selected".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Moved to selected. It receives an expression chosen for extraction and returns the expression to use at that position. Its subexpressions are not selected separately.

*
* <p>Selected expressions go to {@link #selected(RexNode)} without visiting
* their operands. Other calls have their operands checked separately.
* Lambda bodies and sub-query plans are skipped. A complete call containing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is a "complete call"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've removed “complete call” and clarified the boundary. The selector searches lambda bodies, but does not extract expressions containing lambda parameter references, following the behavior on main.

* <p>Records whether outer bindings may be referenced and which declared
* fields may still be needed.
*
* <p>A local binding hides the outer binding with the same id in its scope.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comment above. But perhaps this is unavoidable if this is the normal behavior of many passes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This analysis follows the existing binding scopes. With unique binding IDs, the same-ID shadowing checks would no longer be needed.

@mihaibudiu

Copy link
Copy Markdown
Contributor

Please also rebase this on main. I will submit also an agent-generated review.

@mihaibudiu mihaibudiu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An agent thinks that this PR is sound (and clearly an improvement over main), so I am approving, but I think readability can still be improved.

@zzwqqq
zzwqqq force-pushed the fix-decorrelation-volatility branch from 098cfc5 to 44dce06 Compare November 18, 2026 07:55
@zzwqqq

zzwqqq commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

Please also rebase this on main. I will submit also an agent-generated review.

Thanks. I've rebased on main. This PR skipped lambda bodies, which conflicted with CALCITE-7933. I removed that restriction and kept main's check for lambda parameter references.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants