<?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: Reading empty json file in serverless gives error in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/reading-empty-json-file-in-serverless-gives-error/m-p/137205#M50709</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Solution provided here:&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;A href="https://community.databricks.com/t5/data-engineering/reading-empty-json-file-in-serverless-gives-error/m-p/137022#M50682" target="_blank"&gt;https://community.databricks.com/t5/data-engineering/reading-empty-json-file-in-serverless-gives-error/m-p/137022#M50682&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 01 Nov 2025 04:20:39 GMT</pubDate>
    <dc:creator>K_Anudeep</dc:creator>
    <dc:date>2025-11-01T04:20:39Z</dc:date>
    <item>
      <title>Reading empty json file in serverless gives error</title>
      <link>https://community.databricks.com/t5/data-engineering/reading-empty-json-file-in-serverless-gives-error/m-p/136782#M50648</link>
      <description>&lt;P&gt;I have a pipeline which puts json files in a storage location after reading a daily delta load. Today I encountered a case where the file as empty. I tried running the notebook manually using serverless cluster (Environment version 4) and encountered this error.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;df = spark.read.json(path)&lt;BR /&gt;df.display()&lt;BR /&gt;&lt;BR /&gt;-- Output&lt;BR /&gt;Since Spark 2.3, the queries from raw JSON/CSV files are disallowed when the referenced columns only &lt;BR /&gt;include the internal corrupt record column (named _corrupt_record by default). For example: &lt;BR /&gt;spark.read.schema(schema).csv(file).filter($"_corrupt_record".isNotNull).count() &lt;BR /&gt;and spark.read.schema(schema).csv(file).select("_corrupt_record").show(). Instead, you can cache or &lt;BR /&gt;save the parsed results and then send the same query. For example, &lt;BR /&gt;val df = spark.read.schema(schema).csv(file).cache() and then &lt;BR /&gt;df.filter($"_corrupt_record".isNotNull).count().&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I tried doing the cache but got another error that cache is not supported in serverless compute&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="" href="https://learn.microsoft.com/azure/databricks/error-messages/error-classes#not_supported_with_serverless" target="_blank" rel="noopener noreferrer"&gt;NOT_SUPPORTED_WITH_SERVERLESS&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;SPAN&gt; PERSIST TABLE is not supported on serverless compute. SQLSTATE: 0A000&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I have three questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Why does this only happen in serverless compute and not in all-purpose compute (I tried on 15.4)?&lt;/LI&gt;&lt;LI&gt;How to display the dataframe in serverless compute in such case? I tried &lt;EM&gt;collect, select('*', lit('a'))&lt;/EM&gt; but nothing works&lt;/LI&gt;&lt;LI&gt;Is there any way to avoid this error? Like in all-purpose compute it just creates an empty dataframe with no columns and rows.&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Thu, 30 Oct 2025 16:33:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/reading-empty-json-file-in-serverless-gives-error/m-p/136782#M50648</guid>
      <dc:creator>Dhruv-22</dc:creator>
      <dc:date>2025-10-30T16:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reading empty json file in serverless gives error</title>
      <link>https://community.databricks.com/t5/data-engineering/reading-empty-json-file-in-serverless-gives-error/m-p/137205#M50709</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Solution provided here:&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;A href="https://community.databricks.com/t5/data-engineering/reading-empty-json-file-in-serverless-gives-error/m-p/137022#M50682" target="_blank"&gt;https://community.databricks.com/t5/data-engineering/reading-empty-json-file-in-serverless-gives-error/m-p/137022#M50682&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Nov 2025 04:20:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/reading-empty-json-file-in-serverless-gives-error/m-p/137205#M50709</guid>
      <dc:creator>K_Anudeep</dc:creator>
      <dc:date>2025-11-01T04:20:39Z</dc:date>
    </item>
  </channel>
</rss>

