A SQL level null is different than a null at the JAVA level that would be
giving this exception (we don't represent nulls with an actual null java
object). There might be a way to work around it, but this is a bug in
Drill. You should be able to make a cast between compatible types even if
there are nulls in the dataset.

Could you open a JIRA and put as much description about your data and query
as possible? If you have the time to create a small repro, loading an Hbase
table with a small set of data that produces the problem that would be very
helpful. In any case, whatever you can provide will be useful the dev who
picks up the JIRA.

On Thu, Sep 10, 2015 at 12:49 PM, Christopher Matta <[email protected]> wrote:

> Does changing the query to something like this work?:
>
> SELECT CAST(CASE WHEN table.cf.myColumn IS NOT NULL THEN
> table.cf.myColumn ELSE NULL END as INTEGER)
> ...
>
> ​
>
> Chris Matta
> [email protected]
> 215-701-3146
>
> On Thu, Sep 10, 2015 at 12:49 PM, Nathaniel Auvil <
> [email protected]
> > wrote:
>
> > i have a MaprDB table which has nulls for some of the columns.  When i
> > create a select where i CAST(table.cf.myColumn as INTEGER) and there are
> > nulls instead of simply returning null for the value, there is a
> > NullPointerException.
> >
> > Why not simply return null for the value if it is missing from a row?
> >
>

Reply via email to