[ 
https://issues.apache.org/jira/browse/DRILL-7342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16903995#comment-16903995
 ] 

Denys Ordynskiy commented on DRILL-7342:
----------------------------------------

*PostgreSQL* allows to create column name with spaces and select the data by 
this names.
test.csv
|text 1.1|text 2.1|
|text 1.2|text 2.2|
|text 1.3|text 2.3|

{noformat}
postgres=# CREATE TABLE "my table"("column 1" varchar(100), "column 2" 
varchar(100));
{noformat}
{noformat}
postgres=# COPY "my table" FROM '/test.csv' DELIMITERS ',' CSV;
{noformat}
{noformat}
postgres=# SELECT "column 2", "column 1" FROM "my table";
{noformat}
|{color:#14892c}*column 2*{color}|{color:#14892c}*column 1*{color}|
|text 2.1|text 1.1|
|text 2.2|text 1.2|
|text 2.3|text 1.3|

> Drill replacing spaces with underlines in the column names of text files with 
> headers
> -------------------------------------------------------------------------------------
>
>                 Key: DRILL-7342
>                 URL: https://issues.apache.org/jira/browse/DRILL-7342
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Denys Ordynskiy
>            Priority: Major
>
> Drill doesn't allow to query csvh columns with spaces.
>  *Description:*
>  Update Drill ctas format option to generate text file with header:
> {noformat}
> set `store.format` = 'csvh';
> {noformat}
> Create table with column names having spaces:
> {noformat}
> create table dfs.tmp.`csv table with spaces` (`Full Name`) as select 'James 
> Bond' from (values(1));
> {noformat}
> Drill wrote column name with space:
> {noformat}
> hadoop fs -cat '/tmp/csv table with spaces/0_0_0.csvh'
> {noformat}
> |Full Name|
> |James Bond|
> Try to query this table without column name:
> {noformat}
> select * from dfs.tmp.`csv table with spaces`;
> {noformat}
> |{color:#ff0000}*Full_Name*{color}|
> |James Bond|
> {color:#ff0000}*Drill replaced space with underline.*{color}
>  Try to select `Full Name` column with space:
> {noformat}
> select `Full Name` from dfs.tmp.`csv table with spaces`;
> {noformat}
> Drill
> |Full Name|
> | |
> When I changed space to underline, query returned the data:
> {noformat}
> select `Full_Name` from dfs.tmp.`csv table with spaces`;
> {noformat}
> |Full_Name|
> |James Bond|
> Drill can create csvh text files with spaces in the column names. But it's 
> impossible to request data using the original column name.
> *Expected result*
>  Space should be available character in the column names.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to