<?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 NullpointerException when creating a notebook widget in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/nullpointerexception-when-creating-a-notebook-widget/m-p/96231#M39241</link>
    <description>&lt;P class="lia-align-left"&gt;To reproduce, execute this line in a notebook (runtime 15.3):&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;dbutils.widgets.&lt;/SPAN&gt;&lt;SPAN&gt;multiselect&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"foo"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;None&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN&gt;None&lt;/SPAN&gt;&lt;SPAN&gt;])&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P class="lia-align-left"&gt;&lt;SPAN&gt;Exception raised:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Py4JJavaError: &lt;/SPAN&gt;An error occurred while calling o427.createMultiselectWidget. : java.lang.NullPointerException at com.databricks.backend.daemon.driver.NotebookArguments.trimDefaultValue(NotebookArguments.scala:88)&lt;/SPAN&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 26 Oct 2024 10:32:12 GMT</pubDate>
    <dc:creator>sebasv</dc:creator>
    <dc:date>2024-10-26T10:32:12Z</dc:date>
    <item>
      <title>NullpointerException when creating a notebook widget</title>
      <link>https://community.databricks.com/t5/data-engineering/nullpointerexception-when-creating-a-notebook-widget/m-p/96231#M39241</link>
      <description>&lt;P class="lia-align-left"&gt;To reproduce, execute this line in a notebook (runtime 15.3):&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;dbutils.widgets.&lt;/SPAN&gt;&lt;SPAN&gt;multiselect&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"foo"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;None&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN&gt;None&lt;/SPAN&gt;&lt;SPAN&gt;])&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P class="lia-align-left"&gt;&lt;SPAN&gt;Exception raised:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Py4JJavaError: &lt;/SPAN&gt;An error occurred while calling o427.createMultiselectWidget. : java.lang.NullPointerException at com.databricks.backend.daemon.driver.NotebookArguments.trimDefaultValue(NotebookArguments.scala:88)&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 26 Oct 2024 10:32:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/nullpointerexception-when-creating-a-notebook-widget/m-p/96231#M39241</guid>
      <dc:creator>sebasv</dc:creator>
      <dc:date>2024-10-26T10:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: NullpointerException when creating a notebook widget</title>
      <link>https://community.databricks.com/t5/data-engineering/nullpointerexception-when-creating-a-notebook-widget/m-p/96234#M39242</link>
      <description>&lt;P&gt;The error you're encountering is due to trying to use None (or null in Java) as an option in the widget's default values or list of values, which dbutils.widgets.multiselect does not handle properly. The None type in Python is converted to null in Scala/Java (underlying languages in Spark), and this is causing a NullPointerException.&lt;/P&gt;&lt;P&gt;To fix this, you can provide a default value that is a non-null string instead of None. Here’s an example modification:&lt;/P&gt;&lt;P&gt;python&lt;BR /&gt;dbutils.widgets.multiselect("foo", "", ["Option1", "Option2"])&lt;BR /&gt;Alternatively, if you need the default to be unselected, you can set it to an empty list:&lt;/P&gt;&lt;P&gt;python&lt;BR /&gt;dbutils.widgets.multiselect("foo", "", ["Option1", "Option2"])&lt;BR /&gt;In this example, replacing None with actual strings will avoid triggering the NullPointerException. Let me know if this resolves the issue or if you need further assistance!&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2024 12:00:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/nullpointerexception-when-creating-a-notebook-widget/m-p/96234#M39242</guid>
      <dc:creator>esther598</dc:creator>
      <dc:date>2024-10-26T12:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: NullpointerException when creating a notebook widget</title>
      <link>https://community.databricks.com/t5/data-engineering/nullpointerexception-when-creating-a-notebook-widget/m-p/96242#M39245</link>
      <description>&lt;P&gt;Hi - pls see below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SathyaSDE_0-1729948623973.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/12313i30BC97469778702F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SathyaSDE_0-1729948623973.png" alt="SathyaSDE_0-1729948623973.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I hope it helps !!&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2024 13:17:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/nullpointerexception-when-creating-a-notebook-widget/m-p/96242#M39245</guid>
      <dc:creator>SathyaSDE</dc:creator>
      <dc:date>2024-10-26T13:17:35Z</dc:date>
    </item>
  </channel>
</rss>

