Skip to content

Commit 47a2ff2

Browse files
committed
add error performance fql
1 parent 7d4e345 commit 47a2ff2

File tree

5 files changed

+172
-0
lines changed

5 files changed

+172
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
CREATE TEMPORARY VIEW temp_view AS
2+
select
3+
e.application_id as id,
4+
e.main_id as main_id,
5+
(
6+
case
7+
when r.province = 'Hongkong' then '22.27747'
8+
WHEN r.province = 'Macao' then '22.16252'
9+
WHEN r.province = 'Taiwan' then '25.04573'
10+
ELSE -- expect error
11+
END
12+
) as lat,
13+
(
14+
case
15+
when r.province = 'Hongkong' then '114.1712'
16+
WHEN r.province = 'Macao' then '113.5838'
17+
WHEN r.province = 'Taiwan' then '121.5117'
18+
ELSE m.lng
19+
END
20+
) as lng,
21+
(
22+
case
23+
when r.province = 'Hongkong' then 'HK'
24+
WHEN r.province = 'Macao' then 'MO'
25+
WHEN r.province = 'Taiwan' then 'TW'
26+
ELSE r.areacode
27+
END
28+
) as region,
29+
count(distinct e.s_id) filter (
30+
where
31+
TIMESTAMPDIFF(MINUTE, e.rowtime, LOCALTIMESTAMP) <= 10
32+
) as uv,
33+
count(e.s_id) filter (
34+
where
35+
TIMESTAMPDIFF(MINUTE, e.rowtime, LOCALTIMESTAMP) <= 10
36+
) as pv,
37+
HOP_END(e.proctime, INTERVAL '10' SECOND, INTERVAL '10' MINUTE) as dt
38+
from
39+
filter_uv e
40+
left join lookup_ip_info FOR SYSTEM_TIME AS OF e.proctime as r on e.ip = r.ip
41+
left join lookup_international_location FOR SYSTEM_TIME AS OF e.proctime as m on m.code = r.areacode
42+
where
43+
TIMESTAMPDIFF(MINUTE, e.rowtime, LOCALTIMESTAMP) <= 10
44+
group by
45+
e.application_id,
46+
e.main_id,
47+
(
48+
case
49+
when r.province = 'Hongkong' then '22.27747'
50+
WHEN r.province = 'Macao' then '22.16252'
51+
WHEN r.province = 'Taiwan' then '25.04573'
52+
ELSE m.lat
53+
END
54+
),
55+
(
56+
case
57+
when r.province = 'Hongkong' then '114.1712'
58+
WHEN r.province = 'Macao' then '113.5838'
59+
WHEN r.province = 'Taiwan' then '121.5117'
60+
ELSE m.lng
61+
END
62+
),
63+
r.areacode,
64+
(
65+
case
66+
when r.province = 'Hongkong' then 'HK'
67+
WHEN r.province = 'Macao' then 'MO'
68+
WHEN r.province = 'Taiwan' then 'TW'
69+
ELSE r.areacode
70+
END
71+
),
72+
HOP(e.proctime, INTERVAL '10' SECOND, INTERVAL '10' MINUTE);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE DATABASE my_dwv;
2+
3+
use my_dwv --expect error
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CREATE TEMPORARY VIEW tmp_view AS
2+
SELECT
3+
*
4+
FROM
5+
(
6+
SELECT
7+
*,
8+
ROW_NUMBER() OVER (
9+
PARTITION FLOOR( --miss 'BY'
10+
TO_TIMESTAMP(
11+
FROM_UNIXTIME(event_time / 1000, 'yyyy-MM-dd HH:mm:ss')
12+
) TO HOUR
13+
),
14+
event_time,
15+
order_seq,
16+
sku_id,
17+
is_offline
18+
ORDER
19+
BY proctime DESC
20+
) AS rownum
21+
FROM
22+
source_trade_order_fht
23+
WHERE
24+
is_offline = 0
25+
)
26+
WHERE
27+
rownum = 1;

docs/performance/error/select.fql

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
CREATE TEMPORARY VIEW tmp_view AS
2+
select
3+
name as row_key,
4+
cast(id as BIGINT) as id,
5+
count(1) filter (
6+
where
7+
(
8+
event_no not in (
9+
'54126212',
10+
'54126213',
11+
'54126214',
12+
'54126215',
13+
'54126216',
14+
'54126217'
15+
)
16+
AND event_no = '101'
17+
)
18+
) as f1,
19+
count(1) filter (
20+
where
21+
(
22+
event_no <> '60079992'
23+
or event_name <> '138'
24+
)
25+
) as f2,
26+
count(1) filter (
27+
where
28+
event_name = 'trigger'
29+
) as f3,
30+
sum(1) filter (
31+
where
32+
visit_type = 'look'
33+
and (
34+
event_no <> '54126210'
35+
or event_name = 'trigger2'
36+
)
37+
) as f4,
38+
count(distinct name) filter (
39+
where
40+
TIMESTAMPDIFF(MINUTE, rowtime, LOCALTIMESTAMP) <= 10
41+
and event_no <> '54126211'
42+
) as f5,
43+
(
44+
case
45+
when country = 'China' then 8
46+
when country = 'US' then 20
47+
ELSE 0
48+
END
49+
) as timezone,
50+
FLOOR(rowtime TO MINUTE as dt, -- miss )
51+
PROCTIME() as proctime
52+
from
53+
source_table
54+
where
55+
create_timestamp is not null
56+
group by
57+
id,
58+
name;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
insert into
2+
table1
3+
select
4+
ARRAY [ ROW(
5+
f1,
6+
f2,
7+
f3,
8+
f4,
9+
f5, -- expect error
10+
)] as message
11+
from
12+
source_table;

0 commit comments

Comments
 (0)