AuthurWang2009 opened a new pull request, #6070:
URL: https://github.com/apache/hadoop/pull/6070
…attribute
<!--
Thanks for sending a pull request!
1. If this is your first time, please read our contributor guidelines:
https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
2. Make sure your PR title starts with JIRA issue id, e.g.,
'HADOOP-17799. Your PR title ...'.
-->
### Description of PR
In some circumstances, we need to filter file/directory by file/directroy.
For example, we need to filter out them by file modified time, isDir attrs, etc.
So, should we introduce a new method public boolean
shouldCopy(CopyListingFileStatus fileStatus) ?
by this approach, we can introduce a more fluent way to do things than
public abstract boolean shouldCopy(Path path).
To achieve the goal:
1、Create a method named shouldCopy(CopyListingFileStatus fileStatus) in
CopyFilter abstract method, with a supportFileStatus() swtich method which
return false by default.
2、For subclasses which impl the abstract class and want to use the new
method, should overwrite shouldCopy(CopyListingFileStatus fileStatus) and for
the same time, return supportFileStatus() to true.
3、This change is compatible with old use case.
As a impl:
1、I first create a abstract FileStatusCopyFilter extends CopyFilter
2、then create DirCopyFilter class extends FileStatusCopyFilter
3、and , implement UniformRecordInputFormat to support DirCopyFilter
### How was this patch tested?
added unit tests
1、add distcp.filters.class=org.apache.hadoop.tools.DirCopyFilter to
distcp-default.xml or set it by
-Ddistcp.filters.class=org.apache.hadoop.tools.DirCopyFilter
2、then execute distcp commands
### For code changes:
- [ ] Does the title or this PR starts with the corresponding JIRA issue id
(e.g. 'HADOOP-17799. Your PR title ...')?
- [ ] Object storage: have the integration tests been executed and the
endpoint declared according to the connector-specific documentation?
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`,
`NOTICE-binary` files?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]