NIFI-7817 - Fix ParquetReader instantiation error#4538
Conversation
| final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue(); | ||
| final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue); | ||
| parquetConfig.setCompressionCodec(codecName); | ||
| } |
There was a problem hiding this 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.
There was a problem hiding this comment.
There is no COMPRESSION_TYPE PropertyDescriptor in the ParquetReader controller service which is causing the NPE initially discussed in #4537.
There was a problem hiding this 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.
There was a problem hiding this comment.
This is most likely because of this change: 4f11e36#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?
There was a problem hiding this 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
|
Looks good, will merge, thanks! |
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
squashor use--forcewhen pushing to allow for clean monitoring of changes.For code changes:
mvn -Pcontrib-check clean installat the rootnififolder?LICENSEfile, including the mainLICENSEfile undernifi-assembly?NOTICEfile, including the mainNOTICEfile found undernifi-assembly?.displayNamein addition to .name (programmatic access) for each of the new properties?For documentation related changes:
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.