Do not update statistics for Presto views in Hive
@@ -63,6 +63,7 @@ import static com.facebook.presto.hive.HiveErrorCode.HIVE_METASTORE_ERROR;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_PATH_ALREADY_EXISTS;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_TABLE_DROPPED_DURING_QUERY;
import static com.facebook.presto.hive.HiveMetadata.PRESTO_QUERY_ID_NAME;
+import static com.facebook.presto.hive.HiveUtil.isPrestoView;
import static com.facebook.presto.hive.HiveUtil.toPartitionValues;
import static com.facebook.presto.hive.HiveWriteUtils.createDirectory;
import static com.facebook.presto.hive.HiveWriteUtils.pathExists;
@@ -1039,12 +1040,14 @@ public class SemiTransactionalHiveMetastore
}
}
addTableOperations.add(new CreateTableOperation(table, tableAndMore.getPrincipalPrivileges(), tableAndMore.isIgnoreExisting()));
+ if (!isPrestoView(table)) {
updateStatisticsOperations.add(new UpdateStatisticsOperation(
new SchemaTableName(table.getDatabaseName(), table.getTableName()),
Optional.empty(),
tableAndMore.getStatisticsUpdate(),
false));
}
+ }
private void prepareInsertExistingTable(HdfsContext context, TableAndMore tableAndMore)
{
