Question: convert below SQL into spark program - select distinct a . branch _ number, b . post _ code, case when a . location _

convert below SQL into spark program -select distinct a.branch_number,
b.post_code,
case when a.location_format is NULL and a.location_type like "Petrol-Filling-Station" then "Petrol"
when a.location_format is NULL and a.legacy_format_code like "PH" then "Pharmacy"
else a.location_format end as store_format_description
from channels_reporting.vw_channels_locations a
inner join
(select distinct location_id, post_code from location.location
LATERAL VIEW INLINE (array(address)) post_code
where lifecycle_status like "Trading"
) b -- limit is for testing
on a.location_id=b.location_id
where
a.lifecycle_status like "Trading"
and a.country_code like "GB";

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!