Closed Berkmann18 closed 5 years ago
This seems like a delimiter issue. For historical reasons, q's default delimiter is not a tab, but a space.
if your file is tab delimited, then just use -t
or -d $'\t'
as a parameter, in order to tell q that it's a tab delimited file.
One important way to analyze the column/type inference of q is to run it with -A
, which shows the structure that it has detected on the data files.
Ah awesome, thank you.
I'm trying to get some statistical data out of a TSV file but no matter if I use
c1
and the like or the name of the columns it seems that it can't find the column when specifying the names and it doesn't return the correct row.Example 0
q "SELECT c1 FROM WCA_export_Results.tsv"
:Expected
Actual
Example 1
q "SELECT competitionId FROM WCA_export_Results.tsv"
:Expected
Actual
Example 2
SELECT * FROM WCA_export_Results.tsv WHERE c1 = 'LyonOpen2007'
:Expected
Actual
FYI, I'm firstly trying to use a more complex query such as
SELECT COUNT(personId) FROM WCA_export_Results.tsv WHERE competitionId = 'Lyon2007'"
(which obviously fails). Then I'll see how I could go about getting the average number of competitors per year per country.Environment
ArchLinux 4.18.16.a-1-hardened x86_64
1.7.1-1
yaourt