-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQueries.scala
181 lines (159 loc) · 4.2 KB
/
Queries.scala
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
package gr.cslab.ntua.musqle
/**
* Created by Victor on 23/7/2016.
*/
val q0 =
"""
|select c_name
|from customer, nation
|where c_nationkey = n_nationkey
|""".stripMargin
val q1 =
"""
|select c_name
|from customer, orders
|where c_custkey = o_orderkey
""".stripMargin
val q2 =
"""
|select c_name
|from orders, customer, nation
|where o_custkey = c_custkey
|and c_nationkey = n_nationkey
""".stripMargin
val q3 =
"""
|select l_linenumber
|from lineitem, orders, customer, nation
|where l_orderkey = o_orderkey
|and o_custkey = c_custkey
|and c_nationkey = n_nationkey
""".stripMargin
val q4 =
"""
|select l_linenumber
|from part, lineitem, orders, customer, nation
|where p_partkey = l_partkey
|and l_orderkey = o_orderkey
|and o_custkey = c_custkey
|and c_nationkey = n_nationkey
""".stripMargin
val q5 =
"""
|select o_orderdate
|from customer, nation, orders, lineitem, part, partsupp
|where c_nationkey = n_nationkey
|and c_custkey = o_custkey
|and l_orderkey = o_orderkey
|and l_partkey = p_partkey
|and p_partkey = ps_partkey
""".stripMargin
val q6 =
"""
|select ps_availqty
|from customer, nation, orders, lineitem, part, partsupp, supplier
|where c_nationkey = n_nationkey
|and c_custkey = o_orderkey
|and l_orderkey = o_orderkey
|and l_partkey = p_partkey
|and p_partkey = ps_partkey
|and s_suppkey = ps_suppkey
""".stripMargin
val q7 =
"""
|select c_name
|from customer, nation, region
|where c_nationkey = n_nationkey
|and n_regionkey = r_regionkey
|""".stripMargin
val q8 =
"""
|select p_name
|from part, partsupp
|where p_partkey = ps_partkey
|""".stripMargin
val q9 =
"""
|select r_name
|from customer, nation, region,orders
|where c_nationkey = n_nationkey
|and n_regionkey = r_regionkey
|and r_name = 'EUROPE'
|and c_custkey = o_custkey
|and c_custkey < 200
|""".stripMargin
val q10 =
"""
|select l_discount
|from lineitem, orders, customer, nation, region
|where l_orderkey = o_orderkey
|and o_custkey = c_custkey
|and c_nationkey = n_nationkey
|and n_regionkey = r_regionkey
|and r_name = 'AFRICA'
""".stripMargin
val q11 =
"""
|select c_name
|from customer, orders, lineitem, nation
|where c_custkey = o_custkey
|and o_orderkey = l_orderkey
|and c_nationkey = n_nationkey
|and c_nationkey = 8
""".stripMargin
val q12 =
"""
|select c_name
|from customer, nation, region,orders
|where c_nationkey = n_nationkey
|and n_regionkey = r_regionkey
|and r_name = 'EUROPE'
|and c_custkey = o_custkey
|""".stripMargin
//Possible Data Movement from HDFS to Postgres
val q13 =
"""
|select o_orderkey
|from orders, customer, nation, region
|where o_custkey = c_custkey
|and c_nationkey = n_nationkey
|and n_regionkey = r_regionkey
|and o_orderkey < 100
""".stripMargin
val q14 =
"""
|select l_partkey
|from lineitem, orders, partsupp, part
|where l_orderkey = o_orderkey
|and l_partkey = ps_partkey
|and p_partkey = ps_partkey
|and l_orderkey = 5
""".stripMargin
val q15 =
"""
|select o_orderdate
|from partsupp, part, lineitem, orders, customer, nation
|where p_partkey = ps_partkey
|and p_partkey = l_partkey
|and l_orderkey = o_orderkey
|and o_custkey = c_custkey
|and c_nationkey = n_nationkey
|and p_retailprice < 2000
|and n_name = 'AFRICA'
""".stripMargin
val q16 =
"""
|select n_nationkey
|from partsupp, supplier, nation
|where ps_suppkey = s_suppkey
|and s_nationkey = n_nationkey
|and n_name = 'EUROPE'
""".stripMargin
val q17 =
"""
|select p_name
|from part, partsupp, supplier
|where p_partkey = ps_partkey
|and ps_suppkey = s_suppkey
|and p_partkey = 3
|""".stripMargin