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:
[email protected]