You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2022/01/29 12:58:00 UTC
[jira] [Commented] (NIFI-9629) Avro Writer Schema Default Value not correctly being set
[ https://issues.apache.org/jira/browse/NIFI-9629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17484142#comment-17484142 ]
ASF subversion and git services commented on NIFI-9629:
-------------------------------------------------------
Commit 038811d0dd8d317b6cfe0cffd3f1f4be78753250 in nifi's branch refs/heads/main from Mark Payne
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=038811d ]
NIFI-9629: Ensure that when we are setting default values on Avro GenericRecord objects that we convert from the schema's default value to the proper type
Signed-off-by: Pierre Villard <pi...@gmail.com>
This closes #5716.
> Avro Writer Schema Default Value not correctly being set
> --------------------------------------------------------
>
> Key: NIFI-9629
> URL: https://issues.apache.org/jira/browse/NIFI-9629
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Affects Versions: 1.15.0, 1.16.0, 1.15.1, 1.15.2, 1.15.3
> Environment: WSL Ubuntu, Java 11 Open JDK
> Reporter: Nathan English
> Assignee: Mark Payne
> Priority: Major
> Attachments: Avro_Default_Value_Conversion_Issue_-_20220125.xml
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Using the Avro Record Set Writer to create fields that don't exist and set default values is currently causing issues. I haven't tested all the possible types, but below are the ones I have tested:
> * String with string default value - OK
> * String with null - {color:#FF0000}Error{color}
> * Byte with null - {color:#FF0000}Error{color}
> * Int with 0 Default value - OK
> * Long with 0 default value - {color:#FF0000}Error{color}
> {color:#172b4d}Looking at the AvroTypeUtil class when the field is put with its default value the null, is actually an org.apache.avro.JsonProperties$Null instead of an actual null value. The long is actually a default of an int value. These both throw errors when being encoded to the Avro Format.{color}
> {color:#172b4d}The attached flow successfully reproduces the errors.{color}
>
> {color:#172b4d}I have tested the flow and it successfully works in v1.12.1, but not a build from the main branch.{color}
>
> {color:#172b4d}This issue leads on from NIFI-9594{color}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)