hawq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shivzone <...@git.apache.org>
Subject [GitHub] incubator-hawq pull request: HAWQ 459 Enhanced metadata api to sup...
Date Tue, 22 Mar 2016 18:12:05 GMT
Github user shivzone commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/477#discussion_r57039658
  
    --- Diff: pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/utilities/HiveUtilities.java
---
    @@ -225,15 +245,47 @@ private static boolean verifyModifers(String[] modifiers) {
             }
     
             if (toks.size() == 1) {
    -            dbName = HIVE_DEFAULT_DBNAME;
    -            tableName = toks.get(0);
    +            dbPattern = HIVE_DEFAULT_DBNAME;
    +            tablePattern = toks.get(0);
             } else if (toks.size() == 2) {
    -            dbName = toks.get(0);
    -            tableName = toks.get(1);
    +            dbPattern = toks.get(0);
    +            tablePattern = toks.get(1);
             } else {
    -            throw new IllegalArgumentException("\"" + qualifiedName + "\"" + errorMsg);
    +            throw new IllegalArgumentException("\"" + pattern + "\"" + errorMsg);
    +        }
    +
    +        return getTablesFromPattern(client, dbPattern, tablePattern);
    +
    +    }
    +
    +    private static List<Metadata.Item> getTablesFromPattern(HiveMetaStoreClient
client, String dbPattern, String tablePattern) {
    +
    +        List<String> databases = null;
    +        List<Metadata.Item> itemList = new ArrayList<Metadata.Item>();
    +        List<String> tables = new ArrayList<String>();
    +
    +        if(client == null || (!dbPattern.contains(WILDCARD) && !tablePattern.contains(WILDCARD))
) {
    +            /* This case occurs when the call is invoked as part of the fragmenter api
or when metadata is requested for a specific table name */
    +            itemList.add(new Metadata.Item(dbPattern, tablePattern));
    +            return itemList;
             }
     
    -        return new Metadata.Table(dbName, tableName);
    +        try {
    +            databases = client.getDatabases(dbPattern);
    +            if(databases.isEmpty()) {
    +                throw new IllegalArgumentException("No database found for the given pattern");
    +            }
    +            for(String dbName: databases) {
    +                for(String tableName: client.getTables(dbName, tablePattern)) {
    --- End diff --
    
    getTables only takes absolute dbname and not dbpattern. so we will need 2 separate calls


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message