Problem with multiple joins
- Dominant language
- Python
- Stars
- 14
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
We have an issue with multiple joins when many tables have identically named columns. Recall that
when we join and we have columns in each table that have the same names but are not joined on, we’re supposed to add a suffix. By default, this suffix is _x for the left table and _y for the right table
We have four tables: T1, T2, T3, T4
T1 has cols:
id
t1_attr
label
T2 has cols:
id
t2_attr
label
T3 has cols:
id
t3_attr
label
T4 has cols:
id
t4_attr
label
T1jT2 = join(T1, T2, on=‘id’)
T1jT2 has cols:
id
t1_attr
t2_attr
label_x
label_y
T1jT2jT3 = join(T1jT2, T3, on=‘id’)
T1jT2jT3 has cols:
id
t1_attr
t2_attr
t3_attr,
label_x
label_y
label
When we try to do:
T1jT2jT3jT4 = join(T1jT2jT3, T4, on=‘id’)
T1jT2jT3 and T4 both have columns called “label” so we’re supposed to make columns label_x and label_y, but T1jT2jT3 already has columns label_x and label_y from earlier, so we have a conflict.
Not that this could also conceivably happen without multiple joins if we just have unlucky column names.
I think the right thing to do is to raise an intelligent error. Otherwise, the burden is on the user to choose intelligent suffixes
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.