use of org.apache.hadoop.hive.metastore.messaging.MessageSerializer in project hive by apache.
the class DbNotificationListener method onAddPartition.
/**
* @param partitionEvent partition event
* @throws MetaException
*/
@Override
public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException {
Table t = partitionEvent.getTable();
PartitionFilesIterator fileIter = MetaStoreUtils.isExternalTable(t) ? null : new PartitionFilesIterator(partitionEvent.getPartitionIterator(), t);
EventMessage msg = MessageBuilder.getInstance().buildAddPartitionMessage(t, partitionEvent.getPartitionIterator(), fileIter);
MessageSerializer serializer = msgEncoder.getSerializer();
NotificationEvent event = new NotificationEvent(0, now(), EventType.ADD_PARTITION.toString(), serializer.serialize(msg));
event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME);
event.setDbName(t.getDbName());
event.setTableName(t.getTableName());
process(event, partitionEvent);
}
use of org.apache.hadoop.hive.metastore.messaging.MessageSerializer in project hive by apache.
the class TestReplicationMetricCollector method testReplStatsTrackerLimit.
@Test
public void testReplStatsTrackerLimit() {
MessageSerializer serializer = MessageFactory.getDefaultInstanceForReplMetrics(conf).getSerializer();
ReplStatsTracker repl = new ReplStatsTracker(10);
// Check for k=10
generateStatsString(10, repl);
String replStatsTracker = repl.toString();
String gzipSerialized = serializer.serialize(replStatsTracker);
assertTrue("ReplStat string is " + gzipSerialized.length(), gzipSerialized.length() < ReplStatsTracker.RM_PROGRESS_LENGTH);
// Check for k=5
repl = new ReplStatsTracker(5);
generateStatsString(5, repl);
replStatsTracker = repl.toString();
gzipSerialized = serializer.serialize(replStatsTracker);
assertTrue("ReplStat string is " + gzipSerialized.length(), gzipSerialized.length() < ReplStatsTracker.RM_PROGRESS_LENGTH);
// Check for k=2 & check NaN values doesn't get messed up due to formatter
repl = new ReplStatsTracker(2);
generateStatsString(2, repl);
assertTrue(repl.toString().contains("NaN"));
}
Aggregations