use of com.hazelcast.jet.sql.impl.schema.HazelcastTableFunctionParameter in project hazelcast by hazelcast.
the class HazelcastOperandTypeInference method inferOperandTypes.
@Override
public void inferOperandTypes(SqlCallBinding callBinding, RelDataType returnType, RelDataType[] operandTypes) {
SqlCall call = callBinding.getCall();
if (ValidationUtil.hasAssignment(call)) {
RelDataTypeFactory typeFactory = callBinding.getTypeFactory();
RelDataType[] parameterTypes = new RelDataType[parametersByName.size()];
for (int i = 0; i < call.operandCount(); i++) {
SqlCall assignment = call.operand(i);
SqlIdentifier id = assignment.operand(1);
String name = id.getSimple();
HazelcastTableFunctionParameter parameter = parametersByName.get(name);
if (parameter != null) {
SqlTypeName parameterType = parameter.type();
parameterTypes[parameter.ordinal()] = toType(parameterType, typeFactory);
} else {
throw SqlUtil.newContextException(id.getParserPosition(), RESOURCE.unknownArgumentName(name));
}
}
// noinspection ResultOfMethodCallIgnored
Arrays.stream(parameterTypes).filter(Objects::nonNull).toArray(ignored -> operandTypes);
} else {
positionalOperandTypeInference.inferOperandTypes(callBinding, returnType, operandTypes);
}
}
Aggregations