autoJoinTables Macro

Expands into an autoJoinTables operator.

Syntax:

@autoJoinTables(parent: TableReference, children: TableReferenceList, [result: TableResultList])

If result is omitted, the value parent +: children is used.

Examples:

@autoJoinTables(P, [C1, C2, C3])  # equivalent to @autoJoinTables(P, [C1, C2, C3], [P, C1, C2, C3])
@autoJoinTables(P, [C1, C2, C3], [P, C2])

Semantic:

The macro expands to autoJoinTables(joinTables, result), where joinTables is the distinct concatenation of reverseDfsOrder(parent, child) for every child table in children, and reverseDfsOrder(p, c) is the reverse of the DFS ordering obtained by traversing the inverted subdag between p and c starting from c.

In other words, joinTables is the set of all nodes on every path between a child and the parent node, ordered in a specific way to make autoJoinTables work.

The documentation for the autoJoinTables operator is here.

Use Case:

Suppose you have tables similar to

2774

Now, if you were to use autoJoinTables operator, you'd write:

autoJoinTables([head, a, aChild1, a1, b, bChild1, b1, c, cChild1, c1])

i.e. you have to specify all intermediate nodes from a1 to head as well as b1 to head as well as c1 to head in order,
but with @autoJoinTables macro, it becomes slightly easier:

@autoJoinTables(head, [a1, b1, c1])

© Devo Technology Inc. All Rights Reserved.