<?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: Decimal Precision Loss While Reading Parquet Files in Databricks in Databricks Free Edition Help</title>
    <link>https://community.databricks.com/t5/databricks-free-edition-help/decimal-precision-loss-while-reading-parquet-files-in-databricks/m-p/154703#M751</link>
    <description>&lt;P&gt;Thank for your response.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Apr 2026 05:38:22 GMT</pubDate>
    <dc:creator>SantiNath_Dey</dc:creator>
    <dc:date>2026-04-16T05:38:22Z</dc:date>
    <item>
      <title>Decimal Precision Loss While Reading Parquet Files in Databricks</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/decimal-precision-loss-while-reading-parquet-files-in-databricks/m-p/154067#M747</link>
      <description>&lt;P&gt;We are extracting data from SQL Server/Oracle using ADF and storing it in Parquet format. When reading the files in Databricks using spark.read.parquet, decimal values are getting truncated—for example, 1245.1111111189979 becomes 1245.111111118. This results in a loss of precision. Thanks in Advance.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2026 11:48:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/decimal-precision-loss-while-reading-parquet-files-in-databricks/m-p/154067#M747</guid>
      <dc:creator>SantiNath_Dey</dc:creator>
      <dc:date>2026-04-10T11:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal Precision Loss While Reading Parquet Files in Databricks</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/decimal-precision-loss-while-reading-parquet-files-in-databricks/m-p/154143#M748</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/219024"&gt;@SantiNath_Dey&lt;/a&gt;,&lt;/P&gt;
&lt;P data-pm-slice="1 1 []"&gt;When ADF writes the Parquet, it truncates (or rounds) to that scale. Databricks just reads whatever is stored. There is no way for spark.read.parquet to recreate the lost digits.This behaviour is almost certainly coming from how ADF writes the Parquet, not from spark.read.parquet truncating values.&lt;/P&gt;
&lt;P&gt;Parquet stores decimals as DECIMAL(precision, scale) with a fixed number of digits after the decimal point. If your source value is 1245.1111111189979 but the Parquet column is, for example, DECIMAL(38, 12), then ADF will truncate/round to 12 fractional digits and physically write 1245.111111118 into the file. When Databricks reads that file, it just returns what’s stored; there’s no way for Spark to “recover” the discarded digits.&lt;/P&gt;
&lt;P class="wnfdnte"&gt;You can confirm this in Databricks:&lt;/P&gt;
&lt;PRE class="_1ibi0s3cl" dir="auto"&gt;&lt;CODE class="language-python"&gt;df = spark.read.parquet("path")
df.select("your_column").printSchema()
df.select("your_column").show(truncate=False)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you see a decimal type with a smaller scale than the source DB, the precision loss has already happened in ADF.&lt;/P&gt;
&lt;P&gt;You can fix this in your ADF Copy activity, go to Sink --&amp;gt; Mapping and explicitly set the target column to a DECIMAL with sufficient precision/scale (for example DECIMAL(38, 18) if supported).&amp;nbsp;If that’s not possible, have ADF write the value as STRING to Parquet, then in Databricks cast it to a suitable decimal:&lt;/P&gt;
&lt;PRE dir="auto"&gt;from pyspark.sql.functions import col

df = (spark.read.parquet("path")
      .withColumn("your_column",
                  col("your_column").cast("decimal(38,18)")))
&lt;/PRE&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P class="p1"&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;STRONG&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2026 20:36:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/decimal-precision-loss-while-reading-parquet-files-in-databricks/m-p/154143#M748</guid>
      <dc:creator>Ashwin_DSA</dc:creator>
      <dc:date>2026-04-11T20:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal Precision Loss While Reading Parquet Files in Databricks</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/decimal-precision-loss-while-reading-parquet-files-in-databricks/m-p/154703#M751</link>
      <description>&lt;P&gt;Thank for your response.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2026 05:38:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/decimal-precision-loss-while-reading-parquet-files-in-databricks/m-p/154703#M751</guid>
      <dc:creator>SantiNath_Dey</dc:creator>
      <dc:date>2026-04-16T05:38:22Z</dc:date>
    </item>
  </channel>
</rss>

