[ 
https://issues.apache.org/jira/browse/CALCITE-6374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hongyu guo resolved CALCITE-6374.
---------------------------------
    Fix Version/s: 1.38.0
         Assignee:  EveyWu
       Resolution: Fixed

Fixed in 
[1beb5ff|https://github.com/apache/calcite/commit/1beb5ff26699fcbe6eef3da7c9fce654e170aedb].


Thanks [~eveywu] and [~allendang].

> LatticeSuggester throw NullPointerException when agg call covered with cast 
> ----------------------------------------------------------------------------
>
>                 Key: CALCITE-6374
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6374
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: allendang
>            Assignee:  EveyWu
>            Priority: Critical
>              Labels: pull-request-available
>             Fix For: 1.38.0
>
>
> I changed {color:#de350b}q1{color} in 
> {color:#4c9aff}org.apache.calcite.materialize.LatticeSuggesterTest#testExpressionEvolution{color}
> It was originally like this
> {code:java}
> select
>   "num_children_at_home" + 10 as "n10",
>   "num_children_at_home" + 14 as "n14",
>   sum("num_children_at_home" + 12) as "n12",
>   sum("num_children_at_home" + 13) as "n13"
> from "customer"
> group by "num_children_at_home" + 10,   "num_children_at_home" + 14 {code}
> i changed it like following
> {code:java}
> select
>   "num_children_at_home" + 10 as "n10",
>   "num_children_at_home" + 14 as "n14",
>   cast(sum("num_children_at_home" + 12) as double) as "n12",
>   sum("num_children_at_home" + 13) as "n13"
> from "customer"
> group by "num_children_at_home" + 10,   "num_children_at_home" + 14 {code}
> Re-running the test case throws the following exception
> {code:java}
> measure.name
> java.lang.NullPointerException: measure.name
>     at java.util.Objects.requireNonNull(Objects.java:228)
>     at 
> org.apache.calcite.materialize.LatticeSuggester.deriveAlias(LatticeSuggester.java:290)
>     at 
> org.apache.calcite.materialize.LatticeSuggester.lambda$addFrame$3(LatticeSuggester.java:250)
>     at org.apache.calcite.util.Util$TransformingList.get(Util.java:2810)
>     at java.util.AbstractList$Itr.next(AbstractList.java:358)
>     at java.util.AbstractCollection.toArray(AbstractCollection.java:141)
>     at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:265)
>     at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:238)
>     at org.apache.calcite.materialize.Lattice$Measure.<init>(Lattice.java:567)
>     at 
> org.apache.calcite.materialize.LatticeSuggester.addFrame(LatticeSuggester.java:240)
>  
>     at 
> org.apache.calcite.materialize.LatticeSuggester.lambda$addQuery$1(LatticeSuggester.java:143)
>     at java.util.ArrayList.forEach(ArrayList.java:1259)
>     at 
> org.apache.calcite.materialize.LatticeSuggester.addQuery(LatticeSuggester.java:143)
>     at 
> org.apache.calcite.materialize.LatticeSuggesterTest$Tester.addQuery(LatticeSuggesterTest.java:851)
>     at 
> org.apache.calcite.materialize.LatticeSuggesterTest.testExpressionEvolution(LatticeSuggesterTest.java:551){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to