You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "C-Loftus (via GitHub)" <gi...@apache.org> on 2026/06/03 18:35:14 UTC
[PR] Change Hadoop Catalog to Use IO Interface [iceberg-go]
C-Loftus opened a new pull request, #1158:
URL: https://github.com/apache/iceberg-go/pull/1158
First step of addressing https://github.com/apache/iceberg-go/issues/1096 This just changes the hadoop catalog implementation to support an interface but still requires a local filesystem.
- All `os.` calls have been swapped to using an interface `HadoopCatalogFS`.
- `HadoopCatalogFS` implements the same exact calls as `os.`
- There were a few calls to `os.remove` that didn't handle the `err` value. I made these `_` to explicitly discard the err value.
- In a follow up PR I can condense the number of methods to reduce interface size. However as a first pass, I wanted to keep the interface and thus the behavior very easy to review.
- The `localfs` struct was extended to support the additional methods.
- There were a few places where `mkdir` used `0o777` for a permission. I didn't see any reason to allow for execution by other users so I changed these to `0o755`
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] refactor(catalog/hadoop): Change Hadoop Catalog to Use IO Interface [iceberg-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade merged PR #1158:
URL: https://github.com/apache/iceberg-go/pull/1158
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Change Hadoop Catalog to Use IO Interface [iceberg-go]
Posted by "tanmayrauth (via GitHub)" <gi...@apache.org>.
tanmayrauth commented on code in PR #1158:
URL: https://github.com/apache/iceberg-go/pull/1158#discussion_r3353905699
##########
catalog/hadoop/io.go:
##########
@@ -0,0 +1,100 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package hadoop
+
+import (
+ "io/fs"
+
+ icebergio "github.com/apache/iceberg-go/io"
+)
+
+// HadoopCatalogFS represents all the interfaces that a filesystem implementation
+// must satisfy to be used for a Hadoop catalog implementation.
+type HadoopCatalogFS interface {
+ icebergio.ListableIO
+ icebergio.ReadFileIO
+ icebergio.WriteFileIO
+ StatIO
+ RenameIO
+ RemoveAllIO
+ MkdirAllIO
+ MkdirIO
+ ReadDirIO
+}
+
+// Ensure that the LocalFS implements the extensions
+// thus ensuring that the hadoop catalog can use the LocalFS for its
+// IO operations
+var (
+ _ icebergio.IO = (*icebergio.LocalFS)(nil)
+ _ StatIO = (*icebergio.LocalFS)(nil)
+ _ RenameIO = (*icebergio.LocalFS)(nil)
+ _ RemoveAllIO = (*icebergio.LocalFS)(nil)
+ _ MkdirIO = (*icebergio.LocalFS)(nil)
+ _ MkdirAllIO = (*icebergio.LocalFS)(nil)
Review Comment:
LocalFS.WriteFile mode should be 0o644, not 0o755. Your PR description explains the 0o777 → 0o755 change as removing the execute bit, but WriteFile's third arg is a file mode where 0o755 still grants +x to everyone. The hadoop catalog used to write the version-hint file with explicit 0o644 at hadoop.go (pre-PR line 232); after this PR it goes through LocalFS.WriteFile and inherits 0o755, so the version-hint file is now created executable. 0o755 is correct for the directory cases (Mkdir/MkdirAll), just not for WriteFile.
##########
catalog/hadoop/hadoop.go:
##########
@@ -354,13 +357,13 @@ func (c *Catalog) CreateTable(ctx context.Context, ident table.Identifier, sc *i
}
if err := internal.WriteTableMetadata(metadata, icebergio.LocalFS{}, tempPath, compression); err != nil {
Review Comment:
pass `c.filesystem` to `WriteTableMetadata`, not `icebergio.LocalFS{}`.** `HadoopCatalogFS` embeds `WriteFileIO`, so `c.filesystem` already satisfies the parameter. Today both resolve to the same value via the hardcoded constructor, but the whole point of this PR is that `c.filesystem` can later be swapped — leaving those two call sites pinned to `LocalFS{}` means the eventual cloud-backed catalog would write metadata to local disk while the surrounding rename/cleanup goes to the cloud FS. Worth fixing in this PR so the abstraction is fully wired.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Change Hadoop Catalog to Use IO Interface [iceberg-go]
Posted by "C-Loftus (via GitHub)" <gi...@apache.org>.
C-Loftus commented on PR #1158:
URL: https://github.com/apache/iceberg-go/pull/1158#issuecomment-4615612654
In a future follow up PR, the goal I think would be to
1. Rewrite some of this logic to decrease the number of methods within the `HadoopCatalogFS` interface
2. Add an interface and more direct logic and documentation around the atomicity requirements described in https://github.com/apache/iceberg-go/issues/1096 for a fs to be used for the hadoop catalog
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] refactor(catalog/hadoop): Change Hadoop Catalog to Use IO Interface [iceberg-go]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #1158:
URL: https://github.com/apache/iceberg-go/pull/1158#discussion_r3375764190
##########
catalog/hadoop/hadoop.go:
##########
@@ -474,22 +477,22 @@ func (c *Catalog) CommitTable(ctx context.Context, ident table.Identifier, reqs
compression := updated.Properties().Get(table.MetadataCompressionKey, table.MetadataCompressionDefault)
if err := internal.WriteTableMetadata(updated, icebergio.LocalFS{}, tempPath, compression); err != nil {
Review Comment:
CommitTable still writes new table metadata using a hard-coded `icebergio.LocalFS{}` instead of the catalog's configured `c.filesystem`. This breaks the intended filesystem abstraction (and can leave temp files behind or write to the wrong backend once `Catalog.filesystem` is made configurable).
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Change Hadoop Catalog to Use IO Interface [iceberg-go]
Posted by "C-Loftus (via GitHub)" <gi...@apache.org>.
C-Loftus commented on PR #1158:
URL: https://github.com/apache/iceberg-go/pull/1158#issuecomment-4622318329
Thank you very much for the review @tanmayrauth! I appreciate it. I believe I have addressed your feedback now. Happy to iterate on anything else if you wish.
1. Documented which `fs.` errors each method in the `io` file needs to fulfill
2. Switched from a hardcoded `localfs` to the catalog interface.
3. Changed the `writefile` file permissions to your feedback.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org