[jira] [Commented] (AVRO-1950) Better Json serialization for Avro decimal logical types?

2020-06-30 Thread Werner Daehn (Jira)


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

Werner Daehn commented on AVRO-1950:


Food for thought:

[https://issues.apache.org/jira/projects/AVRO/issues/AVRO-2871]

> Better Json serialization for Avro decimal logical types?
> -
>
> Key: AVRO-1950
> URL: https://issues.apache.org/jira/browse/AVRO-1950
> Project: Apache Avro
>  Issue Type: Improvement
>  Components: java
>Reporter: Zoltan Farkas
>Priority: Minor
>
> Currently as I understand decimal logical types are encoded on top of bytes 
> and fixed avro types. This makes them a bit "unnatural" in the json 
> encoding...
> I worked around a hack in my fork to naturally encode them into json 
> decimals. A good starting point to look at is in: 
> https://github.com/zolyfarkas/avro/blob/trunk/lang/java/avro/src/main/java/org/apache/avro/io/DecimalEncoder.java
>  
> My approach is a bit hacky, so I would be interested in suggestions to have 
> this closer to something we can integrate into avro...



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


[jira] [Commented] (AVRO-1950) Better Json serialization for Avro decimal logical types?

2020-06-30 Thread vinisha (Jira)


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

vinisha commented on AVRO-1950:
---

+1

I think same applies for other logical types such as Date, Timestamp etc. It 
would be good to have string conversions of those available by default for 
representing them in json.

> Better Json serialization for Avro decimal logical types?
> -
>
> Key: AVRO-1950
> URL: https://issues.apache.org/jira/browse/AVRO-1950
> Project: Apache Avro
>  Issue Type: Improvement
>  Components: java
>Reporter: Zoltan Farkas
>Priority: Minor
>
> Currently as I understand decimal logical types are encoded on top of bytes 
> and fixed avro types. This makes them a bit "unnatural" in the json 
> encoding...
> I worked around a hack in my fork to naturally encode them into json 
> decimals. A good starting point to look at is in: 
> https://github.com/zolyfarkas/avro/blob/trunk/lang/java/avro/src/main/java/org/apache/avro/io/DecimalEncoder.java
>  
> My approach is a bit hacky, so I would be interested in suggestions to have 
> this closer to something we can integrate into avro...



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


[jira] [Commented] (AVRO-1950) Better Json serialization for Avro decimal logical types?

2017-05-09 Thread Stephane Maarek (JIRA)

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

Stephane Maarek commented on AVRO-1950:
---

has there been any progress on this? bytes are highly uncommon and not json 
friendly, they make serialization and deserialization as avro near impossible

> Better Json serialization for Avro decimal logical types?
> -
>
> Key: AVRO-1950
> URL: https://issues.apache.org/jira/browse/AVRO-1950
> Project: Avro
>  Issue Type: Improvement
>Reporter: Zoltan Farkas
>Priority: Minor
>
> Currently as I understand decimal logical types are encoded on top of bytes 
> and fixed avro types. This makes them a bit "unnatural" in the json 
> encoding...
> I worked around a hack in my fork to naturally encode them into json 
> decimals. A good starting point to look at is in: 
> https://github.com/zolyfarkas/avro/blob/trunk/lang/java/avro/src/main/java/org/apache/avro/io/DecimalEncoder.java
>  
> My approach is a bit hacky, so I would be interested in suggestions to have 
> this closer to something we can integrate into avro...



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (AVRO-1950) Better Json serialization for Avro decimal logical types?

2016-11-07 Thread Ryan Blue (JIRA)

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

Ryan Blue commented on AVRO-1950:
-

I think String is the right encoding for Decimal in JSON. Otherwise, the JSON 
parser will produce a float or a double, which will be an approximation and not 
the exact decimal value.

> Better Json serialization for Avro decimal logical types?
> -
>
> Key: AVRO-1950
> URL: https://issues.apache.org/jira/browse/AVRO-1950
> Project: Avro
>  Issue Type: Improvement
>Reporter: Zoltan Farkas
>Priority: Minor
>
> Currently as I understand decimal logical types are encoded on top of bytes 
> and fixed avro types. This makes them a bit "unnatural" in the json 
> encoding...
> I worked around a hack in my fork to naturally encode them into json 
> decimals. A good starting point to look at is in: 
> https://github.com/zolyfarkas/avro/blob/trunk/lang/java/avro/src/main/java/org/apache/avro/io/DecimalEncoder.java
>  
> My approach is a bit hacky, so I would be interested in suggestions to have 
> this closer to something we can integrate into avro...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (AVRO-1950) Better Json serialization for Avro decimal logical types?

2016-11-07 Thread Zoltan Farkas (JIRA)

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

Zoltan Farkas commented on AVRO-1950:
-

I have been using string encoding for decimal in my fork for a while, and 
"3.14" is a improvement from bytes, but still not the ideal Json 
representation... The more I think about it, making decimal  a core type seems 
like the right approach...

> Better Json serialization for Avro decimal logical types?
> -
>
> Key: AVRO-1950
> URL: https://issues.apache.org/jira/browse/AVRO-1950
> Project: Avro
>  Issue Type: Improvement
>Reporter: Zoltan Farkas
>Priority: Minor
>
> Currently as I understand decimal logical types are encoded on top of bytes 
> and fixed avro types. This makes them a bit "unnatural" in the json 
> encoding...
> I worked around a hack in my fork to naturally encode them into json 
> decimals. A good starting point to look at is in: 
> https://github.com/zolyfarkas/avro/blob/trunk/lang/java/avro/src/main/java/org/apache/avro/io/DecimalEncoder.java
>  
> My approach is a bit hacky, so I would be interested in suggestions to have 
> this closer to something we can integrate into avro...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (AVRO-1950) Better Json serialization for Avro decimal logical types?

2016-11-06 Thread Ryan Blue (JIRA)

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

Ryan Blue commented on AVRO-1950:
-

I've been thinking about this and I think maybe what we should do is to add an 
encoding for Decimal that is a more natural fit for people using JSON. Right 
now, you can store a decimal as bytes or fixed, but that doesn't work well as 
you mentioned. But if we added a String type as well, then that would be suited 
for JSON and wouldn't have a compatibility problem with implementations that 
don't have logical types. This would require adding a String encoding for 
decimal to the spec and toString / fromString methods to the DecimalConversion 
class.

> Better Json serialization for Avro decimal logical types?
> -
>
> Key: AVRO-1950
> URL: https://issues.apache.org/jira/browse/AVRO-1950
> Project: Avro
>  Issue Type: Improvement
>Reporter: Zoltan Farkas
>Priority: Minor
>
> Currently as I understand decimal logical types are encoded on top of bytes 
> and fixed avro types. This makes them a bit "unnatural" in the json 
> encoding...
> I worked around a hack in my fork to naturally encode them into json 
> decimals. A good starting point to look at is in: 
> https://github.com/zolyfarkas/avro/blob/trunk/lang/java/avro/src/main/java/org/apache/avro/io/DecimalEncoder.java
>  
> My approach is a bit hacky, so I would be interested in suggestions to have 
> this closer to something we can integrate into avro...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)