private static Annotation baseTypeAnnotation(Annotation[] annotations, String methodName) { List<Annotation> baseTypes = Arrays.asList(annotations).stream() .filter(annotation -> isAggregationMetaAnnotation(annotation) || annotation instanceof SqlType) .collect(toImmutableList()); checkArgument(baseTypes.size() == 1, "Parameter of %s must have exactly one of @SqlType, @BlockIndex", methodName); boolean nullable = isParameterNullable(annotations); boolean isBlock = isParameterBlock(annotations); Annotation annotation = baseTypes.get(0); checkArgument((!isBlock && !nullable) || (annotation instanceof SqlType), "%s contains a parameter with @BlockPosition and/or @NullablePosition that is not @SqlType", methodName); return annotation; }
public static List<AggregateNativeContainerType> parseSignatureArgumentsTypes(Method inputFunction) { ImmutableList.Builder<AggregateNativeContainerType> builder = ImmutableList.builder(); int stateId = findAggregationStateParamId(inputFunction); for (int i = 0; i < inputFunction.getParameterCount(); i++) { Class<?> parameterType = inputFunction.getParameterTypes()[i]; Annotation[] annotations = inputFunction.getParameterAnnotations()[i]; // Skip injected parameters if (parameterType == ConnectorSession.class) { continue; } if (containsAnnotation(annotations, Parser::isAggregationMetaAnnotation)) { continue; } builder.add(new AggregateNativeContainerType(inputFunction.getParameterTypes()[i], isParameterBlock(annotations))); } return builder.build(); }
boolean isParameterBlock = isParameterBlock(annotations[i]); boolean isParameterNullable = isParameterNullable(annotations[i]); builder.add(inputChannelParameterType(isParameterNullable, isParameterBlock, methodName));