ZENOTME commented on PR #2650:
URL: https://github.com/apache/avro/pull/2650#issuecomment-1868751043
Find a interesting case:
```
let schema = Schema::parse_str(
r#"
{
"type" : "record",
"name" : "record",
"fields" : [
{
"type" : "enum",
"name" : "enum",
"symbols": ["one", "two", "three"]
},
{ "name" : "next", "type" : "enum" }
]
}
"#,
)?;
// schema
RecordField {
name: "enum",
doc: None,
aliases: None,
default: None,
schema: Enum(
EnumSchema {
name: Name {
name: "enum",
namespace: None,
},
aliases: None,
doc: None,
symbols: [
"one",
"two",
"three",
],
default: None,
attributes: {},
},
),
order: Ascending,
position: 0,
custom_attributes: {
"symbols": Array [
String("one"),
String("two"),
String("three"),
],
},
},
```
`"symbols": ["one", "two", "three"]` will be treated as custom attributes
and symbols, seems there are some problem here:
1. Is that str valid? Should it write as
```
r#"
{
"type" : "record",
"name" : "record",
"fields" : [
{
"name": "enum"
"type" : {
"type": "enum",
"name" : "enum",
"symbols": ["one", "two", "three"]
}
},
{ "name" : "next", "type" : "enum" }
]
}
"#,
```
I tried this one and the symbols will not be treated as custom attributes.
2. If the above 1 is right, then we should treat symbols in following case
as attributes as custom attributes rather than symbols, right?🤔
```
"fields" :[{
"type" : "enum",
"name" : "enum",
"symbols": ["one", "two", "three"]
}]
```
cc @martin-g
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]