You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by GitBox <gi...@apache.org> on 2020/12/13 18:14:22 UTC

[GitHub] [avro] unchuckable commented on pull request #973: AVRO-2952: AvroDatatype

unchuckable commented on pull request #973:
URL: https://github.com/apache/avro/pull/973#issuecomment-744046565


   While I am no maintainer, I'll still offer my two cents from a short browse over what seems like a very interesting PR.
   
   This PR features an interesting approach to extending the handling of logical types. I like the general concept, but I personally feel that the code as presented is not as mature (or I don't understand it enough) as I'd like to see code that's merged into my favourite serialization framework ;)
   
   Points that should be addressed in my eyes:
   * the methods `public String toString()` and `public String toString(StringBuilder, Value)` imply they do something similar, but actually don't
   * the methods `public int hashCode()` are not implemented consistently, and where they are, they all return 1 which leads to bad hashmapping in cases where that might ever be used
   * `public boolean equals()` feels odd where it addresses Arrays and Maps
   * instances of override functions that only call their super version are redundant
   * it is unclear to me why some effectively static final fields are only set as static (leads to short lived wtfs when reading)
   * `getRecommendedSchema` returns null in some cases (arrays, maps, records), but neither interface or javadoc specify that
   
   I wonder if it would be possible to reduce the PR size a lot by using a parameterized base class for the most common datatypes and only override code that actually changes between the different classes. (functions like `getBackingType`, `getRecommendedSchema`, `getAvroType` and `getConvertedType` are basically the same in all cases)
   
   Again, as I said above, I like the general concept, and I am sure the presented PR can be "prettied up" quite a bit to be easier readable and understandable.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org