Zoltan Csizmadia created AVRO-3477:
--------------------------------------

             Summary: Fix logical types in C# if the base type is fixed
                 Key: AVRO-3477
                 URL: https://issues.apache.org/jira/browse/AVRO-3477
             Project: Apache Avro
          Issue Type: Improvement
          Components: csharp
            Reporter: Zoltan Csizmadia


[~davidjsimonsTTD] mentioned this in 
https://issues.apache.org/jira/browse/AVRO-2359:

I've been working with the initial MR for Logical Types and notice that as 
written the code doesn't support the following form of fixed decimal

 
{code:java}
{
  "name": "decimal_9", 
  "type": "fixed", 
  "size": 4,
  "logicalType": "decimal", 
  "precision": 9, 
  "scale": 2"
}
{code}
 

The exception is currently:

Avro.Test.LogicalTypeTests.TestFixedDecimal("-000000000000000001.01")

Avro.SchemaParseException : Undefined name: fixed at 'type'
at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) in 
C:\src\GitHub\avro\lang\csharp\src\apache\main\Schema\Schema.cs:line 174
at Avro.LogicalSchema.NewInstance(JToken jtok, PropertyMap props, SchemaNames 
names, String encspace) in 
C:\src\GitHub\avro\lang\csharp\src\apache\main\Schema\LogicalSchema.cs:line 50
at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) in 
C:\src\GitHub\avro\lang\csharp\src\apache\main\Schema\Schema.cs:line 196
at Avro.Schema.Parse(String json, SchemaNames names, String encspace) in 
C:\src\GitHub\avro\lang\csharp\src\apache\main\Schema\Schema.cs:line 253
at Avro.Schema.Parse(String json) in 
C:\src\GitHub\avro\lang\csharp\src\apache\main\Schema\Schema.cs:line 219
at Avro.Test.LogicalTypeTests.TestFixedDecimal(String s) in 
C:\src\GitHub\avro\lang\csharp\src\apache\test\Util\LogicalTypeTests.cs:line 55.

 

 

The usage of the above scenario is very powerfull if implementations, where you 
have hundreds of uses of decimal values where you want them to all, support the 
same specification.   I'm still looking at the code to understand what the best 
answer would be but it would need to be some form of named logical scheme. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to