You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SPARK-40149][SQL][FOLLOWUP] Avoid adding extra Project in AddMetadataColumns
### What changes were proposed in this pull request?
This PR is a follow-up for #37758. It updates the rule `AddMetadataColumns` to avoid introducing extra `Project`.
### Why are the changes needed?
To fix an issue introduced by #37758.
```sql
-- t1: [key, value] t2: [key, value]
select t1.key, t2.key from t1 full outer join t2 using (key)
```
Before this PR, the rule `AddMetadataColumns` will add a new Project between the using join and the select list:
```
Project [key, key]
+- Project [key, key, key, key] <--- extra project
+- Project [coalesce(key, key) AS key, value, value, key, key]
+- Join FullOuter, (key = key)
:- LocalRelation <empty>, [key#0, value#0]
+- LocalRelation <empty>, [key#0, value#0]
```
After this PR, this extra Project will be removed.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Add a new UT.
Closes#39895 from allisonwang-db/spark-40149-follow-up.
Authored-by: allisonwang-db <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
0 commit comments