Ruben Q L created CALCITE-5967:
----------------------------------
Summary: UnsupportedOperationException while implementing call
that requires a special collator
Key: CALCITE-5967
URL: https://issues.apache.org/jira/browse/CALCITE-5967
Project: Calcite
Issue Type: Bug
Components: core
Reporter: Ruben Q L
Assignee: Ruben Q L
Fix For: 1.36.0
Regression introduced by a minor change within CALCITE-5914, detected while
testing a downstream project with the latest Calcite main.
CALCITE-5914 (see
[2a96512c|https://github.com/apache/calcite/commit/2a96512c352bda4a5d9c0c80730f5c115ac363d6])
introduced this apparently innocuous change in
{{RexImpTable#AbstractRexCallImplementor#unboxIfNecessary}}:
{code}
// old
argValueList.stream()
.map(AbstractRexCallImplementor::unboxExpression)
.collect(Collectors.toList());
=>
// new
Util.transform(argValueList,
AbstractRexCallImplementor::unboxExpression);
{code}
Both expressions seem equivalent, however there is a subtle difference: the old
one returns an {{ArrayList}} (where we can add new elements); wheres 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:
{code}
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!
}
...
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)