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


##########
manifest.go:
##########
@@ -339,8 +340,35 @@ func (m *manifestFile) FirstRowID() *int64 { return 
m.FirstRowIDValue }
 
 func (m *manifestFile) HasAddedFiles() bool    { return m.AddedFilesCount != 0 
}
 func (m *manifestFile) HasExistingFiles() bool { return m.ExistingFilesCount 
!= 0 }
-func (m *manifestFile) FetchEntries(fs iceio.IO, discardDeleted bool) 
([]ManifestEntry, error) {
-       return fetchManifestEntries(m, fs, discardDeleted)
+
+func (m *manifestFile) Entries(fs iceio.IO, discardDeleted bool) 
iter.Seq2[ManifestEntry, error] {
+       return func(yield func(ManifestEntry, error) bool) {
+               f, err := fs.Open(m.FilePath())
+               if err != nil {
+                       yield(nil, err)
+
+                       return
+               }
+               defer func() {
+                       _ = f.Close()

Review Comment:
   i would say that we should *only* return the pair if the error from close is 
non-nil. If the error is nil, then no need to yield the synthetic pair (follow 
the canonical scenario of just letting the function end to indicate we're done)



##########
manifest.go:
##########
@@ -339,8 +340,35 @@ func (m *manifestFile) FirstRowID() *int64 { return 
m.FirstRowIDValue }
 
 func (m *manifestFile) HasAddedFiles() bool    { return m.AddedFilesCount != 0 
}
 func (m *manifestFile) HasExistingFiles() bool { return m.ExistingFilesCount 
!= 0 }
-func (m *manifestFile) FetchEntries(fs iceio.IO, discardDeleted bool) 
([]ManifestEntry, error) {
-       return fetchManifestEntries(m, fs, discardDeleted)
+
+func (m *manifestFile) Entries(fs iceio.IO, discardDeleted bool) 
iter.Seq2[ManifestEntry, error] {
+       return func(yield func(ManifestEntry, error) bool) {
+               f, err := fs.Open(m.FilePath())
+               if err != nil {
+                       yield(nil, err)
+
+                       return
+               }
+               defer func() {
+                       _ = f.Close()

Review Comment:
   i would say that we should *only* return the pair if the error from close is 
non-nil. If the error is nil, then no need to yield the synthetic pair (follow 
the canonical scenario of just letting the function end to indicate we're done)



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