[
https://issues.apache.org/jira/browse/CALCITE-6374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
allendang updated CALCITE-6374:
-------------------------------
Description:
I changed {color:#de350b}q1{color} in
{color:#4c9aff}org.apache.calcite.materialize.LatticeSuggesterTest#testExpressionEvolution{color}
Like the following
{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}
Wrap it up with cast
{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}
was:
org.apache.calcite.materialize.LatticeSuggesterTest#testExpressionEvolution
final String q1 = "select\n"
+ " \"num_children_at_home\" + 10 as \"n10\",\n"
+ " \"num_children_at_home\" + 14 as \"n14\",\n"
+ " cast(sum(\"num_children_at_home\" + 12) as double) as \"n12\",\n"
+ " sum(\"num_children_at_home\" + 13) as \"n13\"\n"
+ "from \"customer\"\n"
+ "group by \"num_children_at_home\" + 10,"
+ " \"num_children_at_home\" + 14";
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)
> 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
> Priority: Critical
> Attachments: image-2024-04-18-21-44-04-262.png
>
>
> I changed {color:#de350b}q1{color} in
> {color:#4c9aff}org.apache.calcite.materialize.LatticeSuggesterTest#testExpressionEvolution{color}
>
> Like the following
> {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}
>
>
> Wrap it up with cast
>
> {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)