-
Notifications
You must be signed in to change notification settings - Fork 6
/
hits.sh
129 lines (123 loc) · 2.72 KB
/
hits.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
set -e
cat <<SQL | bendsql
select version();
SQL
cat <<SQL | bendsql
DROP TABLE IF EXISTS hits ALL;
SQL
cat <<SQL | bendsql
CREATE TABLE IF NOT EXISTS hits (
WatchID UINT64,
JavaEnable UINT8,
Title VARCHAR,
GoodEvent INT8,
EventTime DateTime,
EventDate Date,
CounterID UINT32,
ClientIP UINT32,
RegionID UINT32,
UserID UINT64,
CounterClass INT8,
OS UINT8,
UserAgent UINT8,
URL VARCHAR,
Referrer VARCHAR,
Refresh UINT8,
ReferrerCategoryID UINT16,
ReferrerRegionID UINT32,
URLCategoryID UINT16,
URLRegionID UINT32,
ResolutionWidth UINT16,
ResolutionHeight UINT16,
ResolutionDepth UINT8,
FlashMajor UINT8,
FlashMinor UINT8,
FlashMinor2 VARCHAR,
NetMajor UINT8,
NetMinor UINT8,
UserAgentMajor UINT16,
UserAgentMinor VARCHAR,
CookieEnable UINT8,
JavascriptEnable UINT8,
IsMobile UINT8,
MobilePhone UINT8,
MobilePhoneModel VARCHAR,
Params VARCHAR,
IPNetworkID UINT32,
TrafficSourceID INT8,
SearchEngineID UINT16,
SearchPhrase VARCHAR,
AdvEngineID UINT8,
IsArtificial UINT8,
WindowClientWidth UINT16,
WindowClientHeight UINT16,
ClientTimeZone INT16,
ClientEventTime VARCHAR,
SilverlightVersion1 UINT8,
SilverlightVersion2 UINT8,
SilverlightVersion3 UINT32,
SilverlightVersion4 UINT16,
PageCharset VARCHAR,
CodeVersion UINT32,
IsLink UINT8,
IsDownload UINT8,
IsNotBounce UINT8,
FUniqID UINT64,
OriginalURL VARCHAR,
HID UINT32,
IsOldCounter UINT8,
IsEvent UINT8,
IsParameter UINT8,
DontCountHits UINT8,
WithHash UINT8,
HitColor VARCHAR,
LocalEventTime DateTime,
Age UINT8,
Sex UINT8,
Income UINT8,
Interests UINT16,
Robotness UINT8,
RemoteIP UINT32,
WindowName INT32,
OpenerName INT32,
HistoryLength INT16,
BrowserLanguage VARCHAR,
BrowserCountry VARCHAR,
SocialNetwork VARCHAR,
SocialAction VARCHAR,
HTTPError UINT16,
SendTiming UINT32,
DNSTiming UINT32,
ConnectTiming UINT32,
ResponseStartTiming UINT32,
ResponseEndTiming UINT32,
FetchTiming UINT32,
SocialSourceNetworkID UINT8,
SocialSourcePage VARCHAR,
ParamPrice INT64,
ParamOrderID VARCHAR,
ParamCurrency VARCHAR,
ParamCurrencyID UINT16,
OpenstatServiceName VARCHAR,
OpenstatCampaignID VARCHAR,
OpenstatAdID VARCHAR,
OpenstatSourceID VARCHAR,
UTMSource VARCHAR,
UTMMedium VARCHAR,
UTMCampaign VARCHAR,
UTMContent VARCHAR,
UTMTerm VARCHAR,
FromTag VARCHAR,
HasGCLID UINT8,
ReferrerHash UINT64,
URLHash UINT64,
CLID UINT32
) ENGINE=FUSE;
SQL
cat <<SQL | bendsql
COPY INTO hits FROM 'https://datasets.databend.com/hits_100m_obfuscated_v1.tsv.xz' FILE_FORMAT = (type = TSV compression = XZ field_delimiter = '\t' record_delimiter = '\n' skip_header = 0);
SQL
cat <<SQL | bendsql
SELECT count(*) FROM hits;
SQL