7.00.02 - SQL-MapReduce Call - Aster Analytics

Teradata Aster® Analytics Foundation User GuideUpdate 2

Product
Aster Analytics
Release Number
7.00.02
Release Date
September 2017
Content Type
Programming Reference
User Guide
Publication ID
B700-1022-700K
Language
English (United States)
SELECT * FROM npath (
  ON clicks PARTITION BY sessionid ORDER BY clicktime
  Mode ('nonoverlapping')
  Symbols (pagetype='home' AS H, pagetype='checkout' AS C,
           pagetype!='home' AND pagetype!='checkout' AS A)
  Pattern ('^H+.A*.C+$')
  Result (
    FIRST (sessionid OF ANY (H, A, C)) AS sessionid,
    FIRST (clicktime OF H) AS firsthome,
    FIRST (clicktime OF C) AS firstcheckout,
    ACCUMULATE (productname OF ANY (H,A,C))
      AS products_accumulate,
    COUNT (DISTINCT productname OF ANY(H,A,C))
      AS count_distinct_products,
    ACCUMULATE (CDISTINCT productname OF ANY (H,A,C))
      AS consecutive_distinct_products,
    ACCUMULATE (DISTINCT productname OF ANY (H,A,C))
      AS distinct_products,
    NTH (productname, -1 OF ANY(H,A,C)) AS nth
  )
) ORDER BY sessionid;