hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r1634762 - in /hive/trunk/hcatalog/webhcat/java-client/src: main/java/org/apache/hive/hcatalog/api/HCatClientHMSImpl.java main/java/org/apache/hive/hcatalog/api/HCatPartition.java test/java/org/apache/hive/hcatalog/api/TestHCatClient.java
Date Tue, 28 Oct 2014 02:09:23 GMT
Author: navis
Date: Tue Oct 28 02:09:22 2014
New Revision: 1634762

URL: http://svn.apache.org/r1634762
Log:
HIVE-7408 : HCatPartition needs getPartCols method (Navis reviewed by Alan Gates)

Modified:
    hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatClientHMSImpl.java
    hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java
    hive/trunk/hcatalog/webhcat/java-client/src/test/java/org/apache/hive/hcatalog/api/TestHCatClient.java

Modified: hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatClientHMSImpl.java
URL: http://svn.apache.org/viewvc/hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatClientHMSImpl.java?rev=1634762&r1=1634761&r2=1634762&view=diff
==============================================================================
--- hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatClientHMSImpl.java
(original)
+++ hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatClientHMSImpl.java
Tue Oct 28 02:09:22 2014
@@ -329,8 +329,7 @@ public class HCatClientHMSImpl extends H
     throws HCatException {
     List<HCatPartition> hcatPtns = new ArrayList<HCatPartition>();
     try {
-      Table table = hmsClient.getTable(dbName, tblName);
-      HCatTable hcatTable = new HCatTable(table);
+      HCatTable hcatTable = getTable(dbName, tblName);
       List<Partition> hivePtns = hmsClient.listPartitions(
         checkDB(dbName), tblName, (short) -1);
       for (Partition ptn : hivePtns) {
@@ -374,7 +373,7 @@ public class HCatClientHMSImpl extends H
                     Map<String, String> partitionSpec) throws HCatException {
     HCatPartition partition = null;
     try {
-      HCatTable hcatTable = getTable(checkDB(dbName), tableName);
+      HCatTable hcatTable = getTable(dbName, tableName);
       List<HCatFieldSchema> partitionColumns = hcatTable.getPartCols();
       if (partitionColumns.size() != partitionSpec.size()) {
         throw new HCatException("Partition-spec doesn't have the right number of partition
keys.");
@@ -494,7 +493,7 @@ public class HCatClientHMSImpl extends H
     try {
       HCatTable table = getTable(dbName, tblName);
       List<Partition> hivePtns = hmsClient.listPartitionsByFilter(
-        checkDB(dbName), tblName, filter, (short) -1);
+          table.getDbName(), table.getTableName(), filter, (short) -1);
       for (Partition ptn : hivePtns) {
         hcatPtns.add(new HCatPartition(table, ptn));
       }

Modified: hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java
URL: http://svn.apache.org/viewvc/hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java?rev=1634762&r1=1634761&r2=1634762&view=diff
==============================================================================
--- hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java
(original)
+++ hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java
Tue Oct 28 02:09:22 2014
@@ -188,6 +188,15 @@ public class HCatPartition {
   }
 
   /**
+   * Gets the partition columns of the table.
+   *
+   * @return the partition columns
+   */
+  public List<HCatFieldSchema> getPartColumns() {
+    return hcatTable.getPartCols();
+  }
+
+  /**
    * Gets the input format.
    *
    * @return the input format

Modified: hive/trunk/hcatalog/webhcat/java-client/src/test/java/org/apache/hive/hcatalog/api/TestHCatClient.java
URL: http://svn.apache.org/viewvc/hive/trunk/hcatalog/webhcat/java-client/src/test/java/org/apache/hive/hcatalog/api/TestHCatClient.java?rev=1634762&r1=1634761&r2=1634762&view=diff
==============================================================================
--- hive/trunk/hcatalog/webhcat/java-client/src/test/java/org/apache/hive/hcatalog/api/TestHCatClient.java
(original)
+++ hive/trunk/hcatalog/webhcat/java-client/src/test/java/org/apache/hive/hcatalog/api/TestHCatClient.java
Tue Oct 28 02:09:22 2014
@@ -758,6 +758,11 @@ public class TestHCatClient {
       assertEquals("Unexpected number of partitions.", 1, partitions.size());
       assertArrayEquals("Mismatched partition.", new String[]{"2011_12_31", "AB"}, partitions.get(0).getValues().toArray());
 
+      List<HCatFieldSchema> partColumns = partitions.get(0).getPartColumns();
+      assertEquals(2, partColumns.size());
+      assertEquals("dt", partColumns.get(0).getName());
+      assertEquals("grid", partColumns.get(1).getName());
+
       client.dropDatabase(dbName, false, HCatClient.DropDBMode.CASCADE);
     }
     catch (Exception unexpected) {



Mime
View raw message