<?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>topic Issue withpassing parameters to the queries in spark sql temporary function in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/issue-withpassing-parameters-to-the-queries-in-spark-sql/m-p/6313#M2495</link>
    <description>&lt;P&gt;I have created a function like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create function test(location STRING, designation STRING, name STRING)&lt;/P&gt;&lt;P&gt;RETURNS TABLE (cnt INT)&lt;/P&gt;&lt;P&gt;RETURN(&lt;/P&gt;&lt;P&gt;SELECT &lt;/P&gt;&lt;P&gt;CASE WHEN location = 'INDIA' THEN &lt;/P&gt;&lt;P&gt;              (SELECT COUNT(*) FROM tbl_customers where job_role = designation)&lt;/P&gt;&lt;P&gt;ELSE (SELECT COUNT(*) FROM tbl_customers where job_role = designation AND c_name = name)&lt;/P&gt;&lt;P&gt;END as cnt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I'm trying to run this function in adb notebook, I'm getting the error like:- &lt;B&gt;Column designation does not exist. Did you mean one of the following?&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Can anyone plz suggest me how to get rid of this error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Apr 2023 12:26:04 GMT</pubDate>
    <dc:creator>Raghu1216</dc:creator>
    <dc:date>2023-04-06T12:26:04Z</dc:date>
    <item>
      <title>Issue withpassing parameters to the queries in spark sql temporary function</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-withpassing-parameters-to-the-queries-in-spark-sql/m-p/6313#M2495</link>
      <description>&lt;P&gt;I have created a function like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create function test(location STRING, designation STRING, name STRING)&lt;/P&gt;&lt;P&gt;RETURNS TABLE (cnt INT)&lt;/P&gt;&lt;P&gt;RETURN(&lt;/P&gt;&lt;P&gt;SELECT &lt;/P&gt;&lt;P&gt;CASE WHEN location = 'INDIA' THEN &lt;/P&gt;&lt;P&gt;              (SELECT COUNT(*) FROM tbl_customers where job_role = designation)&lt;/P&gt;&lt;P&gt;ELSE (SELECT COUNT(*) FROM tbl_customers where job_role = designation AND c_name = name)&lt;/P&gt;&lt;P&gt;END as cnt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I'm trying to run this function in adb notebook, I'm getting the error like:- &lt;B&gt;Column designation does not exist. Did you mean one of the following?&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Can anyone plz suggest me how to get rid of this error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 12:26:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-withpassing-parameters-to-the-queries-in-spark-sql/m-p/6313#M2495</guid>
      <dc:creator>Raghu1216</dc:creator>
      <dc:date>2023-04-06T12:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Issue withpassing parameters to the queries in spark sql temporary function</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-withpassing-parameters-to-the-queries-in-spark-sql/m-p/6314#M2496</link>
      <description>&lt;P&gt;@Raghu Dandu​&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try using your function name as an alias for the column, &lt;/P&gt;&lt;P&gt;ex. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;job_role = test.designation&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2023 05:09:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-withpassing-parameters-to-the-queries-in-spark-sql/m-p/6314#M2496</guid>
      <dc:creator>daniel_sahal</dc:creator>
      <dc:date>2023-04-07T05:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Issue withpassing parameters to the queries in spark sql temporary function</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-withpassing-parameters-to-the-queries-in-spark-sql/m-p/6315#M2497</link>
      <description>&lt;P&gt;@Daniel Sahal​&amp;nbsp; That one also tried Daniel, getting the same error&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2023 11:27:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-withpassing-parameters-to-the-queries-in-spark-sql/m-p/6315#M2497</guid>
      <dc:creator>Raghu1216</dc:creator>
      <dc:date>2023-04-07T11:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Issue withpassing parameters to the queries in spark sql temporary function</title>
      <link>https://community.databricks.com/t5/data-engineering/issue-withpassing-parameters-to-the-queries-in-spark-sql/m-p/6316#M2498</link>
      <description>&lt;P&gt;@Raghu Dandu​&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error message suggests that the column "designation" does not exist in the table "tbl_customers". There could be several reasons for this error, such as a typo in the column name, a missing or deleted column, or a difference in the table schema.&lt;/P&gt;&lt;P&gt;To resolve this error, you should check the schema of the "tbl_customers" table and make sure that the column "designation" exists in the table. You can also try to qualify the column name with the table name or alias to avoid any ambiguity in the column name, like "tbl_customers.job_role" instead of just "job_role".&lt;/P&gt;&lt;P&gt;If the column "designation" is missing or renamed, you may need to modify your function accordingly or update the table schema.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 10:03:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/issue-withpassing-parameters-to-the-queries-in-spark-sql/m-p/6316#M2498</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-18T10:03:34Z</dc:date>
    </item>
  </channel>
</rss>

