Skip to content

UnionMapWriter fails to write fixed size binary #586

@nbauernfeind

Description

@nbauernfeind

A UnionMapWriter will null out the entire map struct entry instead of setting the value to null:

                childWriter.value().fixedSizeBinary().writeNull();

Actually hits NullableStructWriter#writeNull whereas UnionMapWriter should override writeNull and do a switch on the mode (though I'm not certain if null keys are valid).

EDIT:
Actually, the issue is that fixedSizeBinary needs to be overriden! Very frustrating, but this call is not overridden and is instead invoking UnionListWriter#fixedSizeBinary():

  @Override
  public FixedSizeBinaryWriter fixedSizeBinary() {
    return this;
  }

The real impl needs to override like so:

  @Override
  public FixedSizeBinaryWriter fixedSizeBinary() {
    switch (mode) {
      case KEY:
        return entryWriter.fixedSizeBinary(MapVector.KEY_NAME);
      case VALUE:
        return entryWriter.fixedSizeBinary(MapVector.VALUE_NAME);
      default:
        return this;
    }
  }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions