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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to