Class UnionMapWriter

java.lang.Object
org.apache.arrow.vector.complex.impl.UnionListWriter
org.apache.arrow.vector.complex.impl.UnionMapWriter
All Implemented Interfaces:
AutoCloseable, Positionable, BaseWriter, BaseWriter.ListWriter, BaseWriter.MapWriter, BaseWriter.ScalarWriter, BaseWriter.StructWriter, BigIntWriter, BitWriter, DateDayWriter, DateMilliWriter, Decimal256Writer, DecimalWriter, DurationWriter, FieldWriter, FixedSizeBinaryWriter, Float2Writer, Float4Writer, Float8Writer, IntervalDayWriter, IntervalMonthDayNanoWriter, IntervalYearWriter, IntWriter, LargeVarBinaryWriter, LargeVarCharWriter, SmallIntWriter, TimeMicroWriter, TimeMilliWriter, TimeNanoWriter, TimeSecWriter, TimeStampMicroTZWriter, TimeStampMicroWriter, TimeStampMilliTZWriter, TimeStampMilliWriter, TimeStampNanoTZWriter, TimeStampNanoWriter, TimeStampSecTZWriter, TimeStampSecWriter, TinyIntWriter, UInt1Writer, UInt2Writer, UInt4Writer, UInt8Writer, VarBinaryWriter, VarCharWriter, ViewVarBinaryWriter, ViewVarCharWriter

public class UnionMapWriter extends UnionListWriter

Writer for MapVectors. This extends UnionListWriter to simplify writing map entries to a list of struct elements, with "key" and "value" fields. The procedure for writing a map begin with startMap() followed by startEntry(). An entry is written by using the key() writer to write the key, then the value() writer to write a value. After writing the value, call endEntry() to complete the entry. Each map can have 1 or more entries. When done writing entries, call endMap() to complete the map.

NOTE: the MapVector can have NULL values by not writing to position. If a map is started with startMap(), then it must have a key written. The value of a map entry can be NULL by not using the value() writer.

Example to write the following map to position 5 of a vector

{@code
   // {
   //   1 -> 3,
   //   2 -> 4,
   //   3 -> NULL
   // }

   UnionMapWriter writer = ...

   writer.setPosition(5);
   writer.startMap();
   writer.startEntry();
   writer.key().integer().writeInt(1);
   writer.value().integer().writeInt(3);
   writer.endEntry();
   writer.startEntry();
   writer.key().integer().writeInt(2);
   writer.value().integer().writeInt(4);
   writer.endEntry();
   writer.startEntry();
   writer.key().integer().writeInt(3);
   writer.endEntry();
   writer.endMap();
 </pre>
 </p>