You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Michael A. Smith (Jira)" <ji...@apache.org> on 2023/07/28 23:47:00 UTC

[jira] [Created] (AVRO-3816) Replace the properties sidecar with first-class attributes

Michael A. Smith created AVRO-3816:
--------------------------------------

             Summary: Replace the properties sidecar with first-class attributes
                 Key: AVRO-3816
                 URL: https://issues.apache.org/jira/browse/AVRO-3816
             Project: Apache Avro
          Issue Type: Improvement
          Components: python
            Reporter: Michael A. Smith


The Python Schema classes have manually implemented "properties" that I've always struggled to understand.

Python has "always" had a very flexible meta-object protocol, by which I mean you can always attach arbitrary properties to an object. So attaching an entire "properties" dictionary distinct from the object's own attributes only makes sense if you need to isolate some set of properties from others in some way. And maybe that's the case: We want to be able to distinguish canonical and standard properties from custom ones. But lang/py uses these "sidecar" properties for everything, canonical and otherwise. name, type, fields, symbols, and arbitrary properties alike. The cost for this is high, making the objects larger, more mutable, and cumbersome to typecheck.

I've tried not to mess with them, because I didn't want to break backwards compatibility, but the property implementation is the main thing holding back further efforts to type hint the library.

I think it's possible to remove "get_prop", "set_prop" etc from Schema without breaking most of the API, but if someone is using those functions directly, well, they won't be there anymore.

I'll create a PoC and we can discuss the implications of backwards incompat.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)