Evgeny Stanilovsky created CALCITE-5969:
-------------------------------------------

             Summary: 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


LITERAL_AGG was introduced in [1] and seems not correctly serialized, 
discussion [2]
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}


[1] https://issues.apache.org/jira/browse/CALCITE-4334
[2] https://lists.apache.org/thread/hhzw05b1h7y8ht3qpccth4yld3q2zc2o



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

Reply via email to