[jira] [Commented] (AVRO-3210) how the Avro Schema with Union type can accept the ‘normal JSON’

2021-10-04 Thread Zoltan Farkas (Jira)


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

Zoltan Farkas commented on AVRO-3210:
-

This issue is basically a duplicate of AVRO-1582

I have been using a [custom json 
encoder/decoder|https://github.com/zolyfarkas/avro/blob/trunk/lang/java/avro/src/main/java/org/apache/avro/io/ExtendedJsonDecoder.java]
 for this. I think somebody with time on their hand should should add a new 
json enc/dec...

> how the Avro Schema with Union type can accept the ‘normal JSON’ 
> -
>
> Key: AVRO-3210
> URL: https://issues.apache.org/jira/browse/AVRO-3210
> Project: Apache Avro
>  Issue Type: Improvement
>Reporter: Ning Chang
>Priority: Major
> Attachments: test2.avsc
>
>
> how the Avro Schema with Union type can accept the ‘normal JSON’
> Avro Schema; 
> {
> "name": "middle_name",
> "type": [
> "null",
> "string"
> ],
> "default": null
> }
>  
> how to accept the Normal json payload like:   "middle_name": "chang" ,  not 
> the one:  
> "middle_name": {
> "string": "chang"
> }
> Thanks In advance.
>   



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (AVRO-3135) Add schema serialization/deserialization hooks, to aid implementation of "schema references"

2021-10-04 Thread Zoltan Farkas (Jira)


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

Zoltan Farkas commented on AVRO-3135:
-

I have a PR for this available:

https://github.com/apache/avro/pull/1217

> Add schema serialization/deserialization hooks, to aid implementation of 
> "schema references"
> 
>
> Key: AVRO-3135
> URL: https://issues.apache.org/jira/browse/AVRO-3135
> Project: Apache Avro
>  Issue Type: New Feature
>  Components: java
>Reporter: Zoltan Farkas
>Assignee: Zoltan Farkas
>Priority: Major
>
> This capability's main use case is to allow easy implementation of schema 
> references. For a more detailed writeup please see: 
> https://github.com/zolyfarkas/jaxrs-spf4j-demo/wiki/AvroReferences#why-avro-references



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (AVRO-3218) Pass LogicalType to BytesDecimalSchema in Python

2021-10-04 Thread Martin Tzvetanov Grigorov (Jira)


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

Martin Tzvetanov Grigorov commented on AVRO-3218:
-

[~vegardso] Sorry, I have no experience with Python, so I am not the best 
person to review your proposed change.

What you could do to get it sooner is to create a Pull Request at 
[https://github.com/apache/avro/pulls] and add a test case.

> Pass LogicalType to BytesDecimalSchema in Python
> 
>
> Key: AVRO-3218
> URL: https://issues.apache.org/jira/browse/AVRO-3218
> Project: Apache Avro
>  Issue Type: Bug
>  Components: python
>Affects Versions: 1.10.2
> Environment: I am using  avro 1.10.2. Example file to reproduce the 
> problem. 
> [^issue.py]
>Reporter: Vegard Solberg
>Priority: Major
> Attachments: issue.py
>
>
> I get an error when parsing a schema which contains a field with 
> `logicalType=decimal` in Python. Spesifically, I am using avro.schema.parse() 
> on a schema which have a field on the following format: 
> {code:java}
> { "name": "myField", "type": [ "null", { "type": "bytes", "logicalType": 
> "decimal", "precision": 12, "scale": 2 } ]}
> {code}
> Eventually, make_bytes_decimal_schema() is called. At this point, the 
> variable other_props looks like this (and is fine):
>  
> {code:java}
> other_props = {'logicalType': 'decimal', 'precision': 12, 'scale': 2}{code}
>  
> Unlike the other logical types, the variable other_props is not passed on to 
> BytesDecimalSchema. The result is that the resulting logical_schema is 
> missing the key-value pair 'logicalType': 'decimal'. This blocks me from 
> writing to a kafka topic, because the schema is parsed incorrectly.  The 
> resulting field looks like this:
> {code:java}
> {"type": ["null", {"type": "bytes", "precision": 12, "scale": 2}], "name": 
> "myField"}
> {code}
>  
> The suggested fix is to simply pass other_props as an argument into 
> BytesDecimalSchema(). The attached file [^issue.py]contains code to reproduce 
> the bug
>  
> This commit contains the suggested changes: [AVRO-3218 Fix parsing of 
> logicalType = decimal · vegraux/avro@b5c4a78 
> (github.com)|https://github.com/vegraux/avro/commit/b5c4a78bc314bdecb6e1b7b32ba5d02ab8670c72]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (AVRO-3218) Pass LogicalType to BytesDecimalSchema in Python

2021-10-04 Thread Vegard Solberg (Jira)


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

Vegard Solberg commented on AVRO-3218:
--

[~mgrigorov] Any progress on this one? We need to mirror avro and apply the 
patch on top manually to get around this bug. 

> Pass LogicalType to BytesDecimalSchema in Python
> 
>
> Key: AVRO-3218
> URL: https://issues.apache.org/jira/browse/AVRO-3218
> Project: Apache Avro
>  Issue Type: Bug
>  Components: python
>Affects Versions: 1.10.2
> Environment: I am using  avro 1.10.2. Example file to reproduce the 
> problem. 
> [^issue.py]
>Reporter: Vegard Solberg
>Priority: Major
> Attachments: issue.py
>
>
> I get an error when parsing a schema which contains a field with 
> `logicalType=decimal` in Python. Spesifically, I am using avro.schema.parse() 
> on a schema which have a field on the following format: 
> {code:java}
> { "name": "myField", "type": [ "null", { "type": "bytes", "logicalType": 
> "decimal", "precision": 12, "scale": 2 } ]}
> {code}
> Eventually, make_bytes_decimal_schema() is called. At this point, the 
> variable other_props looks like this (and is fine):
>  
> {code:java}
> other_props = {'logicalType': 'decimal', 'precision': 12, 'scale': 2}{code}
>  
> Unlike the other logical types, the variable other_props is not passed on to 
> BytesDecimalSchema. The result is that the resulting logical_schema is 
> missing the key-value pair 'logicalType': 'decimal'. This blocks me from 
> writing to a kafka topic, because the schema is parsed incorrectly.  The 
> resulting field looks like this:
> {code:java}
> {"type": ["null", {"type": "bytes", "precision": 12, "scale": 2}], "name": 
> "myField"}
> {code}
>  
> The suggested fix is to simply pass other_props as an argument into 
> BytesDecimalSchema(). The attached file [^issue.py]contains code to reproduce 
> the bug
>  
> This commit contains the suggested changes: [AVRO-3218 Fix parsing of 
> logicalType = decimal · vegraux/avro@b5c4a78 
> (github.com)|https://github.com/vegraux/avro/commit/b5c4a78bc314bdecb6e1b7b32ba5d02ab8670c72]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)