use of org.apache.hadoop.hive.metastore.messaging.UpdatePartitionColumnStatMessage in project hive by apache.
the class DbNotificationListener method onUpdatePartitionColumnStat.
@Override
public void onUpdatePartitionColumnStat(UpdatePartitionColumnStatEvent updatePartColStatEvent) throws MetaException {
UpdatePartitionColumnStatMessage msg = MessageBuilder.getInstance().buildUpdatePartitionColumnStatMessage(updatePartColStatEvent.getPartColStats(), updatePartColStatEvent.getPartVals(), updatePartColStatEvent.getPartParameters(), updatePartColStatEvent.getTableObj(), updatePartColStatEvent.getWriteId());
NotificationEvent event = new NotificationEvent(0, now(), EventType.UPDATE_PARTITION_COLUMN_STAT.toString(), msgEncoder.getSerializer().serialize(msg));
ColumnStatisticsDesc statDesc = updatePartColStatEvent.getPartColStats().getStatsDesc();
event.setCatName(statDesc.isSetCatName() ? statDesc.getCatName() : DEFAULT_CATALOG_NAME);
event.setDbName(statDesc.getDbName());
event.setTableName(statDesc.getTableName());
process(event, updatePartColStatEvent);
}
use of org.apache.hadoop.hive.metastore.messaging.UpdatePartitionColumnStatMessage in project hive by apache.
the class DbNotificationListener method onUpdatePartitionColumnStatInBatch.
@Override
public void onUpdatePartitionColumnStatInBatch(UpdatePartitionColumnStatEventBatch updatePartColStatEventBatch, Connection dbConn, SQLGenerator sqlGenerator) throws MetaException {
List<NotificationEvent> eventBatch = new ArrayList<>();
List<ListenerEvent> listenerEventBatch = new ArrayList<>();
for (int i = 0; i < updatePartColStatEventBatch.getNumEntries(); i++) {
UpdatePartitionColumnStatEvent updatePartColStatEvent = updatePartColStatEventBatch.getPartColStatEvent(i);
UpdatePartitionColumnStatMessage msg = MessageBuilder.getInstance().buildUpdatePartitionColumnStatMessage(updatePartColStatEvent.getPartColStats(), updatePartColStatEvent.getPartVals(), updatePartColStatEvent.getPartParameters(), updatePartColStatEvent.getTableObj(), updatePartColStatEvent.getWriteId());
ColumnStatisticsDesc statDesc = updatePartColStatEvent.getPartColStats().getStatsDesc();
NotificationEvent event = new NotificationEvent(0, now(), EventType.UPDATE_PARTITION_COLUMN_STAT.toString(), msgEncoder.getSerializer().serialize(msg));
event.setCatName(statDesc.isSetCatName() ? statDesc.getCatName() : DEFAULT_CATALOG_NAME);
event.setDbName(statDesc.getDbName());
event.setTableName(statDesc.getTableName());
eventBatch.add(event);
listenerEventBatch.add(updatePartColStatEvent);
}
try {
addNotificationLogBatch(eventBatch, listenerEventBatch, dbConn, sqlGenerator);
} catch (SQLException e) {
throw new MetaException("Unable to execute direct SQL " + StringUtils.stringifyException(e));
}
}
use of org.apache.hadoop.hive.metastore.messaging.UpdatePartitionColumnStatMessage in project hive by apache.
the class UpdatePartColStatHandler method handle.
@Override
public List<Task<?>> handle(Context context) throws SemanticException {
UpdatePartitionColumnStatMessage upcsm = deserializer.getUpdatePartitionColumnStatMessage(context.dmd.getPayload());
// Update tablename and database name in the statistics object
ColumnStatistics colStats = upcsm.getColumnStatistics();
// In older version of hive, engine might not have set.
if (colStats.getEngine() == null) {
colStats.setEngine(org.apache.hadoop.hive.conf.Constants.HIVE_ENGINE);
}
ColumnStatisticsDesc colStatsDesc = colStats.getStatsDesc();
if (!context.isDbNameEmpty()) {
colStatsDesc.setDbName(context.dbName);
updatedMetadata.set(context.dmd.getEventTo().toString(), context.dbName, colStatsDesc.getTableName(), null);
}
try {
return ReplUtils.addTasksForLoadingColStats(colStats, context.hiveConf, updatedMetadata, upcsm.getTableObject(), upcsm.getWriteId(), context.getDumpDirectory(), context.getMetricCollector());
} catch (Exception e) {
throw new SemanticException(e);
}
}
Aggregations