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

xsv join --cross shouldn't require columns to match #339

Open
scooter-dangle opened this issue Feb 16, 2024 · 1 comment
Open

xsv join --cross shouldn't require columns to match #339

scooter-dangle opened this issue Feb 16, 2024 · 1 comment

Comments

@scooter-dangle
Copy link

I assumed based on the help that I could use xsv join --cross - some-data.csv - (echo new_field\n0 | psub) (in fish, hence the psub for process substitution…same issue if I write to a file) to add an entry of 0 for new_field to all the rows in some-data.csv, since a cross join is doing a cartesian product rather than matching up specific columns.

xsv however complains if the number of columns specified don't match or if the columns specified are not the same name, even though that's not required for a cartesian product.

@scooter-dangle
Copy link
Author

Ah…I see I can just supply 1 as the columns for both inputs so that it 'joins' on the first column (i.e., xsv join --cross 1 some-data.csv 1 (echo new_field\n0 | psub) works). Is that actually being used by the logic or is it just required for the CLI args to be validated?

If it's the latter, I might open a PR to mention that usage note in the CLI doc string.

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

No branches or pull requests

1 participant