github-actions[bot] commented on code in PR #40983:
URL: https://github.com/apache/beam/pull/40983#discussion_r4774557447


##########
sdks/go/pkg/beam/io/filesystem/s3/s3.go:
##########
@@ -134,6 +136,40 @@ func (f *fs) OpenRead(ctx context.Context, filename 
string) (io.ReadCloser, erro
        return output.Body, nil
 }
 
+// OpenSeekable reads ranges guarded by the ETag observed when opening the 
object.
+func (f *fs) OpenSeekable(ctx context.Context, filename string) 
(filesystem.ReaderAtCloser, error) {
+       bucket, key, err := parseURI(filename)
+       if err != nil {
+               return nil, err
+       }
+       attrs, err := f.client.HeadObject(ctx, &s3.HeadObjectInput{Bucket: 
aws.String(bucket), Key: aws.String(key)})
+       if err != nil {
+               return nil, fmt.Errorf("error opening object %s: %w", filename, 
err)
+       }
+       if 
strings.EqualFold(strings.TrimSpace(aws.ToString(attrs.ContentEncoding)), 
"gzip") {

Review Comment:
   **🟢 Low**: Consider checking for any non-empty, non-`identity` 
`Content-Encoding` (e.g., `br`, `deflate`, `zstd`) or checking across 
comma-separated encodings rather than only matching `"gzip"`, as any 
content-encoded S3/GCS object has a stored representation whose byte offsets do 
not match the decoded content.



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

Reply via email to