Hello!  I'm pretty sure that I've used enums with implementations and
ReflectData successfully, even with old versions of Avro.

It seems to work with 1.9.x+ with the following ReflectDatumWriter
(where datum is an instance of the TestEnum):

      Encoder encoder = EncoderFactory.get().binaryEncoder(baos, null);
      DatumWriter<T> w = new
ReflectDatumWriter<>(ReflectData.get().getSchema(TestEnum.class));
      w.write(datum, encoder);
      encoder.flush();

Do you have any extra detail about how you're constructing the
ReflectDatumWriter or getting the schema for the TestEnum?

On Fri, Jun 25, 2021 at 9:39 AM Swamy Thota <swamy...@gmail.com> wrote:
>
> Hi All,
>
> I’m seeing an issue with ReflectDatumWriter when the enum implements methods 
> as below:
>
> enum TestEnum {
>         V{
>                 @Override
>                 public boolean is_V(){
>                         return true;
>                 }
>         }
>
>         K{
>                 @Override
>                 public boolean is_K(){
>                         return true;
>                 }
>         }
>
>         public boolean is_V(){
>                 return false;
>         }
>
>         public boolean is_K(){
>                 return false;
>         }
> }
>
> This type of enums are failing with SchemaParseException: Empty name. Is 
> there any work around or a fix available, appreciate the help in advance.
>
> Thanks,
> Swamy

Reply via email to