[ 
https://issues.apache.org/jira/browse/HAWQ-465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15206958#comment-15206958
 ] 

ASF GitHub Bot commented on HAWQ-465:
-------------------------------------

Github user hornn commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/479#discussion_r57041307
  
    --- Diff: src/backend/catalog/external/externalmd.c ---
    @@ -129,45 +135,45 @@ HCatalogTable *ParseHCatalogTable(struct json_object 
*hcatalogMD)
                        const int numModifiers = 
json_object_array_length(jsonModifiers);
                        Assert(2 >= numModifiers);
                        
    -                   hcatalogCol->nTypeModifiers = numModifiers;
    +                   pxfField->nTypeModifiers = numModifiers;
                        for (int j = 0; j < numModifiers; j++)
                        {
                                struct json_object *jsonMod = 
json_object_array_get_idx(jsonModifiers, j);
    -                           hcatalogCol->typeModifiers[j] = 
json_object_get_int(jsonMod);
    +                           pxfField->typeModifiers[j] = 
json_object_get_int(jsonMod);
                                
    -                           elog(DEBUG1, "modifier[%d]: %d", j, 
hcatalogCol->typeModifiers[j]);
    +                           elog(DEBUG1, "modifier[%d]: %d", j, 
pxfField->typeModifiers[j]);
                        }
                }
    -           hcatalogTable->columns = lappend(hcatalogTable->columns, 
hcatalogCol);
    +           pxfItem->fields = lappend(pxfItem->fields, pxfField);
        }
     
    -   return hcatalogTable;
    +   return pxfItem;
     }
     
     /*
    - * LoadHcatalogTable
    - *                 Load the given hcatalog table into in-memory heap tables
    + * LoadPxfItem
    + *                 Load the given PXF item into in-memory heap tables
      */
    -void LoadHCatalogEntry(HCatalogTable *hcatalogTable)
    +void LoadPxfItem(PxfItem *pxfItem, Oid dboid)
     {
    -   Oid namespaceOid = LookupNamespaceId(hcatalogTable->dbName, 
HcatalogDbOid);
    +   Oid namespaceOid = LookupNamespaceId(pxfItem->path, dboid);
     
        if (!OidIsValid(namespaceOid))
        {
    -           /* hcatalog database name has not been mapped to a namespace 
yet: create it */
    -           namespaceOid = LoadHCatalogNamespace(hcatalogTable->dbName);
    -           elog(DEBUG1, "No namespace found: %s. Generated new namespace 
oid: %u", hcatalogTable->dbName, namespaceOid);
    +           /* external database name has not been mapped to a namespace 
yet: create it */
    +           namespaceOid = LoadNamespace(pxfItem->path, dboid);
    +           elog(DEBUG1, "No namespace found: %s. Generated new namespace 
oid: %u", pxfItem->path, namespaceOid);
        }
        
    -   LoadHCatalogTable(namespaceOid, hcatalogTable);
    +   LoadTable(namespaceOid, pxfItem);
     }
     
     /*
    - * CreateHCatalogNamespace
    - *                 Create an entry for the given HCatalog namespace in the 
in-memory heap tables and
    + * LoadNamespace
    + *                 Create an entry for the given PXF namespace in the 
in-memory heap tables and
      *                 return the reserved namespace oid
      */
    -Oid LoadHCatalogNamespace(const char *namespaceName)
    +Oid LoadNamespace(const char *namespaceName, Oid dboid)
     {
    --- End diff --
    
    add assert that dboid is not invalid oid?


> Implement stored procedure to return fields metainfo from PXF
> -------------------------------------------------------------
>
>                 Key: HAWQ-465
>                 URL: https://issues.apache.org/jira/browse/HAWQ-465
>             Project: Apache HAWQ
>          Issue Type: Sub-task
>          Components: Hcatalog, PXF
>            Reporter: Oleksandr Diachenko
>            Assignee: Oleksandr Diachenko
>             Fix For: 2.0.0
>
>
> User should be able to call built-in function:
> {code}
> select pxf_get_object_fields('source_name', 'container_name', 'object_name');
>  pxf_get_object_fields 
> {code}
> to retrieve all metadata for given source, container, object.
> Input parameters:
> ||Name||Type||Mode||
> |profile|text|IN|
> |pattern|text|IN|
> |path|text|OUT|
> |objectname|text|OUT|
> |fieldname|text|OUT|
> |fieldtype|text|OUT|
> |fieldmodifiers|text|OUT|
> Example:
> {noformat}
> # select * from pxf_get_object_fields('Hive', 'default/tab*');
>   path  | objectname  | fieldname       |    fieldtype   |  fieldmodifiers |
> ---------+-----------------+------------------ 
> +----------------+-------------------+
> default |      table1     |        col1         |        int4       |     not 
> null       |
> default |      table1     |        col2         |        text       |         
>                |
> default |      table2     |        col1         |        int4       |     not 
> null       |
> default |      table2     |        col2         |        text       |         
>                |
> (4 rows)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to