Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Error while executing CTE query: Argument type mismatch

avatar
Explorer

I am facing an error while trying to write a CTE query in hive. Even though a column is defined with "Date", system is takin the input as "string".

 

My query:
WITH i_part AS
(select i_part, CONCAT(i_suplr,i_suplr_loc_suff),
case when q_rel_suplr_shp_2<>0 then d_rel_suplr_2
case ........................................ then .... //* case and then clauses
case ........................................ then ....
.
.
.
else '9999-12-31' end as d_rel_issd
from pchiers where l_kdo='N' and q_rel_suplr_shp_1 <> 0 and l_rel_curr='Y'
and i_recvg_loc NOT IN ('04199','01299'))
select * from i_part group by i_part; 
 
Error
 

 
NOTE : data type of "d_rel_issd" in question, it is defined as "Date" datatype.
 
1 ACCEPTED SOLUTION

avatar
Rising Star

@Saransh

Could you please re-upload the error screenshot? I cannot open it in your post.

 

I am also confused by your question. You mentioned that column d_rel_issd is defined as Date type, but what I can see here is that this column is just an alias of the case expression. The else clause of your case expression returns a string value. Could you please try to cast it to data and see whether it helps?

 

cast('9999-12-31' as date)

 

View solution in original post

2 REPLIES 2

avatar
Rising Star

@Saransh

Could you please re-upload the error screenshot? I cannot open it in your post.

 

I am also confused by your question. You mentioned that column d_rel_issd is defined as Date type, but what I can see here is that this column is just an alias of the case expression. The else clause of your case expression returns a string value. Could you please try to cast it to data and see whether it helps?

 

cast('9999-12-31' as date)

 

avatar
Explorer

Thnx @yshi . Your solution worked 🙂