Question: convert below SQL into spark code 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
convert below SQL into spark code 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
"
;
Not the question you are looking for? Ask here!
Enter question by text
Enter question by image
Unlock Smarter Learning with AskSia Super!
Join Super, our all-in-one AI solution that can greatly improve your learning efficiency.