Skip to content

Commit 85bb249

Browse files
authored
Merge pull request #311 from cybermaxs/main
fix : lab Spark - Update failing test `test_monthly_site_hits` due to an empty array
2 parents 7417202 + ad9169e commit 85bb249

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bootcamp/materials/3-spark-fundamentals/src/jobs/monthly_user_site_hits_job.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
def do_monthly_user_site_hits_transformation(spark, dataframe, ds):
88
query = f"""
99
SELECT
10-
month_start,
11-
SUM(COALESCE(hit_array[0], 0)) as num_hits_first_day,
12-
SUM(COALESCE(hit_array[1], 0)) AS num_hits_second_day,
13-
SUM(COALESCE(hit_array[2], 0)) as num_hits_third_day
10+
month_start,
11+
SUM(COALESCE(get(hit_array, 0), 0)) AS num_hits_first_day,
12+
SUM(COALESCE(get(hit_array, 1), 0)) AS num_hits_second_day,
13+
SUM(COALESCE(get(hit_array, 2), 0)) AS num_hits_third_day
1414
FROM monthly_user_site_hits
1515
WHERE date_partition = '{ds}'
1616
GROUP BY month_start

0 commit comments

Comments
 (0)