You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by sp...@apache.org on 2018/02/07 16:05:56 UTC

hive git commit: HIVE-18567: ObjectStore.getPartitionNamesNoTxn doesn't handle max param properly (Adam Szita, reviewed by Sergio Pena)

Repository: hive
Updated Branches:
  refs/heads/master acc62e3d5 -> fa9a38978


HIVE-18567: ObjectStore.getPartitionNamesNoTxn doesn't handle max param properly (Adam Szita, reviewed by Sergio Pena)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/fa9a3897
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/fa9a3897
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/fa9a3897

Branch: refs/heads/master
Commit: fa9a3897898e550f626f161578e5355946d6c7e6
Parents: acc62e3
Author: Adam Szita <sz...@cloudera.com>
Authored: Wed Feb 7 10:00:16 2018 -0600
Committer: Sergio Pena <se...@cloudera.com>
Committed: Wed Feb 7 10:00:16 2018 -0600

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hive/metastore/ObjectStore.java   | 4 ++++
 .../org/apache/hadoop/hive/metastore/conf/MetastoreConf.java | 7 ++++++-
 .../hadoop/hive/metastore/client/TestListPartitions.java     | 8 ++------
 3 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/fa9a3897/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index 3d1c67f..6498fe5 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -2741,6 +2741,9 @@ public class ObjectStore implements RawStore, Configurable {
 
   private List<String> getPartitionNamesNoTxn(String dbName, String tableName, short max) {
     List<String> pns = new ArrayList<>();
+    if (max == 0) {
+      return pns;
+    }
     dbName = normalizeIdentifier(dbName);
     tableName = normalizeIdentifier(tableName);
     Query query =
@@ -2749,6 +2752,7 @@ public class ObjectStore implements RawStore, Configurable {
             + "order by partitionName asc");
     query.declareParameters("java.lang.String t1, java.lang.String t2");
     query.setResult("partitionName");
+
     if (max > 0) {
       query.setRange(0, max);
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/fa9a3897/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
index dba68ac..5ef8d7a 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
@@ -528,7 +528,12 @@ public class MetastoreConf {
             "The special string _HOST will be replaced automatically with the correct host name."),
     LIMIT_PARTITION_REQUEST("metastore.limit.partition.request",
         "hive.metastore.limit.partition.request", -1,
-        "This limits the number of partitions that can be requested from the metastore for a given table.\n" +
+        "This limits the number of partitions (whole partition objects) that can be requested " +
+        "from the metastore for a give table. MetaStore API methods using this are: \n" +
+                "get_partitions, \n" +
+                "get_partitions_with_auth, \n" +
+                "get_partitions_by_filter, \n" +
+                "get_partitions_by_expr.\n" +
             "The default value \"-1\" means no limit."),
     LOG4J_FILE("metastore.log4j.file", "hive.log4j.file", "",
         "Hive log4j configuration file.\n" +

http://git-wip-us.apache.org/repos/asf/hive/blob/fa9a3897/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java
index f4fa73b..fdabbe4 100644
--- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java
+++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestListPartitions.java
@@ -1040,14 +1040,10 @@ public class TestListPartitions {
     assertCorrectPartitionNames(partitionNames, testValues.subList(0, 2),
             Lists.newArrayList("yyyy", "mm", "dd"));
 
-
-    //TODO: surprisingly listPartitionNames returns everything when 0 parts are requested
     partitionNames = client.listPartitionNames(DB_NAME, TABLE_NAME, (short)0);
-    assertFalse(partitionNames.isEmpty());
-    assertCorrectPartitionNames(partitionNames, testValues, Lists.newArrayList("yyyy", "mm",
-            "dd"));
+    assertTrue(partitionNames.isEmpty());
 
-    //TODO: surprisingly listPartitionNames doesn't fail when >100 parts are requested
+    //This method does not depend on MetastoreConf.LIMIT_PARTITION_REQUEST setting:
     partitionNames = client.listPartitionNames(DB_NAME, TABLE_NAME, (short)101);
     assertCorrectPartitionNames(partitionNames, testValues, Lists.newArrayList("yyyy", "mm",
             "dd"));