in zetasql-toolkit-core/src/main/java/com/google/zetasql/toolkit/catalog/TVFInfo.java [135:162]
private void validate() {
Preconditions.checkNotNull(this.namePath, "Cannot build TVFInfo with null name path");
Preconditions.checkArgument(!this.namePath.isEmpty(), "TVFInfo name path cannot be empty");
Preconditions.checkNotNull(this.signature, "Cannot build TVFInfo with a null signature");
Preconditions.checkArgument(
this.signature.getResultType().getKind().equals(SignatureArgumentKind.ARG_TYPE_RELATION),
"TVF result types must be of type RELATION");
if (this.outputSchema.isPresent()) {
// Make sure the RelationInputSchema is set on the function signature's return type
FunctionArgumentTypeOptions newReturnTypeOptions =
FunctionArgumentTypeOptions.builder()
.setRelationInputSchema(this.outputSchema.get())
.build();
FunctionArgumentType newReturnType =
new FunctionArgumentType(
SignatureArgumentKind.ARG_TYPE_RELATION, newReturnTypeOptions, 1);
FunctionSignature newSignature =
new FunctionSignature(
newReturnType,
this.signature.getFunctionArgumentList(),
this.signature.getContextId());
this.setSignature(newSignature);
}
}