This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git


The following commit(s) were added to refs/heads/main by this push:
     new 36bdf3493 feat(catalog): expose optional table registration capability 
(#2320)
36bdf3493 is described below

commit 36bdf349369e064c1c5b60259b5fc030bb3a121d
Author: Minh Vu <[email protected]>
AuthorDate: Mon Oct 26 17:45:27 2026 +0100

    feat(catalog): expose optional table registration capability (#2320)
    
    Signed-off-by: Minh Vu <[email protected]>
---
 catalog/catalog.go   | 17 +++++++++++++++++
 catalog/glue/glue.go |  5 ++++-
 catalog/hive/hive.go |  5 ++++-
 catalog/rest/rest.go |  1 +
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/catalog/catalog.go b/catalog/catalog.go
index 6bd810d2b..f851e800b 100644
--- a/catalog/catalog.go
+++ b/catalog/catalog.go
@@ -183,6 +183,23 @@ type TransactionalCatalog interface {
        CommitTransaction(ctx context.Context, commits []table.TableCommit) 
error
 }
 
+// RegisterableCatalog is an optional interface for catalogs that can register
+// an existing table from its metadata file. Registration adds a catalog entry
+// without creating a new table or rewriting its data.
+//
+// REST, Hive, and Glue catalogs implement this interface. Callers should
+// check for registration support with a type assertion:
+//
+//     if registerable, ok := cat.(catalog.RegisterableCatalog); ok {
+//             tbl, err := registerable.RegisterTable(ctx, ident, 
metadataLocation)
+//     }
+//
+// Backend support for registration does not guarantee that a given request
+// will succeed (for example, if the table already exists).
+type RegisterableCatalog interface {
+       RegisterTable(ctx context.Context, identifier table.Identifier, 
metadataLocation string) (*table.Table, error)
+}
+
 // PurgeableCatalog is the small table purge interface embedded by Catalog.
 // Every Catalog must support PurgeTable, which removes the catalog entry and
 // performs best-effort physical file deletion.
diff --git a/catalog/glue/glue.go b/catalog/glue/glue.go
index c4fc04f5f..d41c965da 100644
--- a/catalog/glue/glue.go
+++ b/catalog/glue/glue.go
@@ -92,7 +92,10 @@ const (
        renameCleanupTimeout    = 5 * time.Second
 )
 
-var _ catalog.Catalog = (*Catalog)(nil)
+var (
+       _ catalog.Catalog             = (*Catalog)(nil)
+       _ catalog.RegisterableCatalog = (*Catalog)(nil)
+)
 
 func init() {
        catalog.Register("glue", catalog.RegistrarFunc(func(ctx 
context.Context, _ string, props iceberg.Properties) (catalog.Catalog, error) {
diff --git a/catalog/hive/hive.go b/catalog/hive/hive.go
index bb064cd63..a759748f5 100644
--- a/catalog/hive/hive.go
+++ b/catalog/hive/hive.go
@@ -43,7 +43,10 @@ const (
        descriptionKey = "description"
 )
 
-var _ catalog.Catalog = (*Catalog)(nil)
+var (
+       _ catalog.Catalog             = (*Catalog)(nil)
+       _ catalog.RegisterableCatalog = (*Catalog)(nil)
+)
 
 func init() {
        catalog.Register("hive", catalog.RegistrarFunc(func(ctx 
context.Context, _ string, props iceberg.Properties) (catalog.Catalog, error) {
diff --git a/catalog/rest/rest.go b/catalog/rest/rest.go
index 933392372..a2ef852c4 100644
--- a/catalog/rest/rest.go
+++ b/catalog/rest/rest.go
@@ -52,6 +52,7 @@ var (
        _ catalog.Catalog                      = (*Catalog)(nil)
        _ catalog.TransactionalCatalog         = (*Catalog)(nil)
        _ catalog.RefreshableCredentialCatalog = (*Catalog)(nil)
+       _ catalog.RegisterableCatalog          = (*Catalog)(nil)
 )
 
 const (

Reply via email to