pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [pulsar] jerrypeng edited a comment on issue #3741: POJO AvroSchema always allowNull
Date Tue, 05 Mar 2019 07:17:41 GMT
jerrypeng edited a comment on issue #3741: POJO AvroSchema always allowNull
URL: https://github.com/apache/pulsar/issues/3741#issuecomment-469565479
 
 
   @sijie yup though I am not sure setting AllowNull is producing an incompatible schema.
 Incompatible to what?  I guess if a user wrote some code:
   
   ```
   ReflectData.get().getSchema(MyClass.class)
   ```
   
   and they didn't set allow null then it wouldn't be compatible with the current schema generated
from AvroSchema but my implementation could just have easily set allow null.   Thus, this
doesn't seem like big deal and arbitrary. 
   
   However in Java, classes can be null and primitives cannot be.  Should we not preserve
that semantic?  Is ```Integer``` the same as ```int```? e.g. should the following class:
   
   ```
    public static class Foo {
           int field1;
   }
   ```
   generate the same AVRO schema as
   
   ```
    public static class Foo {
           Integer field1;
   ```
   ?
   
   I am fine with removing AllowNull by default  if everyone wants to do it but I think the
bigger problem here is the one with shading and how generated java classes are handled since
that is a API/standard that should work across systems.

----------------------------------------------------------------
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


With regards,
Apache Git Services

Mime
View raw message