-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
The Substrait concat function is variadic so allows more than two arguments. When converting a Substrait concat expression with three (or more) arguments to Calcite, an error occurs since Calcite's corresponding || operator only allows two operands:
java.lang.AssertionError: wrong operand count 3 for ||
at org.apache.calcite.util.Litmus.lambda$static$0(Litmus.java:31)
at org.apache.calcite.sql.SqlBinaryOperator.validRexOperands(SqlBinaryOperator.java:229)
at org.apache.calcite.rex.RexCall.<init>(RexCall.java:93)
at org.apache.calcite.rex.RexBuilder.makeCall(RexBuilder.java:293)
at org.apache.calcite.rex.RexBuilder.makeCall(RexBuilder.java:279)
at io.substrait.isthmus.expression.ExpressionRexConverter.visit(ExpressionRexConverter.java:433)
This could be resolved by modifying the expression during conversion to be nested / chained expressions, each with only two arguments. For example, concat(a, b, c) becomes concat(concat(a, b), c). This results in the expected Calcite (and SQL) output.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels