Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
Currently, when deserialize a RexNode fails, calcite returns a null value, causing NPE in somewhere else. So we cannot get any information about the SqlOperator in the stacktrace. This makes it hard to determine the reason when deserialize a very long json string.
Caused by: java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:203) at org.apache.calcite.rel.core.AggregateCall.<init>(AggregateCall.java:98) at org.apache.calcite.rel.core.AggregateCall.create(AggregateCall.java:198) at org.apache.calcite.rel.externalize.RelJsonReader.toAggCall(RelJsonReader.java:289) at org.apache.calcite.rel.externalize.RelJsonReader.access$500(RelJsonReader.java:59) at org.apache.calcite.rel.externalize.RelJsonReader$2.getAggregateCalls(RelJsonReader.java:172) at org.apache.calcite.rel.core.Aggregate.<init>(Aggregate.java:220) at org.apache.calcite.rel.logical.LogicalAggregate.<init>(LogicalAggregate.java:105) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.rel.externalize.RelJsonReader.readRel(RelJsonReader.java:264) at org.apache.calcite.rel.externalize.RelJsonReader.readRels(RelJsonReader.java:91) at org.apache.calcite.rel.externalize.RelJsonReader.read(RelJsonReader.java:85) at org.apache.calcite.plan.RelWriterTest.lambda$deserializeAndDumpToTextFormat$6(RelWriterTest.java:894) at org.apache.calcite.tools.Frameworks.lambda$withPlanner$0(Frameworks.java:131) at org.apache.calcite.prepare.CalcitePrepareImpl.perform(CalcitePrepareImpl.java:914) at org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:180) ... 67 more
Maybe it's better to throw exception instead of return null, adding the name, kind, and syntax in the error message
Attachments
Issue Links
- is fixed by
-
CALCITE-4199 Add nullability annotations to the methods and fields, ensure consistency with checkerframework
- Closed
- links to