[
https://issues.apache.org/jira/browse/BEAM-7854?focusedWorklogId=293469&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-293469
]
ASF GitHub Bot logged work on BEAM-7854:
----------------------------------------
Author: ASF GitHub Bot
Created on: 12/Aug/19 23:07
Start Date: 12/Aug/19 23:07
Worklog Time Spent: 10m
Work Description: lukecwik commented on pull request #9197: [BEAM-7854]
Resolve parent folder recursively in LocalFileSystem matc…
URL: https://github.com/apache/beam/pull/9197#discussion_r313163919
##########
File path:
sdks/java/core/src/main/java/org/apache/beam/sdk/io/LocalFileSystem.java
##########
@@ -225,7 +225,11 @@ private MatchResult matchOne(String spec) throws
IOException {
}
File parent = file.getAbsoluteFile().getParentFile();
- if (!parent.exists()) {
+ while (parent != null && !parent.exists()) {
Review comment:
If the path is relative then can you stop search at the current directory
instead of continuing all the way to the root?
If the path is absolute, can you use something like this [non glob part
matcher found in
GcsUtil](https://github.com/apache/beam/blob/de18f4b34c8eed1e7ce0d62a17e99c47b8c2f8b4/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtil.java#L156)?
Also won't this code match things it shouldn't. If I'm at /a/b/ and the dir
structure is:
```
/a/b/
/a/c/file1.txt
```and I pass in ```c/**```, I think it would match ```/a/c/file1.txt```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 293469)
Time Spent: 3h 10m (was: 3h)
> Reading files from local file system does not fully support glob
> ----------------------------------------------------------------
>
> Key: BEAM-7854
> URL: https://issues.apache.org/jira/browse/BEAM-7854
> Project: Beam
> Issue Type: Bug
> Components: sdk-java-core
> Reporter: Tomer Zeltzer
> Priority: Major
> Time Spent: 3h 10m
> Remaining Estimate: 0h
>
> Folder structure:
> {code:java}
> A
> B
> a=100
> data1
> file1.zst
> file2.zst
> a=999
> data2
> file6.zst
> a=397
> data3
> file7.zst{code}
>
> Glob:
>
> {code:java}
> /A/B/a=[0-9][0-9][0-9]/*/*{code}
> Code:
>
> {code:java}
> input.apply(Create.of(patterns))
> .apply("Matching patterns", FileIO.matchAll())
> .apply(FileIO.readMatches());
> {code}
>
> input is of type PBegin.
> The above code matches 0 files even though, from the glob, its clear it
> should match all files. I suspect its because of line 227, where only the
> first parent folder is checked while is could be an asterix in a glob. I
> believe the right behaviour should be to check all parent folder and use the
> first one that exists.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)