Package org.apache.iceberg.util
Class PartitionMap<V>
- java.lang.Object
-
- java.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
- org.apache.iceberg.util.PartitionMap<V>
-
- Type Parameters:
V
- the type of values
- All Implemented Interfaces:
java.util.Map<Pair<java.lang.Integer,StructLike>,V>
public class PartitionMap<V> extends java.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
A map that uses a pair of spec ID and partition tuple as keys.This implementation internally stores provided partition tuples in
StructLikeMap
for consistent hashing and equals behavior. This ensures that objects of different types that represent the same structs are treated as equal keys in the map.Note: This map is not designed for concurrent modification by multiple threads. However, it supports safe concurrent reads, assuming there are no concurrent writes.
Note: This map does not support null pairs but supports null as partition tuples.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
V
computeIfAbsent(int specId, StructLike struct, java.util.function.Supplier<V> valueSupplier)
boolean
containsKey(int specId, StructLike struct)
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
static <T> PartitionMap<T>
create(java.util.Map<java.lang.Integer,PartitionSpec> specs)
java.util.Set<java.util.Map.Entry<Pair<java.lang.Integer,StructLike>,V>>
entrySet()
V
get(int specId, StructLike struct)
V
get(java.lang.Object key)
boolean
isEmpty()
java.util.Set<Pair<java.lang.Integer,StructLike>>
keySet()
V
put(int specId, StructLike struct, V value)
V
put(Pair<java.lang.Integer,StructLike> key, V value)
void
putAll(java.util.Map<? extends Pair<java.lang.Integer,StructLike>,? extends V> otherMap)
V
remove(java.lang.Object key)
V
removeKey(int specId, StructLike struct)
int
size()
java.lang.String
toString()
java.util.Collection<V>
values()
-
-
-
Method Detail
-
create
public static <T> PartitionMap<T> create(java.util.Map<java.lang.Integer,PartitionSpec> specs)
-
size
public int size()
- Specified by:
size
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
size
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
isEmpty
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKey
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
containsKey
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
containsKey
public boolean containsKey(int specId, StructLike struct)
-
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValue
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
containsValue
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
get
public V get(java.lang.Object key)
- Specified by:
get
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
get
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
get
public V get(int specId, StructLike struct)
-
put
public V put(Pair<java.lang.Integer,StructLike> key, V value)
- Specified by:
put
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
put
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
put
public V put(int specId, StructLike struct, V value)
-
putAll
public void putAll(java.util.Map<? extends Pair<java.lang.Integer,StructLike>,? extends V> otherMap)
- Specified by:
putAll
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
putAll
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
remove
public V remove(java.lang.Object key)
- Specified by:
remove
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
remove
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
removeKey
public V removeKey(int specId, StructLike struct)
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
clear
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
keySet
public java.util.Set<Pair<java.lang.Integer,StructLike>> keySet()
- Specified by:
keySet
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
keySet
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
values
public java.util.Collection<V> values()
- Specified by:
values
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Overrides:
values
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
entrySet
public java.util.Set<java.util.Map.Entry<Pair<java.lang.Integer,StructLike>,V>> entrySet()
- Specified by:
entrySet
in interfacejava.util.Map<Pair<java.lang.Integer,StructLike>,V>
- Specified by:
entrySet
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
computeIfAbsent
public V computeIfAbsent(int specId, StructLike struct, java.util.function.Supplier<V> valueSupplier)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.AbstractMap<Pair<java.lang.Integer,StructLike>,V>
-
-