BruceKellan commented on code in PR #6329:
URL: https://github.com/apache/hudi/pull/6329#discussion_r940851172
##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/HMSDDLExecutor.java:
##########
@@ -225,8 +225,9 @@ public void updatePartitionsToTable(String tableName,
List<String> changedPartit
String fullPartitionPath =
StorageSchemes.HDFS.getScheme().equals(partitionScheme)
?
FSUtils.getDFSFullPartitionPath(syncConfig.getHadoopFileSystem(),
partitionPath) : partitionPath.toString();
List<String> partitionValues =
partitionValueExtractor.extractPartitionValuesInPath(partition);
- sd.setLocation(fullPartitionPath);
- return new Partition(partitionValues, databaseName, tableName, 0, 0,
sd, null);
+ StorageDescriptor partitionSd = sd.deepCopy();
+ partitionSd.setLocation(fullPartitionPath);
Review Comment:
It uses the same one storage descriptor in a loop and returns a partition
containing sd's ref.
So if update multiple partitions, the sd of all partitions will be the same
ref and the path of partition is wrong.
##########
hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/HMSDDLExecutor.java:
##########
@@ -225,8 +225,9 @@ public void updatePartitionsToTable(String tableName,
List<String> changedPartit
String fullPartitionPath =
StorageSchemes.HDFS.getScheme().equals(partitionScheme)
?
FSUtils.getDFSFullPartitionPath(syncConfig.getHadoopFileSystem(),
partitionPath) : partitionPath.toString();
List<String> partitionValues =
partitionValueExtractor.extractPartitionValuesInPath(partition);
- sd.setLocation(fullPartitionPath);
- return new Partition(partitionValues, databaseName, tableName, 0, 0,
sd, null);
+ StorageDescriptor partitionSd = sd.deepCopy();
+ partitionSd.setLocation(fullPartitionPath);
Review Comment:
It uses the same one storage descriptor in a loop and returns a partition
containing sd's ref.
So if update multiple partitions, the sd of all partitions will be the same
ref and the path of some partition is wrong.
--
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]