-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capture column level dependencies for CTEs and sub-queries #10319
Capture column level dependencies for CTEs and sub-queries #10319
Conversation
bf80c53
to
f816848
Compare
descriptor.getAllFields().stream(), | ||
relationType.getAllFields().stream() | ||
.filter(field -> canProcessHiddenColumn || !field.isHidden()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can we be sure that these two streams are in lock-step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added additional checks.
@@ -2035,6 +2039,13 @@ protected Scope visitAliasedRelation(AliasedRelation relation, Optional<Scope> s | |||
|
|||
RelationType descriptor = relationType.withAlias(relation.getAlias().getValue(), aliases); | |||
|
|||
boolean canProcessHiddenColumn = aliases == null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not ideal. It's relying on an internal non-obvious detail of withAlias
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one minor comment, but otherwise looks good.
core/trino-main/src/main/java/io/trino/sql/analyzer/StatementAnalyzer.java
Outdated
Show resolved
Hide resolved
Previously they weren't captured if some transformation is applied on columns referenced from CTEs or Aliased relation.
ce7c9c9
to
3444d97
Compare
Previously they weren't captured if some transformation is applied on
columns referenced from CTEs or Aliased relation.