tkalkirill commented on code in PR #13543:
URL: https://github.com/apache/ignite/pull/13543#discussion_r3924198956
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteTableFunction.java:
##########
@@ -132,4 +145,43 @@ private static void raiseValidationError(Method method,
String errPostfix) {
throw new IgniteSQLException("Unable to create table function for
method '" + mtdSign + "'. " + errPostfix);
}
+
+ /** Returns function parameters represented as SQL types where required. */
+ private static List<FunctionParameter> sqlParameters(Method method,
List<FunctionParameter> functionParameters) {
+ var res = new ArrayList<>(functionParameters);
+
+ for (int i = 0; i < method.getParameterTypes().length; i++) {
+ if (method.getParameterTypes()[i] == byte[].class)
+ res.set(i, sqlBinaryParameter(res.get(i)));
+ }
+
+ return Collections.unmodifiableList(res);
+ }
+
+ /** Prevents Calcite from evaluating binary literals while deriving a
table function row type. */
+ private static FunctionParameter sqlBinaryParameter(FunctionParameter
delegate) {
Review Comment:
This change is only needed when a `byte[]` table-function argument is a
binary literal, for example `binaryTableLength(x'010203')`. Calcite tries to
materialize the literal as byte[] during row-type inference, before the runtime
converter is involved. Dynamic parameters and other non-literal expressions
work without this workaround.
Would you prefer that we drop binary-literal support from this fix and
address it separately if needed, or keep the workaround with an explanatory
comment and a dedicated test?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]