gTree - Aster Analytics

Teradata AsterĀ® Analytics Foundation User GuideUpdate 2

Product
Aster Analytics
Release Number
7.00.02
Published
September 2017
Language
English (United States)
Last Update
2018-04-17
dita:mapPath
uce1497542673292.ditamap
dita:ditavalPath
AA-notempfilter_pdf_output.ditaval
dita:id
B700-1022
lifecycle
previous
Product Category
Software

The gTree function follows all paths in a graph, starting from a given set of root vertices, and calculates specified aggregate functions along those paths.

The gTree function is similar to the function nTree, but gTree is implemented using the SQL-GR engine. The SQL-GR engine allows the gTree function to traverse arbitrary graphs.

Some information in nTree arguments is input to the gTree function differently, as the following table shows.

gTree Analogs of nTree Arguments
SQL-MR Function nTree Argument SQL-GR Function gTree Analog
Root_Node gTree gets the root nodes of the trees from the input table root.
Node_ID gTree gets the nodes from the partition keys for the input tables vertices, edges, and root. The name of these keys can differ, but each partition must have the same number of keys and corresponding keys must have the same data type.
Parent_ID The input table edges and the TargetKey argument define the parent ID. If the TargetKey specifies a vertex, then gTree finds its parent in the corresponding partition key entries.
Mode To change the direction in which gTree traverses the graph, reverse the direction of the edges by switching the columns in the edges table partition key with the columns specified by the TargetKey argument.
Result gTree gets the aggregate functions and their aliases from its Results argument, which is similar to the nTree Result argument. However, the parser that gTree uses requires that you enclose each aggregate function and its alias in quotation marks.