[
https://issues.apache.org/jira/browse/AVRO-1792?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kevin J. Price updated AVRO-1792:
---------------------------------
Description:
Using the new Schema.Field constructors added in 1.8.0, it is no longer
possible to use the Java API to construct a schema field with a 'null' default
value. That is, the following schema cannot be constructed without using the
deprecated API:
{code}
{
"type": "record",
"name": "base",
"fields": [{
"name": "a",
"type": ["null", "string"],
"default": null
}]
}
{code}
This is because passing a "null" value to the new API implies no default.
Passing the "JsonProperties.NULL_VALUE" sentinel value doesn't work either,
because when it is parsed by "JacksonUtils.toJsonNode", it turns into "null".
was:
Using the new Schema.Field constructors added in 1.8.0, it is no longer
possible to use the Java API to construct a schema field with a 'null' default
value. That is, the following schema cannot be constructed without using the
deprecated API:
{code}
{
"type": "record",
"name": "base",
"fields": [{
"name": "a",
"type": ["null", "string"],
"default": null
}]
}
{code}
This is because passing a "null" value to the new API implies no default, and
passing the "JsonProperties.NULL_VALUE" sentinel value doesn't work either,
because when it is parsed by "JacksonUtils.toJsonNode", it turns into "null".
> Cannot specify a 'null' default value
> -------------------------------------
>
> Key: AVRO-1792
> URL: https://issues.apache.org/jira/browse/AVRO-1792
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.8.0
> Reporter: Kevin J. Price
> Priority: Minor
>
> Using the new Schema.Field constructors added in 1.8.0, it is no longer
> possible to use the Java API to construct a schema field with a 'null'
> default value. That is, the following schema cannot be constructed without
> using the deprecated API:
> {code}
> {
> "type": "record",
> "name": "base",
> "fields": [{
> "name": "a",
> "type": ["null", "string"],
> "default": null
> }]
> }
> {code}
> This is because passing a "null" value to the new API implies no default.
> Passing the "JsonProperties.NULL_VALUE" sentinel value doesn't work either,
> because when it is parsed by "JacksonUtils.toJsonNode", it turns into "null".
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)