I believe the issue you are encountering is due to the spaces in the header fields.
To verify this hypothesis, try this query (Note the spaces and back ticks in the field names): SELECT `ID `, `NOMBRE ` FROM <your file> The easy fix is to remove the spaces in the header. > On Sep 28, 2016, at 11:43, jose antonio <[email protected]> wrote: > > Hello all, > > Yesterday a asked the same on > http://stackoverflow.com/questions/39720337/how-can-i-do-a-query-on-a-csv-file-using-the-header-file-with-apache-drill. > I found out that if a do a query of type > select * from dfs.*`path_to_file*/clientes.csv` > > > with this csv > > ID, NOMBRE, APELLIDOS, PROVINCIA > 12121212, MARIA, LIONZA, MADRID > 12312312, JAIMITO, PEREZ, ALMERÍA > 13131313, BRUNO, DIAZ, MALAGA > 23423423, HARLEY, QUINN, BARCELONA > > > I could see the result as a table where every column has their own name > according to the header values present on the csv file, but if a do a query > specifying the column name then I just get the field empty except the ID, > p.e. > > select ID, NOMBRE from dfs.*`path_to_file*/clientes.csv` > then I get > > | ID | NOMBRE | > | 12121212 | | > | 12312312 | | > | 13131313 | | > | 23423423 | | > > > why does it work for the ID value but it doesn't for the rest of > column like NOMBRE, APELLIDOS, PROVINCIA? > > Also I updated the dfs plugin and add extractHeader to true, for the csv > format. > > Thanks in advance > > -- > José Antonio Rodríguez > Ing. de Sistemas ULA - Mérida
