I have a table with ids as 2 different columns. I have another table which contains objects associated with the ids. I would like filter out the ids from the table2 for which id exists in either id1 or id2 in Table 1.
Table 1:
| id1 | id2 |
| 1 | 1 |
| 1 | 1 |
| 1 | 3 |
| 2 | 5 |
| 3 | 1 |
| 3 | 2 |
| 3 | 3 |
Table 2:
| id | obj |
| 1 | 'A' |
| 2 | 'B' |
| 3 | 'C' |
| 4 | 'D' |
| 5 | 'E' |
| 6 | 'F' |
| 7 | 'G' |
What I am thinking is to create out a list from table1 containing the unique ids which will be [1, 2, 3, 5] from above example.
Then filter out the data frame on the basis of the list, which will give the result.
| id | obj |
| 1 | 'A' |
| 2 | 'B' |
| 3 | 'C' |
| 5 | 'E' |
Though I have concerns regarding the scalability of the solution. The list can be large and it may even fail to load into memory for some cases. Any recommendations here in this case?
Thanks.