<?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 Decimal(32,6) datatype in Databricks - precision roundoff in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/decimal-32-6-datatype-in-databricks-precision-roundoff/m-p/110824#M9067</link>
    <description>&lt;P&gt;Hello All,&lt;BR /&gt;I need your assistance. I recently started a migration project from Synapse Analytics to Databricks. While dealing with the datatypes, I came across a situation where in Dedicated Sql Pool the value is 0.033882,&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;but in DataBricks the value is&lt;STRONG&gt;&amp;nbsp;0.033883&lt;/STRONG&gt;. I am not using any condition, and both use Decimal(32,6) as datatype. This is happening for like 50% of the existing records. My assumption is that the 6th decimal is rounding the value based on the 7th decimal value. Want to know if this Databricks does it by itself or if my assumption is wrong. Your suggestions are really appreciated. Thankyou.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Feb 2025 09:07:39 GMT</pubDate>
    <dc:creator>Boyeenas</dc:creator>
    <dc:date>2025-02-21T09:07:39Z</dc:date>
    <item>
      <title>Decimal(32,6) datatype in Databricks - precision roundoff</title>
      <link>https://community.databricks.com/t5/get-started-discussions/decimal-32-6-datatype-in-databricks-precision-roundoff/m-p/110824#M9067</link>
      <description>&lt;P&gt;Hello All,&lt;BR /&gt;I need your assistance. I recently started a migration project from Synapse Analytics to Databricks. While dealing with the datatypes, I came across a situation where in Dedicated Sql Pool the value is 0.033882,&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;but in DataBricks the value is&lt;STRONG&gt;&amp;nbsp;0.033883&lt;/STRONG&gt;. I am not using any condition, and both use Decimal(32,6) as datatype. This is happening for like 50% of the existing records. My assumption is that the 6th decimal is rounding the value based on the 7th decimal value. Want to know if this Databricks does it by itself or if my assumption is wrong. Your suggestions are really appreciated. Thankyou.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 09:07:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/decimal-32-6-datatype-in-databricks-precision-roundoff/m-p/110824#M9067</guid>
      <dc:creator>Boyeenas</dc:creator>
      <dc:date>2025-02-21T09:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal(32,6) datatype in Databricks - precision roundoff</title>
      <link>https://community.databricks.com/t5/get-started-discussions/decimal-32-6-datatype-in-databricks-precision-roundoff/m-p/111079#M9068</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/150197"&gt;@Boyeenas&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I believe your assumption is correct.&amp;nbsp;&lt;SPAN&gt;Databricks is built on Apache Spark and the system applies rounding automatically based on the value of the subsequent digit. In your case, if the original value had a 7th decimal digit of 5 or higher, Spark’s default half-up rounding will round the 6th decimal place up resulting in 0.033883 instead of 0.033882.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;From this documentation&amp;nbsp;&lt;A href="https://spark.apache.org/docs/3.5.3/sql-ref-datatypes.html" target="_self"&gt;https://spark.apache.org/docs/3.5.3/sql-ref-datatypes.html&lt;/A&gt;&amp;nbsp;,&amp;nbsp;Spark’s DecimalType is based on Java’s BigDecimal.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Additional References:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://spark.apache.org/docs/3.5.1/api/java/org/apache/spark/sql/types/DecimalType.html" target="_blank"&gt;https://spark.apache.org/docs/3.5.1/api/java/org/apache/spark/sql/types/DecimalType.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2025 19:51:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/decimal-32-6-datatype-in-databricks-precision-roundoff/m-p/111079#M9068</guid>
      <dc:creator>KaranamS</dc:creator>
      <dc:date>2025-02-24T19:51:54Z</dc:date>
    </item>
  </channel>
</rss>

