<?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 Re: I am looking to use the pivot function with Spark SQL (not Python) in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24256#M16856</link>
    <description>&lt;P&gt;Thanks Hubert. I did that and it worked. I still want to get 'Pivot' to work as well. &lt;/P&gt;</description>
    <pubDate>Thu, 31 Mar 2022 12:50:36 GMT</pubDate>
    <dc:creator>nickg</dc:creator>
    <dc:date>2022-03-31T12:50:36Z</dc:date>
    <item>
      <title>I am looking to use the pivot function with Spark SQL (not Python)</title>
      <link>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24251#M16851</link>
      <description>&lt;P&gt;Hello. I am trying to using the Pivot function for email addresses. This is what I have so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select fname, lname, awUniqueID, Email1, Email2&lt;/P&gt;&lt;P&gt;From xxxxxxxx&lt;/P&gt;&lt;P&gt;Pivot (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;count(Email) as Test&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;For Email&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;In (1 as Email1, 2 as Email2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get everything I need except Email1 and Email2 have null values instead of actual email addresses. I just need a little push to get me over the edge. Thanks. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 18:16:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24251#M16851</guid>
      <dc:creator>nickg</dc:creator>
      <dc:date>2022-03-30T18:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: I am looking to use the pivot function with Spark SQL (not Python)</title>
      <link>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24252#M16852</link>
      <description>&lt;P&gt;Please add example source data and desired output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;"For Email" should be a list of columns to replace. In the source, we have Email1, Email2, so instead, it can be FOR (email1, email2)&lt;/LI&gt;&lt;LI&gt;count the same probably needed is count(awUniqueID)&lt;/LI&gt;&lt;LI&gt;Is 1 and 2 values in Email1 and Email2? If not, another solution is necessary, but it is hard to help without an example&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 18:38:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24252#M16852</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-03-30T18:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: I am looking to use the pivot function with Spark SQL (not Python)</title>
      <link>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24253#M16853</link>
      <description>&lt;P&gt;source data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fname	lname	awUniqueID	                 Email&lt;/P&gt;&lt;P&gt;John	Smith	      22	                            jsmith@gmail.com&lt;/P&gt;&lt;P&gt;JODI	JONES	       22	                            jsmith@live.com&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Desired output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fname    lname         awUniqueID               Email1                                         Email2&lt;/P&gt;&lt;P&gt;John        Smith                 22                     jsmith@gmail.com                jsmith@live.com&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 18:46:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24253#M16853</guid>
      <dc:creator>nickg</dc:creator>
      <dc:date>2022-03-30T18:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: I am looking to use the pivot function with Spark SQL (not Python)</title>
      <link>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24254#M16854</link>
      <description>&lt;P&gt;Oops. The second name in the source data should be John Smith as well. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 18:47:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24254#M16854</guid>
      <dc:creator>nickg</dc:creator>
      <dc:date>2022-03-30T18:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: I am looking to use the pivot function with Spark SQL (not Python)</title>
      <link>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24255#M16855</link>
      <description>&lt;P&gt;Just create a copy of dataframe (or temporary view) rename the Email column to Email2 and than join on with source awUniqueID.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 19:18:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24255#M16855</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-03-30T19:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: I am looking to use the pivot function with Spark SQL (not Python)</title>
      <link>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24256#M16856</link>
      <description>&lt;P&gt;Thanks Hubert. I did that and it worked. I still want to get 'Pivot' to work as well. &lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 12:50:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24256#M16856</guid>
      <dc:creator>nickg</dc:creator>
      <dc:date>2022-03-31T12:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: I am looking to use the pivot function with Spark SQL (not Python)</title>
      <link>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24258#M16858</link>
      <description>&lt;P&gt;Hi Kaniz,&lt;/P&gt;&lt;P&gt;Thanks for your message. I was able to make it work with the workaround that Hubert provided. I would eventually like to make it work with the 'Pivot' command. I have not revisited it and tested the 'Pivot' command as I was on vacation for a couple of weeks. &lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 16:48:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-am-looking-to-use-the-pivot-function-with-spark-sql-not-python/m-p/24258#M16858</guid>
      <dc:creator>nickg</dc:creator>
      <dc:date>2022-04-26T16:48:15Z</dc:date>
    </item>
  </channel>
</rss>

