public class ConsistentBucketIndexUtils extends Object
| Constructor and Description |
|---|
ConsistentBucketIndexUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Map<String,Map<String,Integer>> |
generatePartitionToFileIdPfxIdxMap(Map<String,ConsistentBucketIdentifier> partitionToIdentifier)
Initialize fileIdPfx for each data partition.
|
static Option<HoodieConsistentHashingMetadata> |
loadMetadata(HoodieTable table,
String partition)
Loads hashing metadata of the given partition, if it does not exist, returns empty.
|
static HoodieConsistentHashingMetadata |
loadOrCreateMetadata(HoodieTable table,
String partition,
int numBuckets)
Loads hashing metadata of the given partition, if it does not exist, creates a new one (also persist it into storage).
|
static boolean |
saveMetadata(HoodieTable table,
HoodieConsistentHashingMetadata metadata,
boolean overwrite)
Saves the metadata into storage
|
public static HoodieConsistentHashingMetadata loadOrCreateMetadata(HoodieTable table, String partition, int numBuckets)
NOTE: When creating a new hashing metadata, the content will always be the same for the same partition. It means when multiple writer are trying to initialize metadata for the same partition, no lock or synchronization is necessary as they are creating the file with the same content.
table - Hoodie tablepartition - Table partitionnumBuckets - Default bucket numberpublic static Option<HoodieConsistentHashingMetadata> loadMetadata(HoodieTable table, String partition)
table - Hoodie tablepartition - Table partitionpublic static boolean saveMetadata(HoodieTable table, HoodieConsistentHashingMetadata metadata, boolean overwrite)
table - Hoodie tablemetadata - Hashing metadata to be savedoverwrite - Whether to overwrite existing metadatapublic static Map<String,Map<String,Integer>> generatePartitionToFileIdPfxIdxMap(Map<String,ConsistentBucketIdentifier> partitionToIdentifier)
partitionToIdentifier - Mapping from table partition to bucket identifierCopyright © 2023 The Apache Software Foundation. All rights reserved.