Skip to content

HIVE-29616: Fix incorrect column lineage when multiple subqueries with identical table aliases#6485

Open
ljq-dmr wants to merge 1 commit into
apache:masterfrom
ljq-dmr:HIVE-29616
Open

HIVE-29616: Fix incorrect column lineage when multiple subqueries with identical table aliases#6485
ljq-dmr wants to merge 1 commit into
apache:masterfrom
ljq-dmr:HIVE-29616

Conversation

@ljq-dmr
Copy link
Copy Markdown

@ljq-dmr ljq-dmr commented May 14, 2026

What changes were proposed in this pull request?

lineage column Predicate baseCols

Why are the changes needed?

The logic in ExprProcFactory#findSourceColumn resolves source columns from TopOps by matching table and field aliases. If a match is found, it returns the result directly. This implementation fails in scenarios involving multiple subqueries with identical table aliases (e.g., in a UNION statement). Because the search returns the first match it encounters, it may link to the wrong source column from a different subquery branch, leading to incorrect lineage

Does this PR introduce any user-facing change?

No

How was this patch tested?

mvn test -Pitests -pl itests/qtest -Dtest=TestMiniLlapLocalCliDriver -Dqfile=lineage8.q

@sonarqubecloud
Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants