Skip to content

NIFI-7817 - Fix ParquetReader instantiation error#4538

Merged
bbende merged 1 commit intoapache:mainfrom
pvillard31:NIFI-7817
Sep 29, 2020
Merged

NIFI-7817 - Fix ParquetReader instantiation error#4538
bbende merged 1 commit intoapache:mainfrom
pvillard31:NIFI-7817

Conversation

@pvillard31
Copy link
Copy Markdown
Contributor

@pvillard31 pvillard31 commented Sep 19, 2020

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

final String compressionTypeValue = context.getProperty(ParquetUtils.COMPRESSION_TYPE).getValue();
final CompressionCodecName codecName = CompressionCodecName.valueOf(compressionTypeValue);
parquetConfig.setCompressionCodec(codecName);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@bbende
Copy link
Copy Markdown
Contributor

bbende commented Sep 29, 2020

Looks good, will merge, thanks!

@bbende bbende merged commit fa0a1df into apache:main Sep 29, 2020
frankgh pushed a commit to frankgh/nifi that referenced this pull request Sep 29, 2020
driesva pushed a commit to driesva/nifi that referenced this pull request Mar 19, 2021
adenes pushed a commit to adenes/nifi that referenced this pull request Jul 5, 2021
krisztina-zsihovszki pushed a commit to krisztina-zsihovszki/nifi that referenced this pull request Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants