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

    https://github.com/apache/incubator-hawq/pull/959#discussion_r83113822
  
    --- Diff: src/bin/psql/describe.c ---
    @@ -4316,10 +4316,10 @@ describePxfTable(const char *profile, const char 
*pattern, bool verbose)
                if (verbose)
                {
                        sourcefieldtype = PQgetvalue(res, i, 4);
    -                   total_fields = PQgetvalue(res, i, 5);
    +                   total_fields = atoi(PQgetvalue(res, i, 5));
    --- End diff --
    
    No, atoi() doesn't guarantee a positive value, it just takes char, assumes 
it's a int value and converts it to int value. The SQL `SELECT t.path, 
t.itemname, t.fieldname, t.fieldtype, sourcefieldtype, COUNT() OVER(PARTITION 
BY path, itemname) as total_fields FROM pxf_get_item_fields('Hive', '*') t` 
guarantees that total_fields will be >=0. I would say we could fix function 
pg_local_calloc so it should take only positive value.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to