<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Error while executing CTE query: Argument type mismatch in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-while-executing-CTE-query-Argument-type-mismatch/m-p/47941#M47137</link>
    <description>&lt;P&gt;&lt;SPAN&gt;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".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;U&gt;My query:&lt;/U&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;WITH i_part AS &lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;(select i_part, CONCAT(i_suplr,i_suplr_loc_suff),&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;case when q_rel_suplr_shp_2&amp;lt;&amp;gt;0&amp;nbsp;&lt;SPAN&gt;then d_rel_suplr_2 &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;case ........................................ then .... //* case and then clauses&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;case ........................................ then ....&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;else '9999-12-31' end as d_rel_issd &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;from pchiers &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;where l_kdo='N' and q_rel_suplr_shp_1 &amp;lt;&amp;gt; 0 and l_rel_curr='Y' &lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;and i_recvg_loc NOT IN ('04199','01299')) &lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;select * from i_part group by i_part;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;U&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Error&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;U&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="4"&gt;&lt;IMG src="https://ip1.i.lithium.com/1f7a370821e150bf688b35b36c593204e10462d6/68747470733a2f2f656d61696c312e65787472612e66636167726f75702e636f6d2f6f77612f736572766963652e7376632f732f47657446696c654174746163686d656e743f69643d41414d6b4144686b4e546733597a55784c574d344e6a45744e4756694e6931694e4455774c575a6b5a6a41304d6d4e6c596d45794f51424741414141414142316b3878314f396547514c4a79644b4c55514b434c42774167596e5634423543385449437a39465048316e6664414141414141454a41414167596e5634423543385449437a39465048316e6664414142583972364a4141414245674151414273794c7250724173314f687857677864376155454125334426582d4f57412d43414e4152593d6e313741516237444145534c4158686d59664a786d375f6e73347874464e51494270325663566748546a6a6333545979544c53682d5f46426c514f6548714d415855352d705f7447426f4d2e" border="0" /&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;U&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;U&gt;&amp;nbsp;&lt;/U&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;NOTE :&amp;nbsp;&lt;/STRONG&gt;data type of "d_rel_issd" in question, it is defined as "Date" datatype.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Fri, 16 Sep 2022 10:49:26 GMT</pubDate>
    <dc:creator>Saransh</dc:creator>
    <dc:date>2022-09-16T10:49:26Z</dc:date>
    <item>
      <title>Error while executing CTE query: Argument type mismatch</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-while-executing-CTE-query-Argument-type-mismatch/m-p/47941#M47137</link>
      <description>&lt;P&gt;&lt;SPAN&gt;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".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;U&gt;My query:&lt;/U&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;WITH i_part AS &lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;(select i_part, CONCAT(i_suplr,i_suplr_loc_suff),&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;case when q_rel_suplr_shp_2&amp;lt;&amp;gt;0&amp;nbsp;&lt;SPAN&gt;then d_rel_suplr_2 &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;case ........................................ then .... //* case and then clauses&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;case ........................................ then ....&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;else '9999-12-31' end as d_rel_issd &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;from pchiers &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;where l_kdo='N' and q_rel_suplr_shp_1 &amp;lt;&amp;gt; 0 and l_rel_curr='Y' &lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;and i_recvg_loc NOT IN ('04199','01299')) &lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;select * from i_part group by i_part;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;U&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Error&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;U&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/U&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="4"&gt;&lt;IMG src="https://ip1.i.lithium.com/1f7a370821e150bf688b35b36c593204e10462d6/68747470733a2f2f656d61696c312e65787472612e66636167726f75702e636f6d2f6f77612f736572766963652e7376632f732f47657446696c654174746163686d656e743f69643d41414d6b4144686b4e546733597a55784c574d344e6a45744e4756694e6931694e4455774c575a6b5a6a41304d6d4e6c596d45794f51424741414141414142316b3878314f396547514c4a79644b4c55514b434c42774167596e5634423543385449437a39465048316e6664414141414141454a41414167596e5634423543385449437a39465048316e6664414142583972364a4141414245674151414273794c7250724173314f687857677864376155454125334426582d4f57412d43414e4152593d6e313741516237444145534c4158686d59664a786d375f6e73347874464e51494270325663566748546a6a6333545979544c53682d5f46426c514f6548714d415855352d705f7447426f4d2e" border="0" /&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;U&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;U&gt;&amp;nbsp;&lt;/U&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;NOTE :&amp;nbsp;&lt;/STRONG&gt;data type of "d_rel_issd" in question, it is defined as "Date" datatype.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:49:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-while-executing-CTE-query-Argument-type-mismatch/m-p/47941#M47137</guid>
      <dc:creator>Saransh</dc:creator>
      <dc:date>2022-09-16T10:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Error while executing CTE query: Argument type mismatch</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-while-executing-CTE-query-Argument-type-mismatch/m-p/48257#M47138</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/19746"&gt;@Saransh&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Could you please re-upload the error screenshot? I cannot open it in your post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am also confused by your question. You mentioned that column&amp;nbsp;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;cast('9999-12-31' as date)&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 23:41:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-while-executing-CTE-query-Argument-type-mismatch/m-p/48257#M47138</guid>
      <dc:creator>yshi</dc:creator>
      <dc:date>2016-12-01T23:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error while executing CTE query: Argument type mismatch</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-while-executing-CTE-query-Argument-type-mismatch/m-p/48269#M47139</link>
      <description>&lt;P&gt;Thnx&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/6888"&gt;@yshi&lt;/a&gt;&amp;nbsp;. Your solution worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 07:53:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Error-while-executing-CTE-query-Argument-type-mismatch/m-p/48269#M47139</guid>
      <dc:creator>Saransh</dc:creator>
      <dc:date>2016-12-02T07:53:55Z</dc:date>
    </item>
  </channel>
</rss>

