alexeykudinkin commented on code in PR #6049:
URL: https://github.com/apache/hudi/pull/6049#discussion_r919345001
##########
hudi-spark-datasource/hudi-spark-common/src/main/java/org/apache/hudi/internal/BulkInsertDataInternalWriterHelper.java:
##########
@@ -126,14 +125,17 @@ public void write(InternalRow record) throws IOException {
if (populateMetaFields) { // usual path where meta fields are pre
populated in prep step.
partitionPath =
String.valueOf(record.getUTF8String(HoodieRecord.PARTITION_PATH_META_FIELD_POS));
} else { // if meta columns are disabled.
+ // TODO(HUDI-3993) remove duplication, unify with
HoodieDatasetBulkInsertHelper
if (!keyGeneratorOpt.isPresent()) { // NoPartitionerKeyGen
partitionPath = "";
} else if (simpleKeyGen) { // SimpleKeyGen
- Object parititionPathValue = record.get(simplePartitionFieldIndex,
simplePartitionFieldDataType);
- partitionPath = parititionPathValue != null ?
parititionPathValue.toString() :
PartitionPathEncodeUtils.DEFAULT_PARTITION_PATH;
- if (writeConfig.isHiveStylePartitioningEnabled()) {
- partitionPath =
(keyGeneratorOpt.get()).getPartitionPathFields().get(0) + "=" + partitionPath;
- }
+ Object partitionPathValue = record.get(simplePartitionFieldIndex,
simplePartitionFieldDataType);
+ String partitionPathField =
keyGeneratorOpt.get().getPartitionPathFields().get(0);
+ boolean shouldURLEncodePartitionPath =
writeConfig.shouldURLEncodePartitionPath();
+ boolean hiveStylePartitioningEnabled =
writeConfig.isHiveStylePartitioningEnabled();
+
+ partitionPath =
KeyGenUtils.handlePartitionPathDecoration(partitionPathField,
+ partitionPathValue == null ? null :
partitionPathValue.toString(), shouldURLEncodePartitionPath,
hiveStylePartitioningEnabled);
Review Comment:
Yeah, done that initially but then decided to optimize it out given that
this is a hot-path
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]