diff --git a/ql/src/test/queries/clientpositive/repl_2_exim_basic.q b/ql/src/test/queries/clientpositive/repl_2_exim_basic.q index 4c18223c8f..e13ed96fa4 100644 --- a/ql/src/test/queries/clientpositive/repl_2_exim_basic.q +++ b/ql/src/test/queries/clientpositive/repl_2_exim_basic.q @@ -17,6 +17,9 @@ create table managed_t (emp_id int comment "employee id") stored as textfile; load data local inpath "../../data/files/test.dat" into table managed_t partition (emp_country="us",emp_state="ca"); +ALTER TABLE managed_t ADD PARTITION (emp_country="zx",emp_state="ka"); + +--select * FROM randomTable; create external table ext_t (emp_id int comment "employee id") partitioned by (emp_country string, emp_state string) diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java index 22140a36f7..e62eb3254e 100644 --- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -6993,11 +6993,16 @@ public GetPartitionsByNamesResult get_partitions_by_names_req(GetPartitionsByNam // request them separately. for (Partition part: ret) { String partName = Warehouse.makePartName(table.getPartitionKeys(), part.getValues()); - List partColStatsList = - getMS().getPartitionColumnStatistics(parsedCatName, parsedDbName, tblName, - Collections.singletonList(partName), - StatsSetupConst.getColumnsHavingStats(part.getParameters()), - engine); + List partColStatsList = null; + List colNames = StatsSetupConst.getColumnsHavingStats(part.getParameters()); + if (colNames == null || colNames.isEmpty()) { + LOG.debug("No column of the partition {} is having statistics", partName); + } else { + partColStatsList = getMS().getPartitionColumnStatistics(parsedCatName, parsedDbName, tblName, + Collections.singletonList(partName), + colNames, + engine); + } if (partColStatsList != null && !partColStatsList.isEmpty()) { ColumnStatistics partColStats = partColStatsList.get(0); if (partColStats != null) {