<?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: Different error handling behavior after DB runtime upgrade from 13.3 to 14.3 in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/different-error-handling-behavior-after-db-runtime-upgrade-from/m-p/72042#M34476</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/103397"&gt;@Karlo_Kotarac&lt;/a&gt;&amp;nbsp;Where do you see this error:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yeshwanth_0-1717767536048.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/8138i0CB86D1583A60D23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yeshwanth_0-1717767536048.png" alt="Yeshwanth_0-1717767536048.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2024 13:39:09 GMT</pubDate>
    <dc:creator>Yeshwanth</dc:creator>
    <dc:date>2024-06-07T13:39:09Z</dc:date>
    <item>
      <title>Different error handling behavior after DB runtime upgrade from 13.3 to 14.3</title>
      <link>https://community.databricks.com/t5/data-engineering/different-error-handling-behavior-after-db-runtime-upgrade-from/m-p/71994#M34458</link>
      <description>&lt;P&gt;Hi! We want to upgrade the DB runtime on our clusters from 13.3 LTS to 14.3 LTS. Currently, everything looks good except for the different error-handling in the new runtime.&lt;/P&gt;&lt;P&gt;For example, the error in the 13.3 LTS runtime looks familiar:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Karlo_Kotarac_0-1717743717317.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/8131i2E69B4D3F3F86E3D/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Karlo_Kotarac_0-1717743717317.png" alt="Karlo_Kotarac_0-1717743717317.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;while the same code on 14.3 LTS runtime throws the following error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Karlo_Kotarac_1-1717743788282.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/8132i7168E4EA77253AC3/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Karlo_Kotarac_1-1717743788282.png" alt="Karlo_Kotarac_1-1717743788282.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Only after digging deeper into error logs, can I see that the error is the same in this case:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Karlo_Kotarac_3-1717743912995.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/8134i374BF4CCD260DFC4/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Karlo_Kotarac_3-1717743912995.png" alt="Karlo_Kotarac_3-1717743912995.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Not sure if it is important information but we use the spark.sql() function when calling merge into command. Is there a way to restore the previous error-handling behaviour because current errors are not informative?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 07:10:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/different-error-handling-behavior-after-db-runtime-upgrade-from/m-p/71994#M34458</guid>
      <dc:creator>Karlo_Kotarac</dc:creator>
      <dc:date>2024-06-07T07:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Different error handling behavior after DB runtime upgrade from 13.3 to 14.3</title>
      <link>https://community.databricks.com/t5/data-engineering/different-error-handling-behavior-after-db-runtime-upgrade-from/m-p/72042#M34476</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/103397"&gt;@Karlo_Kotarac&lt;/a&gt;&amp;nbsp;Where do you see this error:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yeshwanth_0-1717767536048.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/8138i0CB86D1583A60D23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yeshwanth_0-1717767536048.png" alt="Yeshwanth_0-1717767536048.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 13:39:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/different-error-handling-behavior-after-db-runtime-upgrade-from/m-p/72042#M34476</guid>
      <dc:creator>Yeshwanth</dc:creator>
      <dc:date>2024-06-07T13:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Different error handling behavior after DB runtime upgrade from 13.3 to 14.3</title>
      <link>https://community.databricks.com/t5/data-engineering/different-error-handling-behavior-after-db-runtime-upgrade-from/m-p/72051#M34480</link>
      <description>&lt;P&gt;In the notebook where this error happened below the merge statement after expanding the error message&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Karlo_Kotarac_0-1717768751056.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/8140i2E0C5FCE1E57DFBE/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Karlo_Kotarac_0-1717768751056.png" alt="Karlo_Kotarac_0-1717768751056.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The complete error is then the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TypeError: AutoFormattedTB.structured_traceback() missing 1 required positional argument: 'evalue'
    [... skipping hidden 1 frame]
File &amp;lt;command-77793784558808&amp;gt;, line 1
----&amp;gt; 1 merge_sql_v2(
      2   target_table = "silver.test",
      3   update_table = "updates_id",
      4   keycolumns = "id",
      5   history = False,
      6   dryrun = False
      7 )
File &amp;lt;command-77793784557616&amp;gt;, line 134, in merge_sql_v2(target_table, update_table, keycolumns, history, dryrun)
    133 if dryrun == False:
--&amp;gt; 134   spark.sql(mergesql).display()
    135   spark.sql(deletesql).display()
File /databricks/spark/python/pyspark/instrumentation_utils.py:47, in _wrap_function.&amp;lt;locals&amp;gt;.wrapper(*args, **kwargs)
     46 try:
---&amp;gt; 47     res = func(*args, **kwargs)
     48     logger.log_success(
     49         module_name, class_name, function_name, time.perf_counter() - start, signature
     50     )
File /databricks/spark/python/pyspark/sql/session.py:1748, in SparkSession.sql(self, sqlQuery, args, **kwargs)
   1745         litArgs = self._jvm.PythonUtils.toArray(
   1746             [_to_java_column(lit(v)) for v in (args or [])]
   1747         )
-&amp;gt; 1748     return DataFrame(self._jsparkSession.sql(sqlQuery, litArgs), self)
   1749 finally:
File /databricks/spark/python/lib/py4j-0.10.9.7-src.zip/py4j/java_gateway.py:1355, in JavaMember.__call__(self, *args)
   1354 answer = self.gateway_client.send_command(command)
-&amp;gt; 1355 return_value = get_return_value(
   1356     answer, self.gateway_client, self.target_id, self.name)
   1358 for temp_arg in temp_args:
File /databricks/spark/python/pyspark/errors/exceptions/captured.py:230, in capture_sql_exception.&amp;lt;locals&amp;gt;.deco(*a, **kw)
    227 if not isinstance(converted, UnknownException):
    228     # Hide where the exception came from that shows a non-Pythonic
    229     # JVM exception message.
--&amp;gt; 230     raise converted from None
    231 else:
UnsupportedOperationException: [DELTA_MULTIPLE_SOURCE_ROW_MATCHING_TARGET_ROW_IN_MERGE] Cannot perform Merge as multiple source rows matched and attempted to modify the same
target row in the Delta table in possibly conflicting ways. By SQL semantics of Merge,
when multiple source rows match on the same target row, the result may be ambiguous
as it is unclear which source row should be used to update or delete the matching
target row. You can preprocess the source table to eliminate the possibility of
multiple matches. Please refer to
https://docs.microsoft.com/azure/databricks/delta/merge#merge-error

During handling of the above exception, another exception occurred:
Py4JError                                 Traceback (most recent call last)
File /databricks/python/lib/python3.10/site-packages/IPython/core/interactiveshell.py:1975, in InteractiveShell.set_custom_exc.&amp;lt;locals&amp;gt;.wrapped(self, etype, value, tb, tb_offset)
   1974 try:
-&amp;gt; 1975     stb = handler(self,etype,value,tb,tb_offset=tb_offset)
   1976     return validate_stb(stb)
File /databricks/python_shell/dbruntime/ExceptionHandler.py:26, in custom_exception_handler(shell, etype, exception, tb, tb_offset)
     21 data = {
     22     'errorClass': exception.getErrorClass(),
     23     'messageParameters': exception.getMessageParameters(),
     24     'sqlState': exception.getSqlState(),
     25 }
---&amp;gt; 26 query_contexts = exception.getQueryContext()
     27 if len(query_contexts) != 0:
File /databricks/spark/python/pyspark/errors/exceptions/captured.py:150, in CapturedException.getQueryContext(self)
    147 if self._origin is not None and is_instance_of(
    148     gw, self._origin, "org.apache.spark.SparkThrowable"
    149 ):
--&amp;gt; 150     return [QueryContext(q) for q in self._origin.getQueryContext()]
    151 else:
File /databricks/spark/python/lib/py4j-0.10.9.7-src.zip/py4j/java_gateway.py:1355, in JavaMember.__call__(self, *args)
   1354 answer = self.gateway_client.send_command(command)
-&amp;gt; 1355 return_value = get_return_value(
   1356     answer, self.gateway_client, self.target_id, self.name)
   1358 for temp_arg in temp_args:
File /databricks/spark/python/pyspark/errors/exceptions/captured.py:224, in capture_sql_exception.&amp;lt;locals&amp;gt;.deco(*a, **kw)
    223 try:
--&amp;gt; 224     return f(*a, **kw)
    225 except Py4JJavaError as e:
File /databricks/spark/python/lib/py4j-0.10.9.7-src.zip/py4j/protocol.py:330, in get_return_value(answer, gateway_client, target_id, name)
    329     else:
--&amp;gt; 330         raise Py4JError(
    331             "An error occurred while calling {0}{1}{2}. Trace:\n{3}\n".
    332             format(target_id, ".", name, value))
    333 else:
Py4JError: An error occurred while calling o514.getQueryContext. Trace:
py4j.Py4JException: Method getQueryContext([]) does not exist
	at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:344)
	at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:352)
	at py4j.Gateway.invoke(Gateway.java:297)
	at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
	at py4j.commands.CallCommand.execute(CallCommand.java:79)
	at py4j.ClientServerConnection.waitForCommands(ClientServerConnection.java:199)
	at py4j.ClientServerConnection.run(ClientServerConnection.java:119)
	at java.lang.Thread.run(Thread.java:750)


During handling of the above exception, another exception occurred:
TypeError                                 Traceback (most recent call last)
    [... skipping hidden 1 frame]
File /databricks/python/lib/python3.10/site-packages/IPython/core/interactiveshell.py:1985, in InteractiveShell.set_custom_exc.&amp;lt;locals&amp;gt;.wrapped(self, etype, value, tb, tb_offset)
   1983     print(self.InteractiveTB.stb2text(stb))
   1984     print("The original exception:")
-&amp;gt; 1985     stb = self.InteractiveTB.structured_traceback(
   1986                             (etype,value,tb), tb_offset=tb_offset
   1987     )
   1988 return stb&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 14:03:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/different-error-handling-behavior-after-db-runtime-upgrade-from/m-p/72051#M34480</guid>
      <dc:creator>Karlo_Kotarac</dc:creator>
      <dc:date>2024-06-07T14:03:21Z</dc:date>
    </item>
  </channel>
</rss>

