I am running a process on Spark which uses SQL for the most part. In one of the workflows I am getting the following error:
mismatched input 'from' expecting
The code is
select a.ACCOUNT_IDENTIFIER,a.LAN_CD, a.BEST_CARD_NUMBER,
decision_id,
case when a.BEST_CARD_NUMBER = 1 then 'Y' else 'N' end as best_card_excl_flag
from (select a.ACCOUNT_IDENTIFIER,a.LAN_CD, a. decision_id row_number()
over (partition by CUST_GRP_MBRP_ID
order by coalesce(BEST_CARD_RANK,999)) as BEST_CARD_NUMBER
from Accounts_Inclusions_Exclusions_Flagged a) a
I cannot figure out what the error is for the life of me
I've tried checking for comma errors or unexpected brackets but that doesn't seem to be the issue.
EOF stands for "end of file," and this syntax error occurs when Python detects an unfinished statement or block of code. This can happen for many reasons, but the most likely cause is missing punctuation or an incorrectly indented block.
Spark SQL is a Spark module for structured data processing. It provides a programming abstraction called DataFrames and can also act as a distributed SQL query engine. It enables unmodified Hadoop Hive queries to run up to 100x faster on existing deployments and data.
In the 4th line of you code, you just need to add a comma after a.decision_id, since row_number() over is a separate column/function.
P.S.: Try yo use indentation in nested select statements so you and your peers can understand the code easily. Cheers!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With