tanmayrauth commented on code in PR #916:
URL: https://github.com/apache/iceberg-go/pull/916#discussion_r3101804436


##########
table/orphan_cleanup.go:
##########
@@ -333,37 +325,15 @@ func makeFileWalkFunc(fn func(path string, info 
stdfs.FileInfo) error, pathTrans
        }
 }
 
-func walkDirectory(fsys iceio.IO, root string, fn func(path string, info 
stdfs.FileInfo) error) error {
-       switch v := fsys.(type) {
-       case iceio.LocalFS:
-               cleanRoot := strings.TrimPrefix(root, "file://")
-               if cleanRoot == "" {
-                       cleanRoot = "."
-               }
-
-               return filepath.WalkDir(cleanRoot, makeFileWalkFunc(fn, 
func(path string) string {
-                       return path
-               }))
-
-       default:
-               // For blob storage: direct field access since we know the 
structure
-               bucket := getBucketName(v)
-
-               parsed, err := url.Parse(root)
-               if err != nil {
-                       return fmt.Errorf("invalid URL %s: %w", root, err)
-               }
-
-               walkPath := strings.TrimPrefix(parsed.Path, "/")
-               if walkPath == "" {
-                       walkPath = "."
-               }
-
-               // URL transform - reconstruct full URL path
-               return stdfs.WalkDir(bucket, walkPath, makeFileWalkFunc(fn, 
func(path string) string {
-                       return parsed.Scheme + "://" + parsed.Host + "/" + path
-               }))
+func walkDirectory(fsys io.IO, root string, fn func(path string, info 
stdfs.FileInfo) error) error {

Review Comment:
   walkDirectory now prefers ListableIO when available, but falls back to the 
previous reflection-based Bucket field access for cloud backends that don't 
implement it yet. This preserves existing behavior — cloud orphan      
     cleanup continues to work as before.  



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