block.comment("Call input function with unpacked Block arguments");
Class<?>[] parameters = inputFunction.getParameterTypes();
int inputChannel = 0;
for (int i = 0; i < parameters.length; i++) {
ParameterMetadata parameterMetadata = parameterMetadatas.get(i);
switch (parameterMetadata.getParameterType()) {
case STATE:
block.pushThis().getField(stateField);
break;
case BLOCK_INDEX:
block.getVariable(position);
break;
case SAMPLE_WEIGHT:
checkNotNull(sampleWeight, "sampleWeight is null");
block.getVariable(sampleWeight);
break;
case NULLABLE_INPUT_CHANNEL:
block.getVariable(parameterVariables.get(inputChannel));
inputChannel++;
break;
case INPUT_CHANNEL:
Block getBlockByteCode = new Block(context)
.getVariable(parameterVariables.get(inputChannel));
pushStackType(block, parameterMetadata.getSqlType(), getBlockByteCode, parameters[i], callSiteBinder);
inputChannel++;
break;
default:
throw new IllegalArgumentException("Unsupported parameter type: " + parameterMetadata.getParameterType());
}
}
block.invokeStatic(inputFunction);
return block;