You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/09/19 13:18:27 UTC

[GitHub] [nifi] pvillard31 opened a new pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

pvillard31 opened a new pull request #4538:
URL: https://github.com/apache/nifi/pull/4538


   Thank you for submitting a contribution to Apache NiFi.
   
   Please provide a short description of the PR here:
   
   #### Description of PR
   
   Fix for the issue described in NIFI-7817 and firstly discussed in #4537.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [ ] Does your PR title start with **NIFI-XXXX** where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `main`)?
   
   - [ ] Is your initial contribution a single, squashed commit? _Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not `squash` or use `--force` when pushing to allow for clean monitoring of changes._
   
   ### For code changes:
   - [ ] Have you ensured that the full suite of tests is executed via `mvn -Pcontrib-check clean install` at the root `nifi` folder?
   - [ ] Have you written or updated unit tests to verify your changes?
   - [ ] Have you verified that the full build is successful on JDK 8?
   - [ ] Have you verified that the full build is successful on JDK 11?
   - [ ] 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` file, including the main `LICENSE` file under `nifi-assembly`?
   - [ ] If applicable, have you updated the `NOTICE` file, including the main `NOTICE` file found under `nifi-assembly`?
   - [ ] If adding new Properties, have you added `.displayName` in addition to .name (programmatic access) for each of the new properties?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [nifi] frankgh commented on a change in pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

Posted by GitBox <gi...@apache.org>.
frankgh commented on a change in pull request #4538:
URL: https://github.com/apache/nifi/pull/4538#discussion_r492320381



##########
File path: nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/utils/ParquetUtils.java
##########
@@ -168,9 +168,11 @@ public static ParquetConfig createParquetConfig(final PropertyContext context, f
         final ParquetFileWriter.Mode mode = overwrite ? ParquetFileWriter.Mode.OVERWRITE : ParquetFileWriter.Mode.CREATE;
         parquetConfig.setWriterMode(mode);
 
-        final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
-        final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
-        parquetConfig.setCompressionCodec(codecName);
+        if(context.getProperty(ParquetUtils.COMPRESSION_TYPE).isSet()) {
+            final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
+            final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
+            parquetConfig.setCompressionCodec(codecName);
+        }

Review comment:
       PR #4537 aimed to allow previous functionality to work as it did in previous versions of NiFi. However, the resolution order changed to also address NIFI-7635. In that PR, the `resolvedValue` was determined in this order:
   - configuredValue
   - default value from the ComponentNode
   - default value from the PropertyDescriptor
   
   Whereas in earlier versions of NiFi (pre 1.12.0), the resolution was done in this order:
   - configuredValue
   - default value from the PropertyDescriptor
   - default value from the ComponentNode




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [nifi] bbende commented on pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

Posted by GitBox <gi...@apache.org>.
bbende commented on pull request #4538:
URL: https://github.com/apache/nifi/pull/4538#issuecomment-700690499


   Looks good, will merge, thanks!


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [nifi] pvillard31 commented on a change in pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

Posted by GitBox <gi...@apache.org>.
pvillard31 commented on a change in pull request #4538:
URL: https://github.com/apache/nifi/pull/4538#discussion_r492299109



##########
File path: nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/utils/ParquetUtils.java
##########
@@ -168,9 +168,11 @@ public static ParquetConfig createParquetConfig(final PropertyContext context, f
         final ParquetFileWriter.Mode mode = overwrite ? ParquetFileWriter.Mode.OVERWRITE : ParquetFileWriter.Mode.CREATE;
         parquetConfig.setWriterMode(mode);
 
-        final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
-        final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
-        parquetConfig.setCompressionCodec(codecName);
+        if(context.getProperty(ParquetUtils.COMPRESSION_TYPE).isSet()) {
+            final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
+            final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
+            parquetConfig.setCompressionCodec(codecName);
+        }

Review comment:
       This is most likely because of this change: https://github.com/apache/nifi/commit/4f11e3626093d3090f97c0efc5e229d83b6006e4#diff-782335ecee68f6939c3724dba3983d3d
   That's definitely a good question though: did this impact only this Parquet controller service or did it impact other components? custom code/NARs/etc?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [nifi] bbende commented on a change in pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

Posted by GitBox <gi...@apache.org>.
bbende commented on a change in pull request #4538:
URL: https://github.com/apache/nifi/pull/4538#discussion_r492285575



##########
File path: nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/utils/ParquetUtils.java
##########
@@ -168,9 +168,11 @@ public static ParquetConfig createParquetConfig(final PropertyContext context, f
         final ParquetFileWriter.Mode mode = overwrite ? ParquetFileWriter.Mode.OVERWRITE : ParquetFileWriter.Mode.CREATE;
         parquetConfig.setWriterMode(mode);
 
-        final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
-        final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
-        parquetConfig.setCompressionCodec(codecName);
+        if(context.getProperty(ParquetUtils.COMPRESSION_TYPE).isSet()) {
+            final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
+            final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
+            parquetConfig.setCompressionCodec(codecName);
+        }

Review comment:
       The COMPRESSION_TYPE PropertyDescriptor has a list of allowable values and it also has a default value using the first value which is UNCOMPRESSED, anything with a default value should always return a value so that is why the code didn't check isSet() before.
   
   I'm not terribly offended adding this as an extra precaution, but I am concerned that something else broke that now makes the default value not return.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [nifi] bbende commented on a change in pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

Posted by GitBox <gi...@apache.org>.
bbende commented on a change in pull request #4538:
URL: https://github.com/apache/nifi/pull/4538#discussion_r492295053



##########
File path: nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/utils/ParquetUtils.java
##########
@@ -168,9 +168,11 @@ public static ParquetConfig createParquetConfig(final PropertyContext context, f
         final ParquetFileWriter.Mode mode = overwrite ? ParquetFileWriter.Mode.OVERWRITE : ParquetFileWriter.Mode.CREATE;
         parquetConfig.setWriterMode(mode);
 
-        final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
-        final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
-        parquetConfig.setCompressionCodec(codecName);
+        if(context.getProperty(ParquetUtils.COMPRESSION_TYPE).isSet()) {
+            final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
+            final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
+            parquetConfig.setCompressionCodec(codecName);
+        }

Review comment:
       That is correct, but we always called `ParquetUtils createParquetConfig`  from both the reader and writer before and it worked, so I'm confused why now we have to check isSet().
   
   The JIRA mentioned https://issues.apache.org/jira/browse/NIFI-7635  so maybe that fix now makes it such that if you call `context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue()` and the component doesn't have that property then you no longer get the default value. Before you did get the default value.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [nifi] bbende commented on a change in pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

Posted by GitBox <gi...@apache.org>.
bbende commented on a change in pull request #4538:
URL: https://github.com/apache/nifi/pull/4538#discussion_r492285575



##########
File path: nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/utils/ParquetUtils.java
##########
@@ -168,9 +168,11 @@ public static ParquetConfig createParquetConfig(final PropertyContext context, f
         final ParquetFileWriter.Mode mode = overwrite ? ParquetFileWriter.Mode.OVERWRITE : ParquetFileWriter.Mode.CREATE;
         parquetConfig.setWriterMode(mode);
 
-        final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
-        final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
-        parquetConfig.setCompressionCodec(codecName);
+        if(context.getProperty(ParquetUtils.COMPRESSION_TYPE).isSet()) {
+            final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
+            final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
+            parquetConfig.setCompressionCodec(codecName);
+        }

Review comment:
       The COMPRESSION_TYPE PropertyDescriptor has a list of allowable values and it also has a default value using the first value which is UNCOMPRESSED, anything with a default value should always return a value so that is why the code didn't check isSet() before.
   
   I'm not terribly offended adding this as an extra precaution, but I am concerned that something else broke that now makes the default value not return.

##########
File path: nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/utils/ParquetUtils.java
##########
@@ -168,9 +168,11 @@ public static ParquetConfig createParquetConfig(final PropertyContext context, f
         final ParquetFileWriter.Mode mode = overwrite ? ParquetFileWriter.Mode.OVERWRITE : ParquetFileWriter.Mode.CREATE;
         parquetConfig.setWriterMode(mode);
 
-        final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
-        final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
-        parquetConfig.setCompressionCodec(codecName);
+        if(context.getProperty(ParquetUtils.COMPRESSION_TYPE).isSet()) {
+            final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
+            final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
+            parquetConfig.setCompressionCodec(codecName);
+        }

Review comment:
       That is correct, but we always called `ParquetUtils createParquetConfig`  from both the reader and writer before and it worked, so I'm confused why now we have to check isSet().
   
   The JIRA mentioned https://issues.apache.org/jira/browse/NIFI-7635  so maybe that fix now makes it such that if you call `context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue()` and the component doesn't have that property then you no longer get the default value. Before you did get the default value.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [nifi] pvillard31 commented on a change in pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

Posted by GitBox <gi...@apache.org>.
pvillard31 commented on a change in pull request #4538:
URL: https://github.com/apache/nifi/pull/4538#discussion_r492291850



##########
File path: nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/utils/ParquetUtils.java
##########
@@ -168,9 +168,11 @@ public static ParquetConfig createParquetConfig(final PropertyContext context, f
         final ParquetFileWriter.Mode mode = overwrite ? ParquetFileWriter.Mode.OVERWRITE : ParquetFileWriter.Mode.CREATE;
         parquetConfig.setWriterMode(mode);
 
-        final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
-        final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
-        parquetConfig.setCompressionCodec(codecName);
+        if(context.getProperty(ParquetUtils.COMPRESSION_TYPE).isSet()) {
+            final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
+            final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
+            parquetConfig.setCompressionCodec(codecName);
+        }

Review comment:
       There is no COMPRESSION_TYPE PropertyDescriptor in the ParquetReader controller service which is causing the NPE initially discussed in #4537.

##########
File path: nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/utils/ParquetUtils.java
##########
@@ -168,9 +168,11 @@ public static ParquetConfig createParquetConfig(final PropertyContext context, f
         final ParquetFileWriter.Mode mode = overwrite ? ParquetFileWriter.Mode.OVERWRITE : ParquetFileWriter.Mode.CREATE;
         parquetConfig.setWriterMode(mode);
 
-        final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
-        final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
-        parquetConfig.setCompressionCodec(codecName);
+        if(context.getProperty(ParquetUtils.COMPRESSION_TYPE).isSet()) {
+            final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
+            final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
+            parquetConfig.setCompressionCodec(codecName);
+        }

Review comment:
       This is most likely because of this change: https://github.com/apache/nifi/commit/4f11e3626093d3090f97c0efc5e229d83b6006e4#diff-782335ecee68f6939c3724dba3983d3d
   That's definitely a good question though: did this impact only this Parquet controller service or did it impact other components? custom code/NARs/etc?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [nifi] pvillard31 commented on a change in pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

Posted by GitBox <gi...@apache.org>.
pvillard31 commented on a change in pull request #4538:
URL: https://github.com/apache/nifi/pull/4538#discussion_r492291850



##########
File path: nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/utils/ParquetUtils.java
##########
@@ -168,9 +168,11 @@ public static ParquetConfig createParquetConfig(final PropertyContext context, f
         final ParquetFileWriter.Mode mode = overwrite ? ParquetFileWriter.Mode.OVERWRITE : ParquetFileWriter.Mode.CREATE;
         parquetConfig.setWriterMode(mode);
 
-        final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
-        final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
-        parquetConfig.setCompressionCodec(codecName);
+        if(context.getProperty(ParquetUtils.COMPRESSION_TYPE).isSet()) {
+            final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
+            final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
+            parquetConfig.setCompressionCodec(codecName);
+        }

Review comment:
       There is no COMPRESSION_TYPE PropertyDescriptor in the ParquetReader controller service which is causing the NPE initially discussed in #4537.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [nifi] bbende merged pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

Posted by GitBox <gi...@apache.org>.
bbende merged pull request #4538:
URL: https://github.com/apache/nifi/pull/4538


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [nifi] frankgh commented on a change in pull request #4538: NIFI-7817 - Fix ParquetReader instantiation error

Posted by GitBox <gi...@apache.org>.
frankgh commented on a change in pull request #4538:
URL: https://github.com/apache/nifi/pull/4538#discussion_r492320381



##########
File path: nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/main/java/org/apache/nifi/parquet/utils/ParquetUtils.java
##########
@@ -168,9 +168,11 @@ public static ParquetConfig createParquetConfig(final PropertyContext context, f
         final ParquetFileWriter.Mode mode = overwrite ? ParquetFileWriter.Mode.OVERWRITE : ParquetFileWriter.Mode.CREATE;
         parquetConfig.setWriterMode(mode);
 
-        final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
-        final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
-        parquetConfig.setCompressionCodec(codecName);
+        if(context.getProperty(ParquetUtils.COMPRESSION_TYPE).isSet()) {
+            final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
+            final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
+            parquetConfig.setCompressionCodec(codecName);
+        }

Review comment:
       PR #4537 aimed to allow previous functionality to work as it did in previous versions of NiFi. However, the resolution order changed to also address NIFI-7635. In that PR, the `resolvedValue` was determined in this order:
   - configuredValue
   - default value from the ComponentNode
   - default value from the PropertyDescriptor
   
   Whereas in earlier versions of NiFi (pre 1.12.0), the resolution was done in this order:
   - configuredValue
   - default value from the PropertyDescriptor
   - default value from the ComponentNode




----------------------------------------------------------------
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:
users@infra.apache.org