Hive SQL is giving extraneous input ',' expecting ')' error

My Hive SQL code is as follows:

 FROM ( SELECT *, CONCAT_WS('__', ) AS no_hash_join_key FROM xyz.e_6445 WHERE p_m_id = '{MARKET_ID}' AND p_date = '{RUN_DATE_YYYY-MM-DD}' ) dataforge 

I am getting the following error:

 extraneous input ',' expecting ')' 

I am failing to understand what is causing the error. I tried changing it to the following:

SELECT *, CONCAT_WS('__', ' ' ) 

This removes the given error but results in a different error :

 INSERT_SQL_COLUMN_MISMATCH 

What am I doing wrong? Any help would be appreciated.

1

2 Answers

You have a blank parameter in concat_ws. Get rid of the comma (or pass another parameter)

I don't have Hive on-hand, but some databases require aliases when using * with other columns. In addition, you need a second argument in CONCAT_WS().

Does this work?

SELECT e.*, CONCAT_WS('__', NULL) AS no_hash_join_key FROM xyz.e_6445 e WHERE e.p_m_id = '{MARKET_ID}' AND e.p_date = '{RUN_DATE_YYYY-MM-DD}' 
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like