Sessionizeの例 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Advanced SQL Engine分析関数

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
2020年6月
Language
日本語
Last Update
2021-03-30
dita:mapPath
ja-JP/mld1565890109978.ditamap
dita:ditavalPath
ja-JP/mld1565890109978.ditaval
dita:id
B035-1206
Product Category
Software
Teradata Vantage

入力

sessionize_table
partition_id clicktime userid productname pagetype referrer productprice
1 1110000 333   Home www.yahoo.com  
1 1112000 333 Ipod Checkout www.yahoo.com 200.2
1 1160000 333 Bose Checkout   340
1 1200000 333   Home www.google.com  
1 1203000 67403   Home www.google.com  
1 1300000 67403   Home www.google.com  
1 1301000 67403   Home    
1 1302000 67403   Home    
1 1340000 67403 Iphone Checkout   650
1 1450000 67403 Bose Checkout   750
1 1450200 80000   Home godaddy.com  
1 1450600 80000 Bose Checkout   340
1 1450800 80000 Itrip Checkout   450
1 1452000 880000 Iphone Checkout   650

SQL呼び出し

SELECT * FROM Sessionize (
  ON sessionize_table PARTITION BY partition_id ORDER BY clicktime
  USING
  TimeColumn ('clicktime')
  TimeOut (60)
  ClickLag (0.2)
) ORDER BY partition_id, clicktime;

出力

partition_id clicktime userid productname pagetype referrer productprice SESSIONID CLICKLAG
1 1110000 333   Home www.yahoo.com   0 f
1 1112000 333 Ipod Checkout www.yahoo.com 200.2 0 f
1 1160000 333 Bose Checkout   340 0 f
1 1200000 333   Home www.google.com   0 f
1 1203000 67403   Home www.google.com   0 f
1 1300000 67403   Home www.google.com   1 f
1 1301000 67403   ホーム     1 f
1 1302000 67403   Home     1 f
1 1340000 67403 Iphone Checkout   650 1 f
1 1450000 67403 Bose Checkout   750 2 f
1 1450200 80000   Home godaddy.com   2 t
1 1450600 80000 Bose Checkout   340 2 f
1 1450800 80000 Itrip Checkout   450 2 t
1 1452000 880000 Iphone Checkout   650 2 f