OAGi / Score

Score
MIT License
9 stars 6 forks source link

AVSC schemas are generating with invalid integer field #1602

Closed smorgan19 closed 8 months ago

smorgan19 commented 9 months ago

Integers are represent as int in avro, but when expressed integer is spelled out. For a valid schema the value should be int. image

image https://avro.apache.org/docs/1.11.1/specification/

hakjuoh commented 9 months ago

@smorgan19 Thanks for reporting this issue. We've used xbt.avro_map columns to express data types in the AVRO schema format, and I found out that there are three numeric types mapped to 'integer', not 'int'.

SELECT `xbt_id`, `name`, `avro_map` FROM `xbt` WHERE `avro_map` LIKE '%integer%';
xbt_id name avro_map
21 integer {"type":"integer"}
22 non negative integer {"type":"integer"}
23 positive integer {"type":"integer"}

This can be fixed by executing the following update query:

UPDATE `xbt` SET `avro_map` = '{"type":"int"}' WHERE `xbt_id` IN (SELECT `xbt_id` FROM `xbt` WHERE `avro_map` LIKE '%integer%');

If this is urgent, you can execute that update query directly.