<?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 Spark Dataset API error in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3543125#M269</link>
    <description>&lt;P&gt;I am getting the following error with dataset API but not with dataframe API in notebook.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;// works
val df= Seq(
    ("Boston", "USA", 0.67),
    ("Dubai", "UAE", 3.1),
    ("Cordoba", "Argentina", 1.39)    
).toDF("city", "country", "population")

df.show()

//does not work
case class City(englishName: String, continent: String)

val cities = Seq(
  City("bejing", "asia"),
  City("new york", "north america"),
  City("paris", "europe")
).toDS()

cities.show()

// does not work
case class City(englishName: String, continent: String)
val cities2 = spark.createDataset(
  Seq(
    City("bejing", "asia"),
    City("new york", "north america"),
    City("paris", "europe")
  )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="smpa01_0-1700508583747.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/999500iB9E81289FB176F38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="smpa01_0-1700508583747.png" alt="smpa01_0-1700508583747.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Nov 2023 19:33:55 GMT</pubDate>
    <dc:creator>smpa01</dc:creator>
    <dc:date>2023-11-20T19:33:55Z</dc:date>
    <item>
      <title>Spark Dataset API error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3543125#M269</link>
      <description>&lt;P&gt;I am getting the following error with dataset API but not with dataframe API in notebook.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;// works
val df= Seq(
    ("Boston", "USA", 0.67),
    ("Dubai", "UAE", 3.1),
    ("Cordoba", "Argentina", 1.39)    
).toDF("city", "country", "population")

df.show()

//does not work
case class City(englishName: String, continent: String)

val cities = Seq(
  City("bejing", "asia"),
  City("new york", "north america"),
  City("paris", "europe")
).toDS()

cities.show()

// does not work
case class City(englishName: String, continent: String)
val cities2 = spark.createDataset(
  Seq(
    City("bejing", "asia"),
    City("new york", "north america"),
    City("paris", "europe")
  )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="smpa01_0-1700508583747.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/999500iB9E81289FB176F38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="smpa01_0-1700508583747.png" alt="smpa01_0-1700508583747.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 19:33:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3543125#M269</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2023-11-20T19:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Spark Dataset API error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3544654#M270</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks for using Fabric Community.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;At this time, we are reaching out to the internal team to get some help on this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We will update you once we hear back from them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 12:12:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3544654#M270</guid>
      <dc:creator>v-cboorla-msft</dc:creator>
      <dc:date>2023-11-21T12:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Spark Dataset API error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3589473#M271</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Apologies for the delay in response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Define case class in a separate jar. Example:&lt;/P&gt;
&lt;P&gt;1) create a jar file from .scala (ensure same scala version while compiling, see Fabric Spark runtimes (&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/runtime" target="_blank" rel="noopener"&gt;Apache Spark runtime in Fabric - Microsoft Fabric | Microsoft Learn&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;package com.example&lt;/P&gt;
&lt;P&gt;case class City(englishName: String, continent: String)&lt;/P&gt;
&lt;P&gt;2) e.g. you can upload the jar from notebook resources (&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/how-to-use-notebook" target="_blank" rel="noopener"&gt;How to use notebooks - Microsoft Fabric | Microsoft Learn&lt;/A&gt;) and then load it:&amp;nbsp;%load_new_custom_jar {mssparkutils.nbResPath}/builtin/City.jar&lt;/P&gt;
&lt;P&gt;3) import: import com.example.City&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps. If you have any further questions please do let us know.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 16:43:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3589473#M271</guid>
      <dc:creator>v-cboorla-msft</dc:creator>
      <dc:date>2023-12-18T16:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Spark Dataset API error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3594422#M272</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/608020"&gt;@v-cboorla-msft&lt;/a&gt;&amp;nbsp; i will try and let you know.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 16:40:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3594422#M272</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2023-12-20T16:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Spark Dataset API error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3601684#M273</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We haven’t heard from you on the last response and was just checking back to see, did you got a chance to look into this?&lt;/P&gt;
&lt;P&gt;In case if you have any resolution please do share that same with the community as it can be helpful to others.&lt;BR /&gt;Otherwise, will respond back with the more details and we will try to help.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 07:16:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3601684#M273</guid>
      <dc:creator>v-cboorla-msft</dc:creator>
      <dc:date>2023-12-26T07:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Spark Dataset API error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3610381#M274</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We haven’t heard from you on the last response and was just checking back to see, did you got a chance to look into this?&lt;/P&gt;
&lt;P&gt;In case if you have any resolution please do share that same with the community as it can be helpful to others.&lt;BR /&gt;If you have any question relating to the current thread, please do let us know and we will try out best to help you.&lt;BR /&gt;In case if you have any other question on a different issue, we request you to open a new thread.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 07:17:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Spark-Dataset-API-error/m-p/3610381#M274</guid>
      <dc:creator>v-cboorla-msft</dc:creator>
      <dc:date>2024-01-02T07:17:05Z</dc:date>
    </item>
  </channel>
</rss>

