Use Proper query scope in CTE Materialization#21580
Use Proper query scope in CTE Materialization#21580jaystarshot merged 1 commit intoprestodb:masterfrom
Conversation
675369f to
af48e75
Compare
|
This same issue will happen in CteInformationCollector (wrong reference count will increase), thinking about adding a new field called actualCtePath in CTEInformation. What do you think? |
ba7d1e4 to
3129ea3
Compare
There was a problem hiding this comment.
nit: you can use putIfAbsent
There was a problem hiding this comment.
Keeping same since its better that the ++ happens only if its new
There was a problem hiding this comment.
nit: why do we convert the scope id to string?
There was a problem hiding this comment.
Just so that it is easier to debug and add tests, we can use hashCode but it becomes complicated
Observed just one more extra edge case in prod where the definition of test_cte stays constant, but test_base undergoes changes, such as referencing a different column. In this case we are still considering both ctes to be the same. |
3129ea3 to
67c1936
Compare
There was a problem hiding this comment.
typo: Defination -> Definition
67c1936 to
37d938a
Compare
Fixes #21563.
Motivation and Context
Fixes an issue with cte refereneces referencing wrong ctes (sample examples mentioned in the issue). This was causing incorrect plans.
Each reference of the cte expands the same namedQuery, hence we can fix all these issues with normalization of that named query object
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.