You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "lostluck (via GitHub)" <gi...@apache.org> on 2023/05/15 22:13:58 UTC

[GitHub] [beam] lostluck commented on a diff in pull request #26524: [Go SDK]: Enable fileio.MatchContinuously to emit duplicate file if modified

lostluck commented on code in PR #26524:
URL: https://github.com/apache/beam/pull/26524#discussion_r1194395867


##########
sdks/go/pkg/beam/io/fileio/match.go:
##########
@@ -190,21 +194,45 @@ func metadataFromFiles(
 			return nil, err
 		}
 
+		mTime, err := lastModified(ctx, fs, path)
+		if err != nil {
+			return nil, err
+		}
+
 		metadata[i] = FileMetadata{
-			Path: path,
-			Size: size,
+			Path:         path,
+			Size:         size,
+			LastModified: mTime,
 		}
 	}
 
 	return metadata, nil
 }
 
+func lastModified(ctx context.Context, fs filesystem.Interface, path string) (time.Time, error) {

Review Comment:
   Not in this PR, but we could consider putting this as a helper function in the filesystem package instead, to allow more reasonable re-use and consistency in the implementation:
   
   Eg. We implement copy, but if there's a Copier implementation, it can be used instead.
   https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/io/filesystem/util.go#L55
   
   We'd probably want a "creation time" too though when we do that, so the default isn't the zero time. Not critical at this stage though.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org