Skip to content

Commit

Permalink
HIVE-26647: Implemented deserialization API for commit compaction eve…
Browse files Browse the repository at this point in the history
…nt (Sai Hemanth, reviewed by Yu-Wen Lai, Zhihua Deng)

Closes #3689
  • Loading branch information
saihemanth-cloudera committed Oct 31, 2022
1 parent f8a6fd6 commit 7f713aa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Expand Up @@ -86,6 +86,8 @@ public EventMessage getEventMessage(String eventTypeString, String messageBody)
return getUpdatePartitionColumnStatMessage(messageBody);
case DELETE_PARTITION_COLUMN_STAT:
return getDeletePartitionColumnStatMessage(messageBody);
case COMMIT_COMPACTION:
return getCommitCompactionMessage(messageBody);
default:
throw new IllegalArgumentException("Unsupported event-type: " + eventTypeString);
}
Expand Down Expand Up @@ -237,6 +239,11 @@ public EventMessage getEventMessage(String eventTypeString, String messageBody)
*/
public abstract DeletePartitionColumnStatMessage getDeletePartitionColumnStatMessage(String messageBody);

/**
* Method to de-serialize CommitCompactionMessage instance.
*/
public abstract CommitCompactionMessage getCommitCompactionMessage(String messageBody);

/**
* Method to de-serialize any string passed. Need to be over-ridden by specific serialization subclasses.
*/
Expand Down
Expand Up @@ -33,6 +33,7 @@
import org.apache.hadoop.hive.metastore.messaging.AlterDatabaseMessage;
import org.apache.hadoop.hive.metastore.messaging.AlterPartitionMessage;
import org.apache.hadoop.hive.metastore.messaging.AlterTableMessage;
import org.apache.hadoop.hive.metastore.messaging.CommitCompactionMessage;
import org.apache.hadoop.hive.metastore.messaging.CommitTxnMessage;
import org.apache.hadoop.hive.metastore.messaging.CreateDatabaseMessage;
import org.apache.hadoop.hive.metastore.messaging.CreateFunctionMessage;
Expand Down Expand Up @@ -333,4 +334,12 @@ public DeletePartitionColumnStatMessage getDeletePartitionColumnStatMessage(Stri
throw new IllegalArgumentException("Could not construct UpdatePartitionColumnStatMessage", e);
}
}

public CommitCompactionMessage getCommitCompactionMessage(String messageBody) {
try {
return mapper.readValue(messageBody, JSONCommitCompactionMessage.class);
} catch (Exception e) {
throw new IllegalArgumentException("Could not construct CommitCompactionMessage", e);
}
}
}
Expand Up @@ -34,6 +34,7 @@
import org.apache.hadoop.hive.metastore.messaging.AlterPartitionMessage;
import org.apache.hadoop.hive.metastore.messaging.AlterTableMessage;
import org.apache.hadoop.hive.metastore.messaging.CommitTxnMessage;
import org.apache.hadoop.hive.metastore.messaging.CommitCompactionMessage;
import org.apache.hadoop.hive.metastore.messaging.CreateDatabaseMessage;
import org.apache.hadoop.hive.metastore.messaging.CreateFunctionMessage;
import org.apache.hadoop.hive.metastore.messaging.CreateTableMessage;
Expand Down Expand Up @@ -208,6 +209,11 @@ public AllocWriteIdMessage getAllocWriteIdMessage(String messageBody) {
return super.getAllocWriteIdMessage(deCompress(messageBody));
}

@Override
public CommitCompactionMessage getCommitCompactionMessage(String messageBody) {
return super.getCommitCompactionMessage(deCompress(messageBody));
}

@Override
public AcidWriteMessage getAcidWriteMessage(String messageBody) {
return super.getAcidWriteMessage(deCompress(messageBody));
Expand Down

0 comments on commit 7f713aa

Please sign in to comment.