LiteralConverter's case ROW casts a ROW literal's value straight to List<RexLiteral>:
https://github.com/substrait-io/substrait-java/blob/main/isthmus/src/main/java/io/substrait/isthmus/expression/LiteralConverter.java#L272
RexBuilder.makeLiteral's ROW branch builds each element as fieldValue instanceof RexLiteral ? fieldValue : makeLiteral(fieldValue, fieldType, allowCast), and makeLiteral returns a RexCall (an ARRAY_VALUE_CONSTRUCTOR or MAP_VALUE_CONSTRUCTOR) for an ARRAY- or MAP-typed field. A ROW literal Calcite produced itself — from constant reduction over a struct with an array field, say — therefore has a non-literal element, and the cast fails with ClassCastException: RexCall cannot be cast to RexLiteral.
There is also no case MAP, so a MAP-typed literal reaching convert falls through to the "Unable to convert the value" default, while case ARRAY right below handles the array equivalent.
Low priority as it stands: since #1153 dropped the ROW-literal shortcut from visit(Expression.StructLiteral), nothing in this repo emits a ROW literal, so the branch is reachable only from Calcite-produced ones.
LiteralConverter'scase ROWcasts a ROW literal's value straight toList<RexLiteral>:https://github.com/substrait-io/substrait-java/blob/main/isthmus/src/main/java/io/substrait/isthmus/expression/LiteralConverter.java#L272
RexBuilder.makeLiteral's ROW branch builds each element asfieldValue instanceof RexLiteral ? fieldValue : makeLiteral(fieldValue, fieldType, allowCast), andmakeLiteralreturns aRexCall(anARRAY_VALUE_CONSTRUCTORorMAP_VALUE_CONSTRUCTOR) for an ARRAY- or MAP-typed field. A ROW literal Calcite produced itself — from constant reduction over a struct with an array field, say — therefore has a non-literal element, and the cast fails withClassCastException: RexCall cannot be cast to RexLiteral.There is also no
case MAP, so a MAP-typed literal reachingconvertfalls through to the "Unable to convert the value" default, whilecase ARRAYright below handles the array equivalent.Low priority as it stands: since #1153 dropped the ROW-literal shortcut from
visit(Expression.StructLiteral), nothing in this repo emits a ROW literal, so the branch is reachable only from Calcite-produced ones.