Skip to content
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

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

Praveen2112
Copy link
Member

Previously they weren't captured if some transformation is applied on
columns referenced from CTEs or Aliased relation.

Comment on lines 2044 to 2046
descriptor.getAllFields().stream(),
relationType.getAllFields().stream()
.filter(field -> canProcessHiddenColumn || !field.isHidden()),
Copy link
Contributor

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?

Copy link
Member Author

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;
Copy link
Member

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.

Copy link
Contributor

@ksobolew ksobolew left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@martint martint left a 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.

Previously they weren't captured if some transformation is applied on
columns referenced from CTEs or Aliased relation.
@Praveen2112 Praveen2112 force-pushed the praveen/lineage/bug_fix_1 branch from ce7c9c9 to 3444d97 Compare December 19, 2021 10:13
@Praveen2112 Praveen2112 merged commit 087dc9f into trinodb:master Dec 20, 2021
@github-actions github-actions bot added this to the 367 milestone Dec 20, 2021
@Praveen2112 Praveen2112 mentioned this pull request Dec 22, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants