C-Loftus commented on code in PR #1185:
URL: https://github.com/apache/iceberg-go/pull/1185#discussion_r3429902430
##########
catalog/hadoop/hadoop.go:
##########
@@ -526,29 +549,38 @@ func (c *Catalog) ListTables(_ context.Context, ns
table.Identifier) iter.Seq2[t
return
}
- entries, err := c.filesystem.ReadDir(nsPath)
- if err != nil {
- yield(nil, fmt.Errorf("hadoop catalog: failed to read
namespace directory: %w", err))
-
- return
- }
+ err = c.filesystem.WalkDir(nsPath, func(path string, d
fs.DirEntry, err error) error {
+ if err != nil {
+ return err
+ }
- for _, e := range entries {
- if !e.IsDir() {
- continue
+ // Anything that is a file is not a namespace or table,
so skip it.
+ if !d.IsDir() {
+ return nil
}
- child := filepath.Join(nsPath, e.Name())
- if !isTableDir(c.filesystem, child) {
- continue
+ // Skip the namespace directory itself.
+ if path == nsPath {
+ return nil
}
+ // Skip anything that is not a table directory.
+ if !isTableDir(c.filesystem, path) {
+ return nil
+ }
ident := make(table.Identifier, len(ns)+1)
copy(ident, ns)
- ident[len(ns)] = e.Name()
+ ident[len(ns)] = d.Name()
if !yield(ident, nil) {
- return
+ return nil
}
+
+ return nil
Review Comment:
Added tests in for this in
https://github.com/apache/iceberg-go/pull/1185/commits/fbccce9a2201bccd857f319b46174c574b5e61a8
so resolving this comment
--
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]