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 546
Date Wed, 30 Mar 2016 23:09:19 GMT
Github user shivzone commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/529#discussion_r57979044
  
    --- Diff: src/bin/psql/describe.c ---
    @@ -4213,3 +4236,113 @@ printACLColumn(PQExpBuffer buf, const char *colname)
     						  "pg_catalog.array_to_string(%s, '\\n') AS \"%s\"",
     						  colname, gettext_noop("Access privileges"));
     }
    +
    +/*
    + * parsePxfPattern
    + *
    + * Splits user_pattern by "." and writes second part to pattern.
    + */
    +static void
    +parsePxfPattern(const char *user_pattern, char **pattern)
    +{
    +	strtok(user_pattern, ".");
    +	*pattern = strtok(NULL, "/0");
    +}
    +
    +/*
    + * describePxfTable
    + *
    + * Describes external PXF table.
    + */
    +static bool
    +describePxfTable(const char *profile, const char *pattern, bool verbose)
    +{
    +	PQExpBufferData buf;
    +	PQExpBufferData title;
    +	PGresult *res;
    +	printQueryOpt myopt = pset.popt;
    +	printTableContent cont;
    +	int			cols = 0;
    +	int			total_numrows = 0;
    +	char	   *headers[2];
    +	bool		printTableInitialized = false;
    +
    +	initPQExpBuffer(&buf);
    +
    +	printfPQExpBuffer(&buf, "SELECT * FROM\n"
    +			"pxf_get_item_fields('%s', '%s') \n", profile, pattern);
    +
    +	res = PSQLexec(buf.data, false);
    +	total_numrows = PQntuples(res);
    +	termPQExpBuffer(&buf);
    +	if (!res)
    +		return false;
    +
    +	myopt.nullPrint = NULL;
    +	myopt.title = _("List of Hive tables");
    +	myopt.translate_header = true;
    +
    +
    +	/* Header */
    +	headers[0] = gettext_noop("Column");
    +	headers[1] = gettext_noop("Type");
    +	cols = 2;
    +
    +	char *previous_path = NULL;
    +	char *previous_itemname = NULL;
    +
    +
    --- End diff --
    
    extra newline


---
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