Skip to content

ThriftRecordConverter throws NPE for unrecognized enum values #1867

@asfimport

Description

@asfimport

currently:

    @Override
    public void addBinary(final Binary value) {
      final int id = enumLookup.get(value);
      events.add(new ParquetProtocol("readI32() enum") {
        @Override
        public int readI32() throws TException {
          return id;
        }
      });
    }

the auto-unboxing from Integer to into throws a NPE when enumLookup.get(value) == null – we should throw a better exception here that includes the value in question.

This was actually triggered by someone renaming an enum, and because parquet stores enums by name instead of ID it is not compatible. I'm not sure why we store enums as strings, but we might want to reconsider that.

Reporter: Alex Levenson / @isnotinvain
Assignee: Alex Levenson / @isnotinvain

Related issues:

PRs and other links:

Note: This issue was originally created as PARQUET-350. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions