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

Julian Hyde updated CALCITE-5969:
---------------------------------
    Fix Version/s: 1.38.0

> LITERAL_AGG erroneously assembled after deserialization
> -------------------------------------------------------
>
>                 Key: CALCITE-5969
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5969
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.35.0
>            Reporter: Evgeny Stanilovsky
>            Priority: Major
>             Fix For: 1.38.0
>
>
> {{LITERAL_AGG}} was introduced in CALCITE-4334 and seems not correctly 
> serialized (see 
> [discussion|https://lists.apache.org/thread/hhzw05b1h7y8ht3qpccth4yld3q2zc2o]).
> Briefly, serialization call for 
> {{toJson(org.apache.calcite.rel.core.AggregateCall)}} not stores 
> {{org.apache.calcite.rel.core.AggregateCall#rexList}} which need for further 
> correct assembly:
> {code:java}
> RelJsonReader#toAggCall(Map<String, Object> jsonAggCall) {
>     ... cut ...
>     return AggregateCall.create(aggregation, distinct, false, false,
>         ImmutableList.of(), <-- empty list
>         operands,
>         filterOperand == null ? -1 : filterOperand,
>         null, RelCollations.EMPTY, type, name);
> }
> {code}
> So assertion is raised :
> {code:java}
>   private static RelDataType inferReturnType(SqlOperatorBinding opBinding) {
>     // LITERAL_AGG takes one pre-operand and zero (post-)operands.
>     if (opBinding.getPreOperandCount() != 1
>         || opBinding.getOperandCount() != 1) {
>       throw new AssertionError(); <-- brings this assertion
>     }
>     return opBinding.getOperandType(0);
>   }
> {code}



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

Reply via email to