You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by vasia <gi...@git.apache.org> on 2014/12/11 08:32:09 UTC

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

GitHub user vasia opened a pull request:

    https://github.com/apache/incubator-flink/pull/260

    [FLINK-1307] Allow input from nested directory structure

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/vasia/incubator-flink input-from-nested-files

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-flink/pull/260.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #260
    
----
commit 1feb846313735a85647260b600b88525e679163e
Author: vasia <va...@gmail.com>
Date:   2014-12-10T23:49:59Z

    [FLINK-1307] Allow input from nested directory structure

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/incubator-flink/pull/260#issuecomment-66967968
  
    Thanks for the quick update!
    LGTM, will merge :-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on a diff in the pull request:

    https://github.com/apache/incubator-flink/pull/260#discussion_r21668159
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java ---
    @@ -506,6 +527,31 @@ public LocatableInputSplitAssigner getInputSplitAssigner(FileInputSplit[] splits
     		return inputSplits.toArray(new FileInputSplit[inputSplits.size()]);
     	}
     
    +	private long addNestedFiles(Path path, List<FileStatus> files, long length, boolean checkAccept) 
    +			throws IOException {
    +		final FileSystem fs = path.getFileSystem();
    +
    +		for(FileStatus dir: fs.listStatus(path)) {
    +			if (dir.isDir()) {
    +				addNestedFiles(dir.getPath(), files, length, checkAccept);
    +			}
    +			else {
    +				if (checkAccept) {
    +					if(acceptFile(dir)) {
    +						files.add(dir);
    +						length += dir.getLen();
    +						testForUnsplittable(dir);
    +					}
    +				}
    +				else {
    +					files.add(dir);
    +					testForUnsplittable(dir);
    --- End diff --
    
    fair enough :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/incubator-flink/pull/260#discussion_r21665415
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java ---
    @@ -506,6 +527,31 @@ public LocatableInputSplitAssigner getInputSplitAssigner(FileInputSplit[] splits
     		return inputSplits.toArray(new FileInputSplit[inputSplits.size()]);
     	}
     
    +	private long addNestedFiles(Path path, List<FileStatus> files, long length, boolean checkAccept) 
    +			throws IOException {
    +		final FileSystem fs = path.getFileSystem();
    +
    +		for(FileStatus dir: fs.listStatus(path)) {
    +			if (dir.isDir()) {
    +				addNestedFiles(dir.getPath(), files, length, checkAccept);
    +			}
    +			else {
    +				if (checkAccept) {
    +					if(acceptFile(dir)) {
    +						files.add(dir);
    +						length += dir.getLen();
    +						testForUnsplittable(dir);
    +					}
    +				}
    +				else {
    +					files.add(dir);
    +					testForUnsplittable(dir);
    --- End diff --
    
    `length += dir.getLen()` missing?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:

    https://github.com/apache/incubator-flink/pull/260#issuecomment-66813321
  
    I see! Thank you for spotting this @fhueske. I'll fix it :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/incubator-flink/pull/260#discussion_r21667668
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java ---
    @@ -506,6 +527,31 @@ public LocatableInputSplitAssigner getInputSplitAssigner(FileInputSplit[] splits
     		return inputSplits.toArray(new FileInputSplit[inputSplits.size()]);
     	}
     
    +	private long addNestedFiles(Path path, List<FileStatus> files, long length, boolean checkAccept) 
    +			throws IOException {
    +		final FileSystem fs = path.getFileSystem();
    +
    +		for(FileStatus dir: fs.listStatus(path)) {
    +			if (dir.isDir()) {
    +				addNestedFiles(dir.getPath(), files, length, checkAccept);
    +			}
    +			else {
    +				if (checkAccept) {
    +					if(acceptFile(dir)) {
    +						files.add(dir);
    +						length += dir.getLen();
    +						testForUnsplittable(dir);
    +					}
    +				}
    +				else {
    +					files.add(dir);
    +					testForUnsplittable(dir);
    --- End diff --
    
    Hmm, I find it indeed a bit confusing that the length is added in the other branch of the if statement.
    Maybe add a comment for that?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:

    https://github.com/apache/incubator-flink/pull/260#issuecomment-66773857
  
    Hi! I added a separate method for the `getFileStats` case, to avoid confusion.
    Also, I added a small paragraph in the documentation. Let me know if it looks OK :sunny: 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on a diff in the pull request:

    https://github.com/apache/incubator-flink/pull/260#discussion_r21666686
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java ---
    @@ -506,6 +527,31 @@ public LocatableInputSplitAssigner getInputSplitAssigner(FileInputSplit[] splits
     		return inputSplits.toArray(new FileInputSplit[inputSplits.size()]);
     	}
     
    +	private long addNestedFiles(Path path, List<FileStatus> files, long length, boolean checkAccept) 
    +			throws IOException {
    +		final FileSystem fs = path.getFileSystem();
    +
    +		for(FileStatus dir: fs.listStatus(path)) {
    +			if (dir.isDir()) {
    +				addNestedFiles(dir.getPath(), files, length, checkAccept);
    +			}
    +			else {
    +				if (checkAccept) {
    +					if(acceptFile(dir)) {
    +						files.add(dir);
    +						length += dir.getLen();
    +						testForUnsplittable(dir);
    +					}
    +				}
    +				else {
    +					files.add(dir);
    +					testForUnsplittable(dir);
    --- End diff --
    
    no, the else block corresponds to the call from `getFileStats`, where the length calculation is performed after file enumeration. I did it this way trying not to change existing logic, but if you think it's confusing I can change it :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-flink/pull/260


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by rmetzger <gi...@git.apache.org>.
Github user rmetzger commented on the pull request:

    https://github.com/apache/incubator-flink/pull/260#issuecomment-66585776
  
    Thank you for fixing this so quickly.
    The change looks good.
    
    One minor issue: Can you mention the feature somewhere in the documentation? Thank you ;)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:

    https://github.com/apache/incubator-flink/pull/260#issuecomment-66589891
  
    Sure, will do :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/incubator-flink/pull/260#issuecomment-66594693
  
    LGTM (except for one inline comment and the documentation) :-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the pull request:

    https://github.com/apache/incubator-flink/pull/260#issuecomment-66800177
  
    Ah, OK. I got it :-)
    I think we need only one method to recursively enumerate files (and compute their length).
    
    Not doing the `acceptFile()` check in the `getFileStats()` call is a bug, that you could fix with this PR. Otherwise, files which will not be read are included in the size estimates for the optimizer.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-flink pull request: [FLINK-1307] Allow input from nested...

Posted by vasia <gi...@git.apache.org>.
Github user vasia commented on the pull request:

    https://github.com/apache/incubator-flink/pull/260#issuecomment-66847469
  
    It should be fine now :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---