use of org.apache.hadoop.hive.metastore.messaging.UpdateTableColumnStatMessage in project hive by apache.
the class DbNotificationListener method onUpdateTableColumnStat.
@Override
public void onUpdateTableColumnStat(UpdateTableColumnStatEvent updateTableColumnStatEvent) throws MetaException {
UpdateTableColumnStatMessage msg = MessageBuilder.getInstance().buildUpdateTableColumnStatMessage(updateTableColumnStatEvent.getColStats(), updateTableColumnStatEvent.getTableObj(), updateTableColumnStatEvent.getTableParameters(), updateTableColumnStatEvent.getWriteId());
NotificationEvent event = new NotificationEvent(0, now(), EventType.UPDATE_TABLE_COLUMN_STAT.toString(), msgEncoder.getSerializer().serialize(msg));
ColumnStatisticsDesc statDesc = updateTableColumnStatEvent.getColStats().getStatsDesc();
event.setCatName(statDesc.isSetCatName() ? statDesc.getCatName() : DEFAULT_CATALOG_NAME);
event.setDbName(statDesc.getDbName());
event.setTableName(statDesc.getTableName());
process(event, updateTableColumnStatEvent);
}
use of org.apache.hadoop.hive.metastore.messaging.UpdateTableColumnStatMessage in project hive by apache.
the class UpdateTableColStatHandler method handle.
@Override
public List<Task<?>> handle(Context context) throws SemanticException {
UpdateTableColumnStatMessage utcsm = deserializer.getUpdateTableColumnStatMessage(context.dmd.getPayload());
// Update tablename and database name in the statistics object
ColumnStatistics colStats = utcsm.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();
colStatsDesc.setDbName(context.dbName);
if (!context.isDbNameEmpty()) {
updatedMetadata.set(context.dmd.getEventTo().toString(), context.dbName, colStatsDesc.getTableName(), null);
}
try {
return ReplUtils.addTasksForLoadingColStats(colStats, context.hiveConf, updatedMetadata, utcsm.getTableObject(), utcsm.getWriteId(), context.getDumpDirectory(), context.getMetricCollector());
} catch (Exception e) {
throw new SemanticException(e);
}
}
Aggregations