Skip to content

Commit 8c305c9

Browse files
committed
Add pyspark query 8 [skip ci]
1 parent b420f9b commit 8c305c9

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

tests/tpch/test_pyspark.py

+57
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,63 @@ def test_query_7(spark, dataset_path):
265265
spark.sql(query).show()
266266

267267

268+
def test_query_8(spark, dataset_path):
269+
for name in (
270+
"part",
271+
"supplier",
272+
"lineitem",
273+
"orders",
274+
"customer",
275+
"nation",
276+
"region",
277+
):
278+
register_table(spark, dataset_path, name)
279+
280+
query = """
281+
select
282+
supp_nation,
283+
cust_nation,
284+
l_year,
285+
sum(volume) as revenue
286+
from
287+
(
288+
select
289+
n1.n_name as supp_nation,
290+
n2.n_name as cust_nation,
291+
year(l_shipdate) as l_year,
292+
l_extendedprice * (1 - l_discount) as volume
293+
from
294+
supplier,
295+
lineitem,
296+
orders,
297+
customer,
298+
nation n1,
299+
nation n2
300+
where
301+
s_suppkey = l_suppkey
302+
and o_orderkey = l_orderkey
303+
and c_custkey = o_custkey
304+
and s_nationkey = n1.n_nationkey
305+
and c_nationkey = n2.n_nationkey
306+
and (
307+
(n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY')
308+
or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE')
309+
)
310+
and l_shipdate between date '1995-01-01' and date '1996-12-31'
311+
) as shipping
312+
group by
313+
supp_nation,
314+
cust_nation,
315+
l_year
316+
order by
317+
supp_nation,
318+
cust_nation,
319+
l_year
320+
"""
321+
322+
spark.sql(query).show()
323+
324+
268325
def fix_timestamp_ns_columns(query):
269326
"""
270327
scale100 stores l_shipdate/o_orderdate as timestamp[us]

0 commit comments

Comments
 (0)