public class CustomAvroKeyGenerator extends BaseKeyGenerator
properties.put("hoodie.datasource.write.partitionpath.field", "field1:PartitionKeyType1,field2:PartitionKeyType2").
The complete partition path is created as
Few points to consider: 1. If you want to customize some partition path field on a timestamp basis, you can use field1:timestampBased 2. If you simply want to have the value of your configured
field in the partition path, use field1:simple 3. If you want your table to be non partitioned, simply leave it as blank.
RecordKey is internally generated using either SimpleKeyGenerator or ComplexKeyGenerator.
| Modifier and Type | Class and Description |
|---|---|
static class |
CustomAvroKeyGenerator.PartitionKeyType
Used as a part of config in CustomKeyGenerator.java.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_PARTITION_PATH_SEPARATOR |
consistentLogicalTimestampEnabled, CUSTOM_KEY_GENERATOR_SPLIT_REGEX, EMPTY_PARTITION, encodePartitionPath, FIELD_SEPARATOR, hiveStylePartitioning, partitionPathFields, recordKeyFieldsconfig| Constructor and Description |
|---|
CustomAvroKeyGenerator(TypedProperties props) |
| Modifier and Type | Method and Description |
|---|---|
String |
getDefaultPartitionPathSeparator() |
static Pair<String,Option<CustomAvroKeyGenerator.PartitionKeyType>> |
getPartitionFieldAndKeyType(String field) |
String |
getPartitionPath(org.apache.avro.generic.GenericRecord record) |
static List<CustomAvroKeyGenerator.PartitionKeyType> |
getPartitionTypes(HoodieTableConfig tableConfig)
Returns list of partition types configured in the partition fields for custom key generator.
|
String |
getRecordKey(org.apache.avro.generic.GenericRecord record) |
static Option<List<String>> |
getTimestampFields(HoodieTableConfig tableConfig)
Returns the partition fields with timestamp partition type.
|
getKey, getPartitionPathFields, getRecordKeyFieldNames, isConsistentLogicalTimestampEnabledpublic static final String DEFAULT_PARTITION_PATH_SEPARATOR
public CustomAvroKeyGenerator(TypedProperties props)
public static List<CustomAvroKeyGenerator.PartitionKeyType> getPartitionTypes(HoodieTableConfig tableConfig)
tableConfig - Table config where partition fields are configuredpublic static Option<List<String>> getTimestampFields(HoodieTableConfig tableConfig)
tableConfig - Table config where partition fields are configuredpublic static Pair<String,Option<CustomAvroKeyGenerator.PartitionKeyType>> getPartitionFieldAndKeyType(String field)
public String getPartitionPath(org.apache.avro.generic.GenericRecord record)
getPartitionPath in class BaseKeyGeneratorpublic String getRecordKey(org.apache.avro.generic.GenericRecord record)
getRecordKey in class BaseKeyGeneratorpublic String getDefaultPartitionPathSeparator()
Copyright © 2024 The Apache Software Foundation. All rights reserved.