rraulinio opened a new pull request, #1432: URL: https://github.com/apache/iceberg-go/pull/1432
## Description Addressing part 2 from https://github.com/apache/iceberg-go/issues/1360, following the SQL UDF metadata model added in #1418. This adds read-side SQL UDF support to the REST catalog through a new optional `FunctionCatalog` capability interface. REST catalogs can list functions in a namespace, load a function and check whether a function exists. Loaded functions are represented by a new `udf.UDF` wrapper containing the catalog identifier, parsed UDF metadata and optional metadata location. The REST implementation supports the two function endpoints currently defined by the Iceberg REST OpenAPI: - `GET /v1/{prefix}/namespaces/{namespace}/functions` - `GET /v1/{prefix}/namespaces/{namespace}/functions/{function}` Function endpoints are not part of the REST spec's assumed default endpoint set, so they are used only when advertised by the server through `ConfigResponse.endpoints`. An unsupported load or existence check returns `ErrEndpointNotSupported`, while an unsupported listing yields no results without issuing a request, matching the existing list behavior for optional endpoints. `ListFunctions` is a paginated iterator and handles the function-specific `CatalogObjectIdentifier` wire shape: each identifier is a flat array of hierarchy levels, such as `["accounting", "tax", "paid"]`, rather than the `{namespace, name}` object used for tables and views. `LoadFunction` parses the returned metadata using the `udf` package and returns all overloads from the single metadata response. The optional `metadata-location` is preserved when present. The catalog adds `ErrNoSuchFunction` for `NoSuchFunctionException` responses and validates function identifiers independently from table and view identifiers. `CheckFunctionExists` uses `LoadFunction` because the REST spec does not define a HEAD endpoint for functions; invalid identifiers remain errors, while a server-reported missing function returns `false` without an error. This PR does not add create, replace or drop operations because standardized REST write endpoints for functions are not currently defined. It also does not resolve overloads or execute UDF SQL bodies; those remain query-engine responsibilities. The tests cover list and load responses, pagination, early iterator termination, page-size handling, subsequent-page errors, missing namespaces and functions, malformed metadata, identifier validation, GET-based existence checks and endpoint capability negotiation. They also add focused coverage for existing UDF metadata initialization and nil-properties safeguards. ## Tests - `go test ./...` - `go test ./catalog/rest -run 'Function|Endpoint' -count=10` - `go test -race ./catalog ./catalog/rest ./udf -run 'Function|Endpoint|TestUDF|TestBuilderFromBaseNilProperties|TestMetadataInitDefaults' -count=1` - `go vet ./...` - `golangci-lint run --timeout=10m` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
