use of org.apache.flink.table.types.inference.ArgumentTypeStrategy in project flink by apache.
the class VaryingSequenceInputTypeStrategy method inferInputTypes.
@Override
public Optional<List<DataType>> inferInputTypes(CallContext callContext, boolean throwOnFailure) {
final List<DataType> dataTypes = callContext.getArgumentDataTypes();
if (dataTypes.size() < constantArgumentCount) {
return Optional.empty();
}
final List<DataType> inferredDataTypes = new ArrayList<>(dataTypes.size());
for (int i = 0; i < callContext.getArgumentDataTypes().size(); i++) {
final ArgumentTypeStrategy argumentTypeStrategy;
if (i < constantArgumentCount) {
argumentTypeStrategy = constantArgumentStrategies.get(i);
} else {
argumentTypeStrategy = varyingArgumentStrategy;
}
final Optional<DataType> inferredDataType = argumentTypeStrategy.inferArgumentType(callContext, i, throwOnFailure);
if (!inferredDataType.isPresent()) {
return Optional.empty();
}
inferredDataTypes.add(inferredDataType.get());
}
return Optional.of(inferredDataTypes);
}
Aggregations