zeroshade commented on code in PR #1292:
URL: https://github.com/apache/iceberg-go/pull/1292#discussion_r3521378480


##########
catalog/hadoop/hadoop.go:
##########
@@ -457,27 +558,41 @@ func (c *Catalog) CreateTable(ctx context.Context, ident 
table.Identifier, sc *i
        return tbl, nil
 }
 
-func (c *Catalog) LoadTable(ctx context.Context, ident table.Identifier) 
(*table.Table, error) {
+func (c *Catalog) loadTable(ctx context.Context, ident table.Identifier) 
(*table.Table, int, error) {
        if err := validateTableIdentifier(ident); err != nil {
-               return nil, err
+               return nil, 0, err
        }
 
-       ver, err := c.findVersion(ident)
+       metaPath, version, err := c.findMetadataLocation(ident)
        if err != nil {
-               return nil, err
+               return nil, 0, err
+       }
+
+       tbl, err := table.NewFromLocation(ctx, ident, metaPath, 
io.LoadFSFunc(c.props, metaPath), c)
+       if err != nil {
+               return nil, 0, err
        }
 
-       metaPath := c.metadataFilePath(ident, ver)
+       return tbl, version, nil
+}
 
-       return table.NewFromLocation(ctx, ident, metaPath, 
io.LoadFSFunc(c.props, metaPath), c)
+func (c *Catalog) LoadTable(ctx context.Context, ident table.Identifier) 
(*table.Table, error) {
+       tbl, _, err := c.loadTable(ctx, ident)
+
+       return tbl, err
 }
 
 func (c *Catalog) CheckTableExists(_ context.Context, ident table.Identifier) 
(bool, error) {
        if err := validateTableIdentifier(ident); err != nil {
                return false, nil
        }
 
-       return isTableDir(c.filesystem, c.isLocal, c.tableToPath(ident)), nil
+       exists, err := isTableDir(c.filesystem, c.isLocal, c.tableToPath(ident))

Review Comment:
   Optional (non-blocking): `CheckTableExists` now propagates `isTableDir` 
errors, while `ListTables`/`ListNamespaces` intentionally swallow permission 
errors via `isTableDirForListing`. That strict-vs-tolerant split is defensible, 
but a one-line comment here explaining the distinction would save the next 
reader a double-take.



-- 
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]

Reply via email to