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 da28e4be2 refactor(catalog)!: remove TableNameFromIdent before v1 
(#2281)
da28e4be2 is described below

commit da28e4be2ee5ef9395af4a9dd9c270381e46bd59
Author: Minh Vu <[email protected]>
AuthorDate: Sat Oct 24 00:06:44 2026 +0200

    refactor(catalog)!: remove TableNameFromIdent before v1 (#2281)
    
    * refactor(catalog)!: remove TableNameFromIdent before v1
    
    Use ObjectNameFromIdent for table and view identifiers and retire the 
redundant public alias.
    
    Signed-off-by: Minh Vu <[email protected]>
    
    * docs(releases): note pre-v1 breaking API migration
    
    ---------
    
    Signed-off-by: Minh Vu <[email protected]>
    Co-authored-by: Matt Topol <[email protected]>
---
 catalog/catalog.go         |  4 ----
 catalog/identifier_test.go |  4 +---
 catalog/internal/utils.go  |  2 +-
 catalog/rest/rest.go       | 10 +++++-----
 catalog/sql/sql.go         | 22 +++++++++++-----------
 catalog/sql/sql_test.go    |  6 +++---
 website/src/releases.md    |  1 +
 7 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/catalog/catalog.go b/catalog/catalog.go
index 1a508b320..e7ea6791b 100644
--- a/catalog/catalog.go
+++ b/catalog/catalog.go
@@ -267,10 +267,6 @@ func ObjectNameFromIdent(ident table.Identifier) string {
        return ident[len(ident)-1]
 }
 
-func TableNameFromIdent(ident table.Identifier) string {
-       return ObjectNameFromIdent(ident)
-}
-
 func NamespaceFromIdent(ident table.Identifier) table.Identifier {
        if len(ident) == 0 {
                return nil
diff --git a/catalog/identifier_test.go b/catalog/identifier_test.go
index 080e3222a..d4e90ed9d 100644
--- a/catalog/identifier_test.go
+++ b/catalog/identifier_test.go
@@ -105,7 +105,5 @@ func TestObjectNameFromIdent(t *testing.T) {
        require.Equal(t, "object", 
catalog.ObjectNameFromIdent(table.Identifier{"parent", "namespace", "object"}))
        require.Equal(t, "object", 
catalog.ObjectNameFromIdent(table.Identifier{"object"}))
        require.Equal(t, "", catalog.ObjectNameFromIdent(table.Identifier{}))
-
-       // TableNameFromIdent stays as the table-flavored alias of the same 
rule.
-       require.Equal(t, "object", 
catalog.TableNameFromIdent(table.Identifier{"namespace", "object"}))
+       require.Equal(t, "", catalog.ObjectNameFromIdent(nil))
 }
diff --git a/catalog/internal/utils.go b/catalog/internal/utils.go
index dd599a2b6..266b071d3 100644
--- a/catalog/internal/utils.go
+++ b/catalog/internal/utils.go
@@ -135,7 +135,7 @@ func createStagedTable(
        }
 
        dbIdent := catalog.NamespaceFromIdent(ident)
-       tblname := catalog.TableNameFromIdent(ident)
+       tblname := catalog.ObjectNameFromIdent(ident)
        if namespaceKey == "" {
                namespaceKey = strings.Join(dbIdent, ".")
        }
diff --git a/catalog/rest/rest.go b/catalog/rest/rest.go
index a2f175206..17c4b2ae4 100644
--- a/catalog/rest/rest.go
+++ b/catalog/rest/rest.go
@@ -1877,7 +1877,7 @@ func (r *Catalog) CommitTransaction(ctx context.Context, 
commits []table.TableCo
                changes[i] = tableChange{
                        Identifier: identifier{
                                Namespace: 
catalog.NamespaceFromIdent(c.Identifier),
-                               Name:      
catalog.TableNameFromIdent(c.Identifier),
+                               Name:      
catalog.ObjectNameFromIdent(c.Identifier),
                        },
                        Requirements: reqs,
                        Updates:      updates,
@@ -2144,11 +2144,11 @@ func (r *Catalog) RenameTable(ctx context.Context, 
from, to table.Identifier) (*
        }
        src := identifier{
                Namespace: catalog.NamespaceFromIdent(from),
-               Name:      catalog.TableNameFromIdent(from),
+               Name:      catalog.ObjectNameFromIdent(from),
        }
        dst := identifier{
                Namespace: catalog.NamespaceFromIdent(to),
-               Name:      catalog.TableNameFromIdent(to),
+               Name:      catalog.ObjectNameFromIdent(to),
        }
 
        path, err := endpointRenameTable.reqPath()
@@ -2724,11 +2724,11 @@ func (r *Catalog) RenameView(ctx context.Context, from, 
to table.Identifier) (*v
        }
        src := identifier{
                Namespace: catalog.NamespaceFromIdent(from),
-               Name:      catalog.TableNameFromIdent(from),
+               Name:      catalog.ObjectNameFromIdent(from),
        }
        dst := identifier{
                Namespace: catalog.NamespaceFromIdent(to),
-               Name:      catalog.TableNameFromIdent(to),
+               Name:      catalog.ObjectNameFromIdent(to),
        }
 
        path, err := endpointRenameView.reqPath()
diff --git a/catalog/sql/sql.go b/catalog/sql/sql.go
index c799c19c2..a6c0da0a8 100644
--- a/catalog/sql/sql.go
+++ b/catalog/sql/sql.go
@@ -818,7 +818,7 @@ func (c *Catalog) CreateTable(ctx context.Context, ident 
table.Identifier, sc *i
        }
 
        nsIdent := catalog.NamespaceFromIdent(ident)
-       tblIdent := catalog.TableNameFromIdent(ident)
+       tblIdent := catalog.ObjectNameFromIdent(ident)
        ns, exists, err := c.resolveNamespaceKey(ctx, nsIdent)
        if err != nil {
                return nil, err
@@ -890,7 +890,7 @@ func (c *Catalog) CommitTable(ctx context.Context, ident 
table.Identifier, reqs
        }
 
        ns := catalog.NamespaceFromIdent(ident)
-       tblName := catalog.TableNameFromIdent(ident)
+       tblName := catalog.ObjectNameFromIdent(ident)
        nsKey, err := c.namespaceKey(ctx, ns)
        if err != nil {
                return nil, "", err
@@ -996,7 +996,7 @@ func (c *Catalog) LoadTable(ctx context.Context, identifier 
table.Identifier) (*
        }
 
        ns := catalog.NamespaceFromIdent(identifier)
-       tbl := catalog.TableNameFromIdent(identifier)
+       tbl := catalog.ObjectNameFromIdent(identifier)
        nsKey, err := c.namespaceKey(ctx, ns)
        if err != nil {
                return nil, err
@@ -1057,7 +1057,7 @@ func (c *Catalog) DropTable(ctx context.Context, 
identifier table.Identifier) er
        if err != nil {
                return err
        }
-       tbl := catalog.TableNameFromIdent(identifier)
+       tbl := catalog.ObjectNameFromIdent(identifier)
 
        return withWriteTx(ctx, c.db, func(ctx context.Context, tx bun.Tx) 
error {
                del := tx.NewDelete().Model(&sqlIcebergTable{
@@ -1122,13 +1122,13 @@ func (c *Catalog) RenameTable(ctx context.Context, 
from, to table.Identifier) (*
        if err != nil {
                return nil, err
        }
-       fromTbl := catalog.TableNameFromIdent(from)
+       fromTbl := catalog.ObjectNameFromIdent(from)
 
        toNs, exists, err := c.resolveNamespaceKey(ctx, 
catalog.NamespaceFromIdent(to))
        if err != nil {
                return nil, err
        }
-       toTbl := catalog.TableNameFromIdent(to)
+       toTbl := catalog.ObjectNameFromIdent(to)
 
        if !exists {
                return nil, fmt.Errorf("%w: %s", catalog.ErrNoSuchNamespace, 
toNs)
@@ -1226,7 +1226,7 @@ func (c *Catalog) CheckTableExists(ctx context.Context, 
identifier table.Identif
        if err != nil {
                return false, err
        }
-       tableName := catalog.TableNameFromIdent(identifier)
+       tableName := catalog.ObjectNameFromIdent(identifier)
 
        return withReadTx(ctx, c.db, func(ctx context.Context, tx bun.Tx) 
(bool, error) {
                query := tx.NewSelect().Model(&sqlIcebergTable{
@@ -1638,7 +1638,7 @@ func (c *Catalog) CreateView(ctx context.Context, 
identifier table.Identifier, s
        }
 
        nsIdent := catalog.NamespaceFromIdent(identifier)
-       viewIdent := catalog.TableNameFromIdent(identifier)
+       viewIdent := catalog.ObjectNameFromIdent(identifier)
        ns, exists, err := c.resolveNamespaceKey(ctx, nsIdent)
        if err != nil {
                return err
@@ -1773,7 +1773,7 @@ func (c *Catalog) DropView(ctx context.Context, 
identifier table.Identifier) err
        if err != nil {
                return err
        }
-       viewName := catalog.TableNameFromIdent(identifier)
+       viewName := catalog.ObjectNameFromIdent(identifier)
 
        metadataLocation := ""
        view, err := withReadTx(ctx, c.db, func(ctx context.Context, tx bun.Tx) 
(*sqlIcebergTable, error) {
@@ -1852,7 +1852,7 @@ func (c *Catalog) CheckViewExists(ctx context.Context, 
identifier table.Identifi
        if err != nil {
                return false, err
        }
-       viewName := catalog.TableNameFromIdent(identifier)
+       viewName := catalog.ObjectNameFromIdent(identifier)
 
        return withReadTx(ctx, c.db, func(ctx context.Context, tx bun.Tx) 
(bool, error) {
                exists, err := tx.NewSelect().Model(&sqlIcebergTable{
@@ -1882,7 +1882,7 @@ func (c *Catalog) LoadView(ctx context.Context, 
identifier table.Identifier) (vi
        if err != nil {
                return nil, err
        }
-       viewName := catalog.TableNameFromIdent(identifier)
+       viewName := catalog.ObjectNameFromIdent(identifier)
 
        v, err := withReadTx(ctx, c.db, func(ctx context.Context, tx bun.Tx) 
(*sqlIcebergTable, error) {
                v := new(sqlIcebergTable)
diff --git a/catalog/sql/sql_test.go b/catalog/sql/sql_test.go
index c41bba3c8..889c9609d 100644
--- a/catalog/sql/sql_test.go
+++ b/catalog/sql/sql_test.go
@@ -701,7 +701,7 @@ func (s *SqliteCatalogTestSuite) 
TestGenuineV0RowSurvivesMigrationForCommitAndRe
                var got sql.NullString
                qErr := sqldb.QueryRow(
                        `SELECT iceberg_type FROM iceberg_tables WHERE 
catalog_name = ? AND table_namespace = ? AND table_name = ?`,
-                       "default", nsStr, catalog.TableNameFromIdent(tblID),
+                       "default", nsStr, catalog.ObjectNameFromIdent(tblID),
                ).Scan(&got)
                s.Require().NoError(qErr)
 
@@ -726,7 +726,7 @@ func (s *SqliteCatalogTestSuite) 
TestGenuineV0RowSurvivesMigrationForCommitAndRe
        _, err = sqldb.Exec(
                `UPDATE iceberg_tables SET iceberg_type = NULL `+
                        `WHERE catalog_name = ? AND table_namespace = ? AND 
table_name = ?`,
-               "default", nsStr, catalog.TableNameFromIdent(tblID),
+               "default", nsStr, catalog.ObjectNameFromIdent(tblID),
        )
        s.Require().NoError(err)
 
@@ -1068,7 +1068,7 @@ func (s *SqliteCatalogTestSuite) 
TestCreateTableWithGivenLocation() {
 
        for _, tt := range tests {
                ns := catalog.NamespaceFromIdent(tt.tblID)
-               tblName := catalog.TableNameFromIdent(tt.tblID)
+               tblName := catalog.ObjectNameFromIdent(tt.tblID)
 
                location := fmt.Sprintf("file://%s/%s.db/%s-given",
                        s.warehouse, tt.cat.Name(), tblName)
diff --git a/website/src/releases.md b/website/src/releases.md
index 3bda31a15..3c81ebc4d 100644
--- a/website/src/releases.md
+++ b/website/src/releases.md
@@ -42,6 +42,7 @@ Per-release notes (highlights, breaking changes, 
contributors) are published on
 
 ### Unreleased compatibility notes
 
+- **Catalog identifier helper renamed.** `catalog.TableNameFromIdent` is 
removed. Use `catalog.ObjectNameFromIdent` for tables, views, and functions.
 - **Substrait expression conversion no longer takes case sensitivity.** 
`substrait.ConvertExpr(schema, expression, caseSensitive)` becomes 
`substrait.ConvertExpr(schema, expression)`. Case sensitivity remains part of 
expression binding.
 
 - **Transform formatting requires the result type.** 
`Transform.ToHumanStr(value)` is removed. Use 
`Transform.ToHumanStrType(resultType, value)` to format partition values, 
including timestamps with time zones.

Reply via email to