1.1 - 8.10 - GTree (ML Engine) - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

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 (ML Engine), 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 syntax elements is input to the GTree function differently, as the following table shows.

GTree Analogs of NTree Syntax Elements
SQL-MR Function NTree Syntax Element 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 syntax element 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 syntax element.
Result GTree gets the aggregate functions and their aliases from its Results syntax element, which is similar to the NTree Result syntax element. However, the parser that GTree uses requires that you enclose each aggregate function and its alias in quotation marks.