public class KeyGenUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_PARTITION_PATH_SEPARATOR |
static String |
DEFAULT_RECORD_KEY_PARTS_SEPARATOR |
protected static String |
EMPTY_RECORDKEY_PLACEHOLDER |
protected static String |
HUDI_DEFAULT_PARTITION_PATH |
protected static String |
NULL_RECORDKEY_PLACEHOLDER |
| Constructor and Description |
|---|
KeyGenUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkRequiredProperties(TypedProperties props,
List<String> checkPropNames) |
static BaseHoodieDateTimeParser |
createDateTimeParser(TypedProperties props,
String parserClass)
Create a date time parser class for TimestampBasedKeyGenerator, passing in any configs needed.
|
static KeyGenerator |
createKeyGeneratorByClassName(TypedProperties props)
Create a key generator class via reflection, passing in any configs needed.
|
static String[] |
extractRecordKeys(String recordKey)
Extracts the record key fields in strings out of the given record key,
this is the reverse operation of
getRecordKey(GenericRecord, String, boolean). |
static String |
getPartitionPath(org.apache.avro.generic.GenericRecord record,
String partitionPathField,
boolean hiveStylePartitioning,
boolean encodePartitionPath,
boolean consistentLogicalTimestampEnabled) |
static String |
getPartitionPathFromGenericRecord(org.apache.avro.generic.GenericRecord genericRecord,
Option<BaseKeyGenerator> keyGeneratorOpt)
Fetches partition path from the GenericRecord.
|
static String |
getRecordKey(org.apache.avro.generic.GenericRecord record,
List<String> recordKeyFields,
boolean consistentLogicalTimestampEnabled) |
static String |
getRecordKey(org.apache.avro.generic.GenericRecord record,
String recordKeyField,
boolean consistentLogicalTimestampEnabled) |
static String |
getRecordKeyFromGenericRecord(org.apache.avro.generic.GenericRecord genericRecord,
Option<BaseKeyGenerator> keyGeneratorOpt)
Fetches record key from the GenericRecord.
|
static String |
getRecordPartitionPath(org.apache.avro.generic.GenericRecord record,
List<String> partitionPathFields,
boolean hiveStylePartitioning,
boolean encodePartitionPath,
boolean consistentLogicalTimestampEnabled) |
protected static final String NULL_RECORDKEY_PLACEHOLDER
protected static final String EMPTY_RECORDKEY_PLACEHOLDER
protected static final String HUDI_DEFAULT_PARTITION_PATH
public static final String DEFAULT_PARTITION_PATH_SEPARATOR
public static final String DEFAULT_RECORD_KEY_PARTS_SEPARATOR
public static String getRecordKeyFromGenericRecord(org.apache.avro.generic.GenericRecord genericRecord, Option<BaseKeyGenerator> keyGeneratorOpt)
genericRecord - generic record of interest.keyGeneratorOpt - Optional BaseKeyGenerator. If not, meta field will be used.public static String getPartitionPathFromGenericRecord(org.apache.avro.generic.GenericRecord genericRecord, Option<BaseKeyGenerator> keyGeneratorOpt)
genericRecord - generic record of interest.keyGeneratorOpt - Optional BaseKeyGenerator. If not, meta field will be used.public static String[] extractRecordKeys(String recordKey)
getRecordKey(GenericRecord, String, boolean).SimpleAvroKeyGenerator,
ComplexAvroKeyGeneratorpublic static String getRecordKey(org.apache.avro.generic.GenericRecord record, List<String> recordKeyFields, boolean consistentLogicalTimestampEnabled)
public static String getRecordPartitionPath(org.apache.avro.generic.GenericRecord record, List<String> partitionPathFields, boolean hiveStylePartitioning, boolean encodePartitionPath, boolean consistentLogicalTimestampEnabled)
public static String getRecordKey(org.apache.avro.generic.GenericRecord record, String recordKeyField, boolean consistentLogicalTimestampEnabled)
public static String getPartitionPath(org.apache.avro.generic.GenericRecord record, String partitionPathField, boolean hiveStylePartitioning, boolean encodePartitionPath, boolean consistentLogicalTimestampEnabled)
public static BaseHoodieDateTimeParser createDateTimeParser(TypedProperties props, String parserClass) throws IOException
IOExceptionpublic static void checkRequiredProperties(TypedProperties props, List<String> checkPropNames)
public static KeyGenerator createKeyGeneratorByClassName(TypedProperties props) throws IOException
This method is for user-defined classes. To create hudi's built-in key generators, please set proper
KeyGeneratorType conf, and use the relevant factory, see
HoodieAvroKeyGeneratorFactory.
IOExceptionCopyright © 2022 The Apache Software Foundation. All rights reserved.