drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Hsuan-Yi Chu (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DRILL-1874) Text reader should allow treating empty fields as NULLs instead of empty string
Date Thu, 08 Jan 2015 04:27:35 GMT

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

Sean Hsuan-Yi Chu updated DRILL-1874:
-------------------------------------
    Attachment: DRILL-1874.3.patch

This patch passed unit tests, functional and tpch

> 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: Sean Hsuan-Yi Chu
>             Fix For: 0.8.0
>
>         Attachments: DRILL-1874.1.patch, DRILL-1874.2.patch, DRILL-1874.3.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