You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Michael Smith (Jira)" <ji...@apache.org> on 2023/04/20 16:33:00 UTC

[jira] [Commented] (AVRO-2369) Provide external way to construct Schema.Field with default value of 'null'

    [ https://issues.apache.org/jira/browse/AVRO-2369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17714673#comment-17714673 ] 

Michael Smith commented on AVRO-2369:
-------------------------------------

This might have been unnecessary. I'm not sure how "There should be a good path for us to be compatible with both 1.8.2 and 1.9.0" was envisioned, but I can't use {{Field.NULL_DEFAULT_VALUE}} and have weird packaging reasons to want the same code to work in 1.8.2 and 1.11.1. However {{Schema.NULL_VALUE}} seems to accomplish the same thing.

> Provide external way to construct Schema.Field with default value of 'null'
> ---------------------------------------------------------------------------
>
>                 Key: AVRO-2369
>                 URL: https://issues.apache.org/jira/browse/AVRO-2369
>             Project: Apache Avro
>          Issue Type: Task
>          Components: java
>            Reporter: Ivan Greene
>            Assignee: Daniel Kulp
>            Priority: Blocker
>             Fix For: 1.9.0
>
>
> After making the Schema.Field constructor which takes the default value as a JsonNode was made package private, there is no external way to construct a field that has a default value of 'null'. Internally that constructor will call {{JacksonUtils.toJsonNode(defaultValue)}}, which will return 'null' when passed null, and the resulting Field will not have a default value (the json node would need to be NullNode instead of simply null itself). This will affect projects that need a way to dynamically build schemas and their fields.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)