[
https://issues.apache.org/jira/browse/CALCITE-1770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16003202#comment-16003202
]
Julian Hyde edited comment on CALCITE-1770 at 5/9/17 6:09 PM:
--------------------------------------------------------------
Regarding treatment of nulls. I totally agree with Jesus. Let's treat nulls
strictly in Calcite (and Hive) and deliver SQL semantics despite Druid's
different behavior. Who knows, one day Druid may be able to store nulls and
will implement 3-valued logic.
I believe that this fix is consistent with SQL semantics (i.e. the query will
return 0 rows because {{product_id = null}} always yields {{UNKNOWN}}). If I'm
wrong let's re-open the case.
By the way, CALCITE-815 would add an option that treats empty strings as null
values (basically, converts them to null values on the fly) but still retains
3-valued logic. Thus {{'' = 'a'}} returns UNKNOWN. It even affects type
derivation: the return type of {{SUBSTRING(x FROM y FOR z)}} is {{VARCHAR\(n)
NOT NULL}}, but with {{emptyStringIsNull=true}}, its type is {{VARCHAR\(n)}}
because it can return an empty string which would become NULL.
was (Author: julianhyde):
Regarding treatment of nulls. I totally agree with Jesus. Let's treat nulls
strictly in Calcite (and Hive) and deliver SQL semantics despite Druid's
different behavior. Who knows, one day Druid may be able to store nulls and
will implement 3-valued logic.
I believe that this fix is consistent with SQL semantics (i.e. the query will
return 0 rows because {{product_id = null}} always yields {{UNKNOWN}}). If I'm
wrong let's re-open the case.
By the way, CALCITE-815 would add an option that treats empty strings as null
values (basically, converts them to null values on the fly) but still retains
3-valued logic. Thus {{'' = 'a'}} returns UNKNOWN. It even affects type
derivation: the return type of {{SUBSTRING(x FROM y FOR z)}} is {{VARCHAR(n)
NOT NULL}}, but with {{emptyStringIsNull=true}}, its type is {{VARCHAR(n)}}
because it can return an empty string which would become NULL.
> Filters with Null fail with NPE
> -------------------------------
>
> Key: CALCITE-1770
> URL: https://issues.apache.org/jira/browse/CALCITE-1770
> Project: Calcite
> Issue Type: Bug
> Components: druid
> Reporter: slim bouguerra
> Assignee: Julian Hyde
> Fix For: 1.13.0
>
>
> Following query fails with NPE
> {code} SELECT product_id from foodmart where product_id = NULL group by
> product_id {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)