Question: I am using sparksql. Below is a sample query, which keeps running for long because of huge volume of data. I want to add user

I am using sparksql. Below is a sample query, which keeps running for long because of huge volume of data. I want to add user prompt for the query instead of hardcoding. Query should run for the value entered by user for these two prompts- AL1.oha_serial_number='122345'
AL1.order_number='A123'
How can I add prompts for these two.
SELECT
(Trim(AL1.mtype)|| Trim(AL1.order_number)) as ord_nbr,
AL1.m_type as Mod_Typ,
AL4.serial_num as Func_Ser_Nbr,
AL4.part_number,
AL5.accum_quantity as TSN,
AL6.accum_quantity as CSN,
AL9.accum_quantity as TSDPI,
FROM
ems_module_serial_history AL1
JOIN module_description AL3 ON trim(AL1.m_type)= trim(AL3.m_type) AND trim(AL1.eng_type)= trim(AL3.eng_type)
JOIN Eng_description AL8 ON trim(AL1.e_type)= trim(AL8.e_type)
JOIN function_description AL2 ON trim(AL1.e_type)= trim(AL2.bom_e_type) AND trim(AL1.m_type)= trim(AL2.bom_m_type)
WHERE
(
trim(AL1.e_type)='A'
AND Trim(AL1.oha_serial_number)='122345'
AND trim(AL1.order_number)='A123'
AND (
LEFT(trim(AL1.eff_end_dtml),4)>'2010'
)
)

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 Programming Questions!