[
https://issues.apache.org/jira/browse/AVRO-4118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Werner Daehn updated AVRO-4118:
-------------------------------
Description:
Adding customer logical types in Java is no problem, but with Python I get a
warning
{code:java}
avro\schema.py:1233: IgnoredLogicalType: Unknown VARCHAR, using string. {code}
According to the spec, everybody can create new logical types. That is what I
do, in fact. logical types like NVARCHAR(1). Yet the code displays a warning
always.
The general ask is to honor that fact and align to what Java does.
I can see three options here, ordered by preference
# Ability to add custom logical types. In Java this is what you do, you
register additional logical types when initializing the class.
# A global flag to disable the warning.
# Do nothing.
Any change here will not break something, it is fully backward compatible.
[https://github.com/apache/avro/blob/28cb08c15543c8c2dd8d186db2029bfe760940a5/lang/py/avro/schema.py#L1242]
Example field:
{code:java}
{
"name" : "__change_type",
"type" : [ "null", {
"type" : "string",
"logicalType" : "NVARCHAR",
"length" : 1
} ],
"default" : null
} {code}
was:
Adding customer logical types in Java is no problem, but with Python I get a
warning
{code:java}
avro\schema.py:1233: IgnoredLogicalType: Unknown VARCHAR, using string. {code}
[https://github.com/apache/avro/blob/230414abbb68e63e68f3b55bfc0cbca94f2737f6/lang/py/avro/schema.py#L1233]
Looking at above code, there is no extension mechanism, as it seems.
Example field:
{code:java}
{
"name" : "__change_type",
"type" : [ "null", {
"type" : "string",
"logicalType" : "VARCHAR",
"length" : 1
} ],
"default" : null
} {code}
> Custom logical types not supported in Python
> --------------------------------------------
>
> Key: AVRO-4118
> URL: https://issues.apache.org/jira/browse/AVRO-4118
> Project: Apache Avro
> Issue Type: Bug
> Components: logical types, python
> Affects Versions: 1.12.0
> Reporter: Werner Daehn
> Priority: Major
>
> Adding customer logical types in Java is no problem, but with Python I get a
> warning
> {code:java}
> avro\schema.py:1233: IgnoredLogicalType: Unknown VARCHAR, using string. {code}
> According to the spec, everybody can create new logical types. That is what I
> do, in fact. logical types like NVARCHAR(1). Yet the code displays a warning
> always.
> The general ask is to honor that fact and align to what Java does.
> I can see three options here, ordered by preference
> # Ability to add custom logical types. In Java this is what you do, you
> register additional logical types when initializing the class.
> # A global flag to disable the warning.
> # Do nothing.
> Any change here will not break something, it is fully backward compatible.
> [https://github.com/apache/avro/blob/28cb08c15543c8c2dd8d186db2029bfe760940a5/lang/py/avro/schema.py#L1242]
> Example field:
> {code:java}
> {
> "name" : "__change_type",
> "type" : [ "null", {
> "type" : "string",
> "logicalType" : "NVARCHAR",
> "length" : 1
> } ],
> "default" : null
> } {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)