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

Bohdan Kazydub commented on DRILL-7336:
---------------------------------------

This option works when casting empty string as some other type, i.e. 
{{CAST(columns[0] as INT)}}. The option's description is wrong.

> `cast_empty_string_to_null` option doesn't work when text file has > 1 column
> -----------------------------------------------------------------------------
>
>                 Key: DRILL-7336
>                 URL: https://issues.apache.org/jira/browse/DRILL-7336
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Denys Ordynskiy
>            Priority: Major
>
> *Description:*
> 1 - create 2 nullable csv files with 1 and 2 columns:
> _one_col.csv_
> {noformat}
> 1
> 2
> 4
> {noformat}
> _two_col.csv_
> {noformat}
> 1,1
> 2,
> ,3
> 4,4
> {noformat}
> 2 - enable option:
> {noformat}
> alter system set `drill.exec.functions.cast_empty_string_to_null`=true;
> {noformat}
> 3 - query file with 1 column:
> {noformat}
> select columns[0] from dfs.tmp.`one_col.csv`;
> {noformat}
> | EXPR$0  |
> | 1       |
> | 2       |
> | null    |
> | 4       |
> 4 - query file with 2 columns:
> {noformat}
> select columns[0] from dfs.tmp.`two_col.csv`;
> {noformat}
> *Expected result:*
> Table with NULL in the 3-rd row:
> | EXPR$0  |
> | 1       |
> | 2       |
> | null    |
> | 4       |
> *Actual result:*
> {color:#d04437}Drill returns an empty string in the 3-rd row:{color}
> | EXPR$0  |
> | 1       |
> | 2       |
> |         |
> | 4       |



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

Reply via email to