drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Khurram Faraaz <kfar...@maprtech.com>
Subject Re: Question related to handling of nulls in csv
Date Wed, 24 Aug 2016 15:53:47 GMT
There are two things you need to take care of in your example,

1. you should tell Drill skip the header from your CSV file. (add
skipFirstLine into your storage plugin)
2. you are doing a sum over string data (varchar), so you will need to cast
your data in column "c" to integer before you do the aggregate like this,
select sum(cast(c as integer)) from dfs.tmp.`test_drill.csv`


On Wed, Aug 24, 2016 at 7:46 PM, Sandeep Dugar <sdugar@gainsight.com> wrote:

> Hi,
>
> I am trying to understand the behavior while handling nulls.
>
> I have a csv file where the last column is integer values and has nulls for
> few rows. When I run an aggregation function like sum on that column I am
> getting UNSUPPORTED_OPERATION ERROR.
>
> Any pointers or links would be great. Thanks in advance!
>
> Here is the sample:
>
> 0: jdbc:drill:zk=local> select * from dfs.tmp.`test_drill.csv`;
> 'a','b','c'
> 'what','where','5'
> 'this','that','10'
> 'here','now',''
> 'go','there',''
> 'today','tomorrow','6'
> 5 rows selected (0.451 seconds)
>
> 0: jdbc:drill:zk=local> select sum(c) from dfs.tmp.`test_drill.csv`;
> Error: UNSUPPORTED_OPERATION ERROR: Only COUNT, MIN and MAX aggregate
> functions supported for VarChar type
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message