nPath Arguments - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢
Mode
Specify the pattern-matching mode:
Option Description
OVERLAPPING Find every occurrence of pattern in partition, regardless of whether it is part of a previously found match. One row can match multiple symbols in a given matched pattern.
NONOVERLAPPING Start next pattern search at row that follows last pattern match.
Pattern
Specify the pattern for which the function searches. You compose pattern with the symbols (which you define in the Symbols argument), operators, and parentheses.

When patterns have multiple operators, the function applies them in order of precedence, and applies operators of equal precedence from left to right. To force the function to evaluate a subpattern first, enclose it in parentheses. For more information, see nPath Patterns.

Symbols
Specify the symbols that appear in the values of the Pattern and Result arguments. The col_expr is an expression whose value is a column name, symbol is any valid identifier, and symbol_predicate is a SQL predicate (often a column name).

For example, this Symbols argument is for analyzing website visits:

Symbols (
  pagetype = 'homepage' AS H,
  pagetype <> 'homepage' AND pagetype <> 'checkout' AS PP,
  pagetype = 'checkout' AS CO
)

The symbol is case-insensitive; however, a symbol of one or two uppercase letters is easy to identify in patterns.

If col_expr represents a column that appears in multiple input tables, you must qualify the ambiguous column name with its table name. For example:

Symbols (
  weblog.pagetype = 'homepage' AS H,
  weblog.pagetype = 'thankyou' AS T,
  ads.adname = 'xmaspromo' AS X,
  ads.adname = 'realtorpromo' AS R
)

For more information about symbols that appear in the Pattern argument value, see nPath Symbols. For more information about symbols that appear in the Result argument value, see nPath Results.

Filter
[Optional] Specify filters to impose on the matched rows. The function combines the filter expressions using the AND operator.

This is the filter_expression syntax:

symbol_expression comparison_operator symbol_expression

The two symbol expressions must be type-compatible. This is the symbol_expression syntax:

{ FIRST | LAST }(column_with_expression OF [ANY](symbol[,...]))

The column_with_expression cannot contain the operator AND or OR, and all its columns must come from the same input. If the function has multiple inputs, column_with_expression and symbol must come from the same input.

The comparison_operator is either <, >, <=, >=, =, or !=.

Whether this argument improves or degrades nPath performance depends on several factors. For details, see nPath Filters.

Result
Specify the output columns. The col_expr is an expression whose value is a column name; it specifies the values to retrieve from the matched rows. The function applies aggregate_function to these values. For details, see nPath Results.

The function evaluates this argument once for every matched pattern in the partition (that is, it outputs one row for each pattern match).