Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Regression introduced by a minor change within CALCITE-5914, detected while testing a downstream project with the latest Calcite main.
CALCITE-5914 (see 2a96512c) introduced this apparently innocuous change in RexImpTable#AbstractRexCallImplementor#unboxIfNecessary:
// old argValueList.stream() .map(AbstractRexCallImplementor::unboxExpression) .collect(Collectors.toList()); => // new Util.transform(argValueList, AbstractRexCallImplementor::unboxExpression);
Both expressions seem equivalent, however there is a subtle difference: the old one returns an ArrayList (where we can add new elements); whereas the new one returns a TransformingList that extends AbstractList and that does not support List#add.
After calling unboxIfNecessary, we might need to modify the argument list if we need a special collator to perform the operation:
private ParameterExpression genValueStatement(...) { ... optimizedArgValueList = unboxIfNecessary(optimizedArgValueList); final Expression callValue = implementSafe(translator, call, optimizedArgValueList); ... } @Override Expression implementSafe(...) { ... final Expression fieldComparator = generateCollatorExpression(relDataType0.getCollation()); if (fieldComparator != null) { argValueList.add(fieldComparator); // <--- UnsupportedOperationException! } ...
Attachments
Issue Links
- is caused by
-
CALCITE-5914 Cache compiled regular expressions in SQL function runtime
- Closed
- is related to
-
CALCITE-3951 Support different string comparison based on SqlCollation
- Closed
- links to