[6.0.1] Query: Update table references in pushdown after moving table references to subquery #26700
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.
Doing so causes all table references to maintain referential integrity again, which is required in processing projections in certain scenarios
Resolves #26587
Description
Pushing down a select expression in subquery causes it to transfer table references to subquery which causes intermediate phase where the referential integrity of select expression graph is violated. Processing of projection requires the graph to be consistent. We made the graph consistent again but after processing the projection so this can cause exception if projection runs some code which requires consistent graph.
Customer impact
Customer queries involving GroupBy which has aggregate applied on it and using grouping key in aggregate, if it gets pushed down (which can happen due to Skip/Take operators, joining it with other queries or other kind of composition), then it will throw exception.
How found
Customer reported on RTM package
Regression
Yes.
Testing
Added tests for the root cause scenario and also for the customer scenario.
Risk
Low. We are doing same processing as before just little early. Also added quirk to revert to previous behavior.