You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by pvillard31 <gi...@git.apache.org> on 2016/10/28 10:35:51 UTC

[GitHub] nifi pull request #1166: NIFI-2963 FetchHDFS should support Compression Code...

GitHub user pvillard31 opened a pull request:

    https://github.com/apache/nifi/pull/1166

    NIFI-2963 FetchHDFS should support Compression Codec property

    

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

    $ git pull https://github.com/pvillard31/nifi fetchhdfs-compression-codec

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

    https://github.com/apache/nifi/pull/1166.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 #1166
    
----
commit 97332aaeb20320347b270d843ea043746f6435e7
Author: Pierre Villard <pi...@gmail.com>
Date:   2016-10-28T10:35:37Z

    NIFI-2963 FetchHDFS should support Compression Codec property

----


---
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] nifi pull request #1166: NIFI-2963 FetchHDFS should support Compression Code...

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

    https://github.com/apache/nifi/pull/1166#discussion_r86179969
  
    --- Diff: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/FetchHDFS.java ---
    @@ -116,10 +123,40 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
                 return;
             }
     
    +        InputStream stream = null;
    +        CompressionCodec codec = null;
    +        Configuration conf = getConfiguration();
    +        final CompressionCodecFactory compressionCodecFactory = new CompressionCodecFactory(conf);
    +        final CompressionType compressionType = CompressionType.valueOf(context.getProperty(COMPRESSION_CODEC).toString());
    +        final boolean inferCompressionCodec = compressionType == CompressionType.AUTOMATIC;
    +
    +        if (inferCompressionCodec || compressionType != CompressionType.NONE) {
    +            codec = getCompressionCodec(context, getConfiguration());
    +        }
    +
             final URI uri = path.toUri();
             final StopWatch stopWatch = new StopWatch(true);
    -        try (final FSDataInputStream inStream = hdfs.open(path, 16384)) {
    -            flowFile = session.importFrom(inStream, flowFile);
    +        try {
    +
    +            final String outputFilename;
    +            final String originalFilename = path.getName();
    +            stream = hdfs.open(path, 16384);
    +
    +            // Check if we should infer compression codec
    +            if (inferCompressionCodec) {
    +                codec = compressionCodecFactory.getCodec(path);
    --- End diff --
    
    I am not sure I understand what;s happening here in relation to line:134. Since both IF statements evaluate ```inferCompressionCodec``` this will always override the value of 'codec' (the one that was set in line:134) if it's ```true```.


---
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] nifi pull request #1166: NIFI-2963 FetchHDFS should support Compression Code...

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

    https://github.com/apache/nifi/pull/1166


---
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] nifi issue #1166: NIFI-2963 FetchHDFS should support Compression Codec prope...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/1166
  
    duh... I must admit I did copy/paste the logic from the GetHDFS processor and didn't catch the loop over files in the GetHDFS processor. Anyway, this should now make much more sense. Thanks for catching that Oleg!


---
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] nifi issue #1166: NIFI-2963 FetchHDFS should support Compression Codec prope...

Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on the issue:

    https://github.com/apache/nifi/pull/1166
  
    Reviewing. . .


---
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] nifi issue #1166: NIFI-2963 FetchHDFS should support Compression Codec prope...

Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on the issue:

    https://github.com/apache/nifi/pull/1166
  
    @pvillard31 much cleaner, thx. merging.


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