dengzhhu653 commented on code in PR #5582:
URL: https://github.com/apache/hive/pull/5582#discussion_r1916337805
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/load/message/TruncatePartitionHandler.java:
##########
@@ -35,17 +39,39 @@
public class TruncatePartitionHandler extends AbstractMessageHandler {
@Override
public List<Task<?>> handle(Context context) throws SemanticException {
- AlterPartitionMessage msg =
deserializer.getAlterPartitionMessage(context.dmd.getPayload());
- final TableName tName = TableName.fromString(msg.getTable(), null,
- context.isDbNameEmpty() ? msg.getDB() : context.dbName);
-
- Map<String, String> partSpec = new LinkedHashMap<>();
+ final TableName tName;
org.apache.hadoop.hive.metastore.api.Table tblObj;
try {
- tblObj = msg.getTableObj();
- Iterator<String> afterIterator =
msg.getPtnObjAfter().getValuesIterator();
- for (FieldSchema fs : tblObj.getPartitionKeys()) {
- partSpec.put(fs.getName(), afterIterator.next());
+ if (MetastoreConf.getBoolVar(context.hiveConf,
+ MetastoreConf.ConfVars.NOTIFICATION_ALTER_PARTITIONS_V2_ENABLED)) {
+ AlterPartitionsMessage singleMsg =
deserializer.getAlterPartitionsMessage(
+ context.dmd.getPayload());
+ tName = TableName.fromString(singleMsg.getTable(), null,
+ context.isDbNameEmpty() ? singleMsg.getDB() : context.dbName);
+ tblObj = singleMsg.getTableObj();
+ List<Map<String, String>> afterPartitionsList =
singleMsg.getPartitions();
+ List<Task<?>> childTaskList = new ArrayList<>();
+ for(Map<String, String> afterIteratorMap : afterPartitionsList) {
+ Iterator<String> afterIterator =
afterIteratorMap.values().iterator();
+ Map<String, String> partSpec = new LinkedHashMap<>();
+ for (FieldSchema fs : tblObj.getPartitionKeys()) {
+ partSpec.put(fs.getName(), afterIterator.next());
Review Comment:
nit: `afterIterator.next` -> `afterIteratorMap.get(fs.getName())`
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]