You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by at...@apache.org on 2026/07/17 19:47:04 UTC

(iceberg-go) branch main updated: fix(glue): accept empty root namespace identifiers (#1490)

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

laskoviymishka 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 0968050c fix(glue): accept empty root namespace identifiers (#1490)
0968050c is described below

commit 0968050c7234fc181d995077aca44250a2202f52
Author: Minh Vu <vu...@gmail.com>
AuthorDate: Fri Jul 17 21:46:59 2026 +0200

    fix(glue): accept empty root namespace identifiers (#1490)
    
    ## Problem
    
    Glue treated an allocated empty identifier differently from nil when
    listing the root namespace. Callers using `table.Identifier{}` received
    a hierarchical-namespace error even though it represents the same root.
    
    ## Changes
    
    Use identifier length to distinguish the root from unsupported non-empty
    hierarchical namespaces.
    
    ## Testing
    
    Added coverage for an allocated empty root identifier.
    
    - `go test ./catalog/glue`
---
 catalog/glue/glue.go      |  2 +-
 catalog/glue/glue_test.go | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/catalog/glue/glue.go b/catalog/glue/glue.go
index d1439740..817f85ec 100644
--- a/catalog/glue/glue.go
+++ b/catalog/glue/glue.go
@@ -733,7 +733,7 @@ func (c *Catalog) ListNamespaces(ctx context.Context, parent table.Identifier) (
 		CatalogId: c.catalogId,
 	}
 
-	if parent != nil {
+	if len(parent) > 0 {
 		return nil, errors.New("hierarchical namespace is not supported")
 	}
 
diff --git a/catalog/glue/glue_test.go b/catalog/glue/glue_test.go
index 6d9e6e7c..80f1458c 100644
--- a/catalog/glue/glue_test.go
+++ b/catalog/glue/glue_test.go
@@ -553,6 +553,19 @@ func TestGlueListNamespaces(t *testing.T) {
 	assert.Equal([]string{"test_database"}, databases[0])
 }
 
+func TestGlueListNamespacesAcceptsEmptyRootIdentifier(t *testing.T) {
+	mockGlueSvc := &mockGlueClient{}
+	mockGlueSvc.On("GetDatabases", mock.Anything, &glue.GetDatabasesInput{}, mock.Anything).
+		Return(&glue.GetDatabasesOutput{}, nil).Once()
+
+	glueCatalog := &Catalog{glueSvc: mockGlueSvc}
+	databases, err := glueCatalog.ListNamespaces(context.Background(), table.Identifier{})
+
+	require.NoError(t, err)
+	require.Empty(t, databases)
+	mockGlueSvc.AssertExpectations(t)
+}
+
 func TestGlueDropTable(t *testing.T) {
 	assert := require.New(t)