Interface PqMap
Type-safe interface for accessing Parquet MAP values.
A MAP in Parquet is stored as a list of key-value entries. This interface provides type-safe access to the entries with dedicated accessor methods.
PqMap attributes = row.getMap("attributes");
for (PqMap.Entry entry : attributes.getEntries()) {
String key = entry.getStringKey();
int value = entry.getIntValue();
}
A PqMap and its PqMap.Entry objects are flyweights over the batch of rows they
were read from: accessors read the column data on each call. They can be held
after the reader moves on and keep reading their own row; while one is
reachable, the values of every projected column in that batch stay in memory.
To keep a few maps of many rows, copy their entries out instead.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA single key-value entry in a map. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(byte[] key) True if this map contains an entry with the given byte-array key.booleancontainsKey(int key) True if this map contains an entry with the given INT32 key.booleancontainsKey(long key) True if this map contains an entry with the given INT64 key.booleancontainsKey(String key) True if this map contains an entry with the given STRING key.Get all entries in this map.getRawValue(byte[] key) Look up the raw physical value for a byte-array key — mirrorsPqMap.Entry.getRawValue().getRawValue(int key) Look up the raw physical value for an INT32 key — mirrorsPqMap.Entry.getRawValue().getRawValue(long key) Look up the raw physical value for an INT64 key — mirrorsPqMap.Entry.getRawValue().getRawValue(String key) Look up the raw physical value for a STRING key — mirrorsPqMap.Entry.getRawValue().getValue(byte[] key) Look up the decoded value for a byte-array key.getValue(int key) Look up the decoded value for an INT32 key.getValue(long key) Look up the decoded value for an INT64 key.Look up the decoded value for a STRING key.booleanisEmpty()Check if this map is empty.intsize()Get the number of entries in this map.
-
Method Details
-
getEntries
-
size
int size()Get the number of entries in this map.- Returns:
- the entry count
-
isEmpty
boolean isEmpty()Check if this map is empty.- Returns:
- true if the map has no entries
-
containsKey
True if this map contains an entry with the given STRING key.- Throws:
NullPointerException- ifkeyis null
-
containsKey
boolean containsKey(int key) True if this map contains an entry with the given INT32 key. -
containsKey
boolean containsKey(long key) True if this map contains an entry with the given INT64 key. -
containsKey
boolean containsKey(byte[] key) True if this map contains an entry with the given byte-array key. Byte equality follows [java.util.Arrays#equals(byte[], byte[])].- Throws:
NullPointerException- ifkeyis null
-
getValue
Look up the decoded value for a STRING key.
Returns the same form as
PqMap.Entry.getValue(): boxed primitive,String,LocalDate,BigDecimal,PqStruct/PqList/PqMapfor nested groups, etc.- Returns:
- the decoded value, or
nullif the key is absent or its value is null - Throws:
NullPointerException- ifkeyis null
-
getValue
Look up the decoded value for an INT32 key.- Returns:
- the decoded value, or
nullif the key is absent or its value is null
-
getValue
Look up the decoded value for an INT64 key.- Returns:
- the decoded value, or
nullif the key is absent or its value is null
-
getValue
Look up the decoded value for a byte-array key. Byte equality follows [java.util.Arrays#equals(byte[], byte[])].- Returns:
- the decoded value, or
nullif the key is absent or its value is null - Throws:
NullPointerException- ifkeyis null
-
getRawValue
Look up the raw physical value for a STRING key — mirrorsPqMap.Entry.getRawValue().- Returns:
- the raw value, or
nullif the key is absent or its value is null - Throws:
NullPointerException- ifkeyis null
-
getRawValue
Look up the raw physical value for an INT32 key — mirrorsPqMap.Entry.getRawValue().- Returns:
- the raw value, or
nullif the key is absent or its value is null
-
getRawValue
Look up the raw physical value for an INT64 key — mirrorsPqMap.Entry.getRawValue().- Returns:
- the raw value, or
nullif the key is absent or its value is null
-
getRawValue
Look up the raw physical value for a byte-array key — mirrorsPqMap.Entry.getRawValue(). Byte equality follows [java.util.Arrays#equals(byte[], byte[])].- Returns:
- the raw value, or
nullif the key is absent or its value is null - Throws:
NullPointerException- ifkeyis null
-