johannaojeling opened a new issue, #25810:
URL: https://github.com/apache/beam/issues/25810
### What happened?
The GCS fs.List method has a different behavior than the other filesystem
implementations: if the prefix part of the URI provided has a wildcard as its
first character, or no wildcard at all, there is no matching taking place but a
slice with the input glob is simply returned.
It means that a glob may not be expanded, and that a path to a non-existent
bucket/object may be successfully listed, which leads to errors in downstream
read and metadata operations.
Example:
Given these objects exist:
- gs://my-bucket/file1.txt
- gs://my-bucket/file2.txt
Path with '*' as first character in prefix:
```go
glob := "gs://my-bucket/*.txt"
fs, _ := filesystem.New(ctx, glob)
got, _ := fs.List(ctx, glob)
// got: []string{"gs://my-bucket/*.txt"}
// want: []string{"gs://my-bucket/file1.txt", "gs://my-bucket/file2.txt"}
```
Path to non-existent object:
```go
glob := "gs://my-bucket/non-existent.txt"
fs, _ := filesystem.New(ctx, glob)
got, _ := fs.List(ctx, glob)
// got: []string{"gs://my-bucket/non-existent.txt"}
// want: nil
```
I would suggest to align the List behavior across the filesystems and return
nil if there are no matching files.
### Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
### Issue Components
- [ ] Component: Python SDK
- [ ] Component: Java SDK
- [X] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Samza Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
--
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]