hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shiv...@apache.org
Subject incubator-hawq git commit: HAWQ-459. CR fixes take 2
Date Tue, 22 Mar 2016 18:29:16 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/HAWQ-459 58d8d406a -> 04d4acf7c


HAWQ-459. CR fixes take 2


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/04d4acf7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/04d4acf7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/04d4acf7

Branch: refs/heads/HAWQ-459
Commit: 04d4acf7c4a3385384b0ffc254b1cb5a7a390e5f
Parents: 58d8d40
Author: Shivram Mani <shivram.mani@gmail.com>
Authored: Tue Mar 22 11:29:08 2016 -0700
Committer: Shivram Mani <shivram.mani@gmail.com>
Committed: Tue Mar 22 11:29:08 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hawq/pxf/api/Metadata.java    |  2 +-
 .../java/org/apache/hawq/pxf/api/MetadataFetcher.java  |  2 +-
 .../hawq/pxf/plugins/hive/HiveDataFragmenter.java      |  5 ++---
 .../hawq/pxf/plugins/hive/utilities/HiveUtilities.java | 13 +++++--------
 .../hawq/pxf/service/MetadataFetcherFactory.java       |  7 +------
 .../hawq/pxf/service/MetadataResponseFormatter.java    |  2 +-
 .../pxf/service/MetadataResponseFormatterTest.java     |  4 ++--
 7 files changed, 13 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04d4acf7/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/Metadata.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/Metadata.java b/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/Metadata.java
index 26ad182..4fc510d 100644
--- a/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/Metadata.java
+++ b/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/Metadata.java
@@ -41,7 +41,7 @@ public class Metadata {
         public Item(String path, String itemName) {
 
             if (StringUtils.isBlank(path) || StringUtils.isBlank(itemName)) {
-                throw new IllegalArgumentException("Item name cannot be empty");
+                throw new IllegalArgumentException("Item or path name cannot be empty");
             }
 
             this.path = path;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04d4acf7/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/MetadataFetcher.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/MetadataFetcher.java b/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/MetadataFetcher.java
index 1ce0887..21aea72 100644
--- a/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/MetadataFetcher.java
+++ b/pxf/pxf-api/src/main/java/org/apache/hawq/pxf/api/MetadataFetcher.java
@@ -26,7 +26,7 @@ import org.apache.hawq.pxf.api.utilities.Plugin;
 
 
 /**
- * Abstract class that defines getting metadata of an item.
+ * Abstract class that defines getting metadata.
  */
 public abstract class MetadataFetcher extends Plugin {
     protected List<Metadata> metadata;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04d4acf7/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveDataFragmenter.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveDataFragmenter.java
b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveDataFragmenter.java
index e4e34b0..ded9627 100644
--- a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveDataFragmenter.java
+++ b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveDataFragmenter.java
@@ -250,9 +250,8 @@ public class HiveDataFragmenter extends Fragmenter {
             for (Partition partition : partitions) {
                 StorageDescriptor descPartition = partition.getSd();
                 props = MetaStoreUtils.getSchema(descPartition, descTable,
-                        null, // Map<string, string> parameters - can be empty
-                        tblDesc.getPath(), tblDesc.getName(), // table
-                                                                     // name
+                        null,
+                        tblDesc.getPath(), tblDesc.getName(),
                         partitionKeys);
                 fetchMetaDataForPartitionedTable(descPartition, props,
                         partition, partitionKeys, tblDesc.getName());

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04d4acf7/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
index 3d06101..70574a4 100644
--- a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
+++ b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
@@ -216,14 +216,14 @@ public class HiveUtilities {
     }
 
     /**
-     * Extracts the db_name and table_name from the qualifiedName.
-     * qualifiedName is the Hive table name or pattern that the user enters in the CREATE
EXTERNAL TABLE statement
+     * Extracts the db_name(s) and table_name(s) corresponding to the given pattern.
+     * pattern is the Hive table name or pattern that the user enters in the CREATE EXTERNAL
TABLE statement
      * or when querying HCatalog table.
      * It can be either <code>table_name_pattern</code> or <code>db_name_pattern.table_name_pattern</code>.
      *
      * @param client Hivemetastore client
      * @param pattern Hive table name or pattern
-     * @return {@link Metadata.Item} object holding the full table name
+     * @return list of {@link Metadata.Item} objects holding the full table name
      */
     public static List<Metadata.Item> extractTablesFromPattern(HiveMetaStoreClient
client, String pattern) {
 
@@ -255,8 +255,7 @@ public class HiveUtilities {
         }
 
         return getTablesFromPattern(client, dbPattern, tablePattern);
-
-    }
+   }
 
     private static List<Metadata.Item> getTablesFromPattern(HiveMetaStoreClient client,
String dbPattern, String tablePattern) {
 
@@ -277,9 +276,7 @@ public class HiveUtilities {
             }
             for(String dbName: databases) {
                 for(String tableName: client.getTables(dbName, tablePattern)) {
-                    if (!tableName.isEmpty()) {
-                        itemList.add(new Metadata.Item(dbName, tableName));
-                    }
+                    itemList.add(new Metadata.Item(dbName, tableName));
                 }
             }
             return itemList;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04d4acf7/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/MetadataFetcherFactory.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/MetadataFetcherFactory.java
b/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/MetadataFetcherFactory.java
index 77f5d06..396b711 100644
--- a/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/MetadataFetcherFactory.java
+++ b/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/MetadataFetcherFactory.java
@@ -30,12 +30,7 @@ import org.apache.hawq.pxf.api.utilities.Utilities;
  * abstract class which is returned by the MetadataFetcherFactory. 
  */
 public class MetadataFetcherFactory {
-    /* TODO: This is a tempororary workaround.
-     * The metadata class will be moved to the pxf-profile.xml in the future
-     */
     public static MetadataFetcher create(InputData inputData) throws Exception {
-        String metadataFetcher = inputData.getMetadata();
-
-        return (MetadataFetcher) Utilities.createAnyInstance(InputData.class, metadataFetcher,
inputData);
+        return (MetadataFetcher) Utilities.createAnyInstance(InputData.class, inputData.getMetadata(),
inputData);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04d4acf7/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/MetadataResponseFormatter.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/MetadataResponseFormatter.java
b/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/MetadataResponseFormatter.java
index 444e2e1..04d3d79 100644
--- a/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/MetadataResponseFormatter.java
+++ b/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/MetadataResponseFormatter.java
@@ -69,7 +69,7 @@ public class MetadataResponseFormatter {
                 throw new IllegalArgumentException("metadata object is null - cannot serialize");
             }
             if ((metadata.getFields() == null) || metadata.getFields().isEmpty()) {
-                throw new IllegalArgumentException("metadata contains no fields - cannot
serialize");
+                throw new IllegalArgumentException("metadata for " + metadata.getItem() +
" contains no fields - cannot serialize");
             }
             if (result == null) {
                 result = new StringBuilder("{\"PXFMetadata\":["); /* prefix info */

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/04d4acf7/pxf/pxf-service/src/test/java/org/apache/hawq/pxf/service/MetadataResponseFormatterTest.java
----------------------------------------------------------------------
diff --git a/pxf/pxf-service/src/test/java/org/apache/hawq/pxf/service/MetadataResponseFormatterTest.java
b/pxf/pxf-service/src/test/java/org/apache/hawq/pxf/service/MetadataResponseFormatterTest.java
index 40a0896..8709879 100644
--- a/pxf/pxf-service/src/test/java/org/apache/hawq/pxf/service/MetadataResponseFormatterTest.java
+++ b/pxf/pxf-service/src/test/java/org/apache/hawq/pxf/service/MetadataResponseFormatterTest.java
@@ -118,7 +118,7 @@ public class MetadataResponseFormatterTest {
             result = MetadataResponseFormatter.formatResponseString(metadataList);
             fail("formatting should fail because fields field is null");
         } catch (IllegalArgumentException e) {
-            assertEquals("metadata contains no fields - cannot serialize", e.getMessage());
+            assertEquals("metadata for " + metadata.getItem() + " contains no fields - cannot
serialize", e.getMessage());
         }
 
         ArrayList<Metadata.Field> fields = new ArrayList<Metadata.Field>();
@@ -129,7 +129,7 @@ public class MetadataResponseFormatterTest {
             result = MetadataResponseFormatter.formatResponseString(metadataList);
             fail("formatting should fail because there are no fields");
         } catch (IllegalArgumentException e) {
-            assertEquals("metadata contains no fields - cannot serialize", e.getMessage());
+            assertEquals("metadata for " + metadata.getItem() + " contains no fields - cannot
serialize", e.getMessage());
         }
     }
 


Mime
View raw message