laskoviymishka commented on code in PR #2664:
URL: https://github.com/apache/iceberg-go/pull/2664#discussion_r4693734927
##########
catalog/registry.go:
##########
@@ -89,6 +90,38 @@ func (f RegistrarFunc) GetCatalog(ctx context.Context,
catalogName string, props
return f(ctx, catalogName, props)
}
+// IORegistryRegistrar is a factory that supports catalog-scoped FileIO.
Review Comment:
Could the type comment spell out the dispatch? With a non-nil registry,
[`Load`](https://github.com/apache/iceberg-go/blob/fc054c48d80581417f10aa03314dc7dfc6137b1c/catalog/registry.go#L271-L280)
calls only `GetCatalogWithIORegistry` and never `GetCatalog`, so a wrapper
that embeds just `Registrar` fails with `ErrNotImplemented`. Right now that
rule is only on `WithIORegistry`, and custom-factory authors read the interface
they implement.
```suggestion
// IORegistryRegistrar is a factory that supports catalog-scoped FileIO.
// When Load receives a non-nil registry it calls only
GetCatalogWithIORegistry,
// never GetCatalog. A wrapper that embeds only Registrar must implement
// GetCatalogWithIORegistry itself, or scoped loads fail with
// iceberg.ErrNotImplemented.
```
##########
catalog/registry.go:
##########
@@ -230,5 +264,18 @@ func (r *Registry) Load(ctx context.Context, name string,
props iceberg.Properti
return nil, fmt.Errorf("%w: %s", ErrCatalogNotFound,
catalogType)
}
+ var options loadOptions
+ for _, opt := range opts {
+ opt(&options)
Review Comment:
Should this skip nil options the way
[`io.FS`](https://github.com/apache/iceberg-go/blob/58f95650fd83d3af536327d955db3014d6a9bf85/io/io.go#L250-L254)
does? An explicit nil `LoadOption` in `opts` panics here. Most option loops in
the repo,
[`rest.NewCatalog`](https://github.com/apache/iceberg-go/blob/58f95650fd83d3af536327d955db3014d6a9bf85/catalog/rest/rest.go#L997-L1001)
included, don't guard either, so this is a small call.
```suggestion
if opt != nil {
opt(&options)
}
```
##########
website/src/configuration.md:
##########
@@ -515,13 +461,16 @@ fs, err := registry.LoadFS(ctx, props,
"myfs://bucket/key")
`io.NewRegistry()` copies schemes already registered globally (including
blank-imported cloud backends) but keeps later registrations independent.
`registry.Clone()` makes an isolated copy of another registry.
`registry.Names()` lists the schemes registered in that instance.
`registry.LoadFSFunc()` is the lazy factory equivalent. Global `io.LoadFS()`
and `io.LoadFSFunc()` continue using the default registry.
-Pass the catalog's `WithIORegistry(registry)` option to `NewCatalog` in
-Glue, Hadoop, Hive, REST, or SQL. For direct view metadata creation or
-writes, pass `view.WithIORegistry(registry)` to the view helper.
+Pass `catalog.WithIORegistry(registry)` to `catalog.Load` or
`(*catalog.Registry).Load`
+to select FileIO for a built-in catalog. For DynamoDB, use a catalog loader to
+supply a scoped FileIO registry. Glue, Hadoop, Hive, REST, and SQL also accept
Review Comment:
Could this name the API? "a catalog loader" reads like a separate mechanism,
but DynamoDB has no `WithIORegistry` of its own, so `catalog.Load` is its only
route.
```suggestion
to select FileIO for a built-in catalog. DynamoDB takes a scoped FileIO
registry
only through `catalog.Load`. Glue, Hadoop, Hive, REST, and SQL also accept
```
--
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]