harelba / q

q - Run SQL directly on delimited files and multi-file sqlite databases
http://harelba.github.io/q/
GNU General Public License v3.0
10.19k stars 421 forks source link

Strange column matching issue #227

Closed materiari closed 4 years ago

materiari commented 4 years ago

I'm having an issue where q is not matching the columns in a given pair of files. This happened in Header mode and then even when I took out the headers, I got a similar issue with the generated numbered column names. -A shows the correct column list in BOTH modes. What am I missing?

F:\temp> q -A -d "|" "select x.* from x.txt x inner join y.txt on x.c2=y.c2" query error: no such column: y.c2 Table for file: x.txt c1 - int c2 - text c3 - text c4 - int c5 - text c6 - float c7 - text c8 - text c9 - text Table for file: y.txt c1 - int c2 - text c3 - text

F:\temp>head x.txt y.txt ==> x.txt <== 0|19763P598|R|1|2020-05-29|0.000599775|NA|1970-01-01|1970-01-01 0|105262836|R|1|2020-05-29|0.001988362|NA|1970-01-01|1970-01-01 0|105262869|R|1|2020-05-29|0.002160708|NA|1970-01-01|1970-01-01 0|105262885|R|1|2020-05-29|0.002847670|NA|1970-01-01|1970-01-01 0|19765L173|R|1|2020-05-29|0.001313451|NA|1970-01-01|1970-01-01 0|19765L199|R|1|2020-05-29|0.001583266|NA|1970-01-01|1970-01-01 0|19765L306|R|1|2020-05-29|0.001381168|NA|1970-01-01|1970-01-01 0|19765L645|R|1|2020-05-29|0.002344684|NA|1970-01-01|1970-01-01 0|19765L660|R|1|2020-05-29|0.001757714|NA|1970-01-01|1970-01-01 0|19765N104|R|1|2020-05-29|0.001927618|NA|1970-01-01|1970-01-01

==> y.txt <== 1359|008117AP8|008117AP8 1365|88283LHZ2|88283LHZ2 1369|419792NU6|419792NU6 1370|517845GM9|517845GM9 1371|611237BY3|611237BY3 1372|611530AW6|611530AW6 1373|00C6HH996|00C6HH996 1374|00C6H6957|00C6H6957 1375|00C6JE9V9|00C6JE9V9 1376|2546879CK|2546879CK

materiari commented 4 years ago

This example is not showing the issue we saw before. Let me find a better one and open a new case.