drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacques Nadeau (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DRILL-1874) Text reader should allow treating empty fields as NULLs instead of empty string
Date Sun, 04 Jan 2015 23:58:16 GMT

     [ https://issues.apache.org/jira/browse/DRILL-1874?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jacques Nadeau updated DRILL-1874:
----------------------------------
    Issue Type: Improvement  (was: Bug)

> Text reader should allow treating empty fields as NULLs instead of empty string
> -------------------------------------------------------------------------------
>
>                 Key: DRILL-1874
>                 URL: https://issues.apache.org/jira/browse/DRILL-1874
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Storage - Text & CSV
>    Affects Versions: 0.7.0
>            Reporter: Aman Sinha
>            Assignee: Aman Sinha
>             Fix For: 0.8.0
>
>         Attachments: DRILL-1874.1.patch
>
>
> The text reader treats a record as a repeated varchar and if there is an empty field
it produces an empty string.   This prevents CASTing the field to a numeric type because one
can get a NumberFormatException.   This is a pain point for many use cases because empty fields
occur frequently in text files. 
> Ideally, based on some configuration setting, we should allow treating empty fields as
NULL values instead of empty string.  This will allow cast to work correctly.  
> In the meantime, here's a rewrite that can be used as workaround:   
> {code}
> 0: jdbc:drill:zk=local> select case when columns[17] = '' then cast(null as int) else
cast(columns[17] as int) end  from dfs.tmp.`sample2.tbl`;
> +------------+
> |   EXPR$0   |
> +------------+
> | 5          |
> | null       |
> +------------+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message