BurntSushi / xsv

A fast CSV command line toolkit written in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`xsv join --cross` shouldn't require columns to match

scooter-dangle opened this issue · comments

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.

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.