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

mlr join feature request: if --lk is empty keep all left fields #1439

Closed
aborruso opened this issue Dec 10, 2023 · 3 comments
Closed

mlr join feature request: if --lk is empty keep all left fields #1439

aborruso opened this issue Dec 10, 2023 · 3 comments

Comments

@aborruso
Copy link
Contributor

aborruso commented Dec 10, 2023

Hi @johnkerl ,
a lot of time I use join only to filter one input file. It could be the left one.
I am not interested in carrying anything from the right file, but just using it as a filter.

In SQL is the classic

SELECT staff-department.*
FROM staff-department
JOIN staff-info ON staff-department.id = staff-info.id;

What about adding it to join verb?

It could be the --lk: if it is empty keep all left fields.
This way I will not be forced to write down the names of the fields I want to keep.

Thank you

@johnkerl johnkerl changed the title join feature request: if --lk is empty keep all left fields mlr join feature request: if --lk is empty keep all left fields Dec 11, 2023
@johnkerl
Copy link
Owner

@aborruso I believe this already exists -- ?

$ cat a.csv
N,S,T,U
1,a,b,c
2,d,e,f
3,g,h,i

$ cat b.csv
N,X,Y,Z
1,l,m,n
2,o,p,q
3,r,s,t

$ mlr --csv join -j N -f a.csv b.csv
N,S,T,U,X,Y,Z
1,a,b,c,l,m,n
2,d,e,f,o,p,q
3,g,h,i,r,s,t

$ mlr --csv join -j N --lk N -f a.csv b.csv
N,X,Y,Z
1,l,m,n
2,o,p,q
3,r,s,t

$ mlr --csv join -j N --lk "" -f a.csv b.csv
N,X,Y,Z
1,l,m,n
2,o,p,q
3,r,s,t

@johnkerl
Copy link
Owner

@aborruso I'll add a note to the online help for mlr join

@aborruso
Copy link
Contributor Author

@aborruso I'll add a note to the online help for mlr join

These last few issues of mine were all wrong, sorry.

But please add it, because I had no idea that if no field indicated, only the left ones would remain.
I had not even tested it, because I had taken the documentation literally.

Thank you very much

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

No branches or pull requests

2 participants