Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-26647: Implemented deserialization API for commit compaction event #3689

Merged
merged 1 commit into from Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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