[
https://issues.apache.org/jira/browse/CALCITE-1188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16324688#comment-16324688
]
Alessandro Solimando commented on CALCITE-1188:
-----------------------------------------------
I have tried to reproduce this bug but I could not, here is my attempt:
{quote} /** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-1188">[CALCITE-1188]
* NullPointerException when extract is called on a NULL date field</a>. */
@Test public void testExtractOnNullDateField(){
CalciteAssert.that()
.with(CalciteAssert.Config.FOODMART_CLONE)
.query("select extract (year from \"end_date\"), \"hire_date\",
\"birth_date\"\n" +
"from \"foodmart\".\"employee\"\n" +
"where extract (year from \"end_date\") in (1994, 1995,
1996)\n" +
"group by extract(year from \"end_date\"), \"hire_date\",
\"birth_date\" limit 10000")
.returns("");
}{quote}
All the suggested ingredients are there:
# number of items in WHERE-IN clause must be equal or more than two
# null value for _end_date_ column used in the extract (both in the select and
where clauses)
Any suggestion?
> NullPointerException in EXTRACT with WHERE ... IN clause if field has null
> value
> --------------------------------------------------------------------------------
>
> Key: CALCITE-1188
> URL: https://issues.apache.org/jira/browse/CALCITE-1188
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.7.0
> Reporter: Wei Hu
> Assignee: Julian Hyde
> Labels: newbie
>
> if there was a timestamp or date field F1, the queries below will throw
> nullpointer exception if F1 has null value
> select extract(year from F1) from T where extract(year from F1) in (2004,
> 2005)
> select extract(year from F1) , count(0) from T where extract(year from F1) in
> (2004, 2005) group by extract(year from F1)
> the number of items in WHERE-IN clause must be equal or more than two
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)