EVENT_NAME
返回一个 VARCHAR 值,表示与行匹配事件的名称。
语法
EVENT_NAME()
注意
模式匹配函数必须用在 MATCH 子句 语法中;例如,如果单独调用 EVENT_NAME(),Vertica 将返回以下错误消息:
=> SELECT event_name();
ERROR: query with pattern matching function event_name must include a MATCH clause
示例
注意
此示例使用在 事件系列模式匹配 中定义的架构。以下语句分析了用户在 "website2.com" 的浏览历史并标识了用户从另一网站(进入)登录 website2.com
以及在做出购买之前(购买)浏览任意数量的其他页面(站内)的模式。该查询还将输出 EVENT_NAME() 的结果值,即与行匹配的事件的名称。
SELECT uid,
sid,
ts,
refurl,
pageurl,
action,
event_name()
FROM clickstream_log
MATCH
(PARTITION BY uid, sid ORDER BY ts
DEFINE
Entry AS RefURL NOT ILIKE '%website2.com%' AND PageURL ILIKE '%website2.com%',
Onsite AS PageURL ILIKE '%website2.com%' AND Action='V',
Purchase AS PageURL ILIKE '%website2.com%' AND Action = 'P'
PATTERN
P AS (Entry Onsite* Purchase)
ROWS MATCH FIRST EVENT);
uid | sid | ts | refurl | pageurl | action | event_name
-----+-----+----------+----------------------+----------------------+--------+------------
1 | 100 | 12:00:00 | website1.com | website2.com/home | V | Entry
1 | 100 | 12:01:00 | website2.com/home | website2.com/floby | V | Onsite
1 | 100 | 12:02:00 | website2.com/floby | website2.com/shamwow | V | Onsite
1 | 100 | 12:03:00 | website2.com/shamwow | website2.com/buy | P | Purchase
2 | 100 | 12:10:00 | website1.com | website2.com/home | V | Entry
2 | 100 | 12:11:00 | website2.com/home | website2.com/forks | V | Onsite
2 | 100 | 12:13:00 | website2.com/forks | website2.com/buy | P | Purchase
(7 rows)