Search in sources :

Example 1 with UpdateTableColumnStatMessage

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);
}
Also used : UpdateTableColumnStatMessage(org.apache.hadoop.hive.metastore.messaging.UpdateTableColumnStatMessage) ColumnStatisticsDesc(org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc) NotificationEvent(org.apache.hadoop.hive.metastore.api.NotificationEvent)

Example 2 with UpdateTableColumnStatMessage

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);
    }
}
Also used : UpdateTableColumnStatMessage(org.apache.hadoop.hive.metastore.messaging.UpdateTableColumnStatMessage) ColumnStatistics(org.apache.hadoop.hive.metastore.api.ColumnStatistics) ColumnStatisticsDesc(org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc) SemanticException(org.apache.hadoop.hive.ql.parse.SemanticException) SemanticException(org.apache.hadoop.hive.ql.parse.SemanticException)

Aggregations

ColumnStatisticsDesc (org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc)2 UpdateTableColumnStatMessage (org.apache.hadoop.hive.metastore.messaging.UpdateTableColumnStatMessage)2 ColumnStatistics (org.apache.hadoop.hive.metastore.api.ColumnStatistics)1 NotificationEvent (org.apache.hadoop.hive.metastore.api.NotificationEvent)1 SemanticException (org.apache.hadoop.hive.ql.parse.SemanticException)1