Search code examples
parquetapache-drill

ClassCastException: org.apache.drill.exec.expr.holders.NullableDateHolder cannot be cast to org.apache.drill.exec.expr.holders.DateHolder


This exception gives me Drill v. 1.16 when trying to query a parquet with WHERE clause on Date field.

select * FROM dfs.test."my/parquet/directory"
where "Date" >= '2019-11-01'
limit 10;

ClassCastException: org.apache.drill.exec.expr.holders.NullableDateHolder cannot be cast to org.apache.drill.exec.expr.holders.DateHolder

Details:

select min("Date") as min, max("Date") as max
FROM dfs.test."my/parquet/directory";
---
min,max
2017-02-03,2019-12-05
select distinct sqltypeof("Date") as test
FROM dfs.test."my/parquet/directory";
---
test
DATE

After couple hours of debugging I found out that when I set drill.exec.functions.cast_empty_string_to_null to FALSE, this starts to work. But I cannot let this option be FALSE.

Am I doing something wrong?


Solution

  • Found a workaround:

    WHERE "Date" >= DATE_ADD('2019-11-01', 0) 
    

    It's hideous but it fixes the behavior. If you find better way, share it.

    -- UPDATE

    Still broken. Applies to versions 1.16, 1.17, 1.19