From a0854a9f7a3834d443044150a6187fef52a3f5d1 Mon Sep 17 00:00:00 2001 From: CC Lien Date: Fri, 14 Feb 2014 13:33:24 +0800 Subject: [PATCH] Fix IMPALA-749. Allow to load partitions more than Short.MAX_VALUE. (backport for v1.2.2, v1.2.3) --- .../com/cloudera/impala/catalog/HdfsTable.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fe/src/main/java/com/cloudera/impala/catalog/HdfsTable.java b/fe/src/main/java/com/cloudera/impala/catalog/HdfsTable.java index 1c4008d..c265927 100644 --- a/fe/src/main/java/com/cloudera/impala/catalog/HdfsTable.java +++ b/fe/src/main/java/com/cloudera/impala/catalog/HdfsTable.java @@ -135,6 +135,9 @@ public class HdfsTable extends Table { private static final boolean SUPPORTS_VOLUME_ID; + // Indicating no partition limit in listPartition API of HiveMetaStoreClient + private static final short UNLIMITED_NUM_PARTITIONS=-1; + static { try { // call newInstance() instead of using a shared instance from a cache @@ -695,7 +698,7 @@ public class HdfsTable extends Table { Lists.newArrayList(); if (cachedEntry == null || !(cachedEntry instanceof HdfsTable) || cachedEntry.lastDdlTime != lastDdlTime) { - msPartitions.addAll(client.listPartitions(db.getName(), name, Short.MAX_VALUE)); + msPartitions.addAll(client.listPartitions(db.getName(), name, UNLIMITED_NUM_PARTITIONS)); } else { // The table was already in the metadata cache and it has not been modified. Preconditions.checkArgument(cachedEntry instanceof HdfsTable); @@ -712,7 +715,7 @@ public class HdfsTable extends Table { // First get a list of all the partition names for this table from the // metastore, this is much faster than listing all the Partition objects. modifiedPartitionNames.addAll( - client.listPartitionNames(db.getName(), name, Short.MAX_VALUE)); + client.listPartitionNames(db.getName(), name, UNLIMITED_NUM_PARTITIONS)); } int totalPartitions = modifiedPartitionNames.size(); -- 1.7.9.5