<?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 Statestore is not valid when using Spark Structured Streaming in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/statestore-is-not-valid-when-using-spark-structured-streaming/m-p/176002#M57087</link>
    <description>&lt;P&gt;I'm using spark structured streaming and it works properly at first.&amp;nbsp; But when I try to audit the checkpointLocation I can't get it to work.&amp;nbsp; It seems like it should be a relatively simple task to query the statestore and audit the processing of a stream.&amp;nbsp; I'm attempting to follow these docs:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/structured-streaming/read-state" target="_blank"&gt;https://docs.databricks.com/aws/en/structured-streaming/read-state&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using dbx 16.4 and spark 3.5.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The error is always something meaningless like so:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[STDS_FAILED_TO_READ_STATE_SCHEMA] Failed to read the state schema. Either the file does not exist, or the file is corrupted. options: StateSourceOptions(checkpointLocation=abfss://datalake@xxx.dfs.core.windows.net/test002/x05, batchId=1, operatorId=0, storeName=default, joinSide=none, stateVarName=None, +flattenCollectionTypes=true).

Rerun the streaming query to construct the state schema, and report to the corresponding communities or vendors if the error persists. SQLSTATE: 42K03&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given the importance of Spark Structured Streaming, and the popularity, I did not think there would be so many sharp edges when auditing the statestore.&lt;/P&gt;&lt;P&gt;My source table is just a UC managed table that is writted by zerobus.&amp;nbsp; It is like so:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE TABLE a.b.streaming_c (
  MyA STRING NOT NULL,
  MyB INT NOT NULL,
  MyC STRING,
  MyDetails VARIANT,
  ZerobusRescueJson VARIANT)
USING delta
TBLPROPERTIES (
  'delta.checkpoint.writeStatsAsJson' = 'false',
  'delta.checkpoint.writeStatsAsStruct' = 'true',
  'delta.enableDeletionVectors' = 'true',
  'delta.enableRowTracking' = 'true',
  'delta.feature.appendOnly' = 'supported',
  'delta.feature.deletionVectors' = 'supported',
  'delta.feature.domainMetadata' = 'supported',
  'delta.feature.invariants' = 'supported',
  'delta.feature.rowTracking' = 'supported',
  'delta.feature.variantType' = 'supported',
  'delta.minReaderVersion' = '3',
  'delta.minWriterVersion' = '7',
  'delta.parquet.compression.codec' = 'zstd',
  'delta.parquet.format.version' = '2.12.0',
  'delta.parquet.format.version.afe.internal' = '2.12.0',
  'delta.rowTracking.materializedRowCommitVersionColumnName' = '_row-commit-version-col-777ca68b-c04b-4b5d-9a9d-5c5535e32d20',
  'delta.rowTracking.materializedRowIdColumnName' = '_row-id-col-1885c4cd-1354-4ce6-9726-ed098a251a62',
  'io.unitycatalog.tableId' = '6f07a65b-4887-4aa2-8f56-569b2922aec4')&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;I use &lt;/SPAN&gt;&lt;STRONG&gt;readStream/writeStream&lt;/STRONG&gt;&lt;SPAN&gt; to move the data to a different place. I set the checkpointLocation (ie. .option("&lt;/SPAN&gt;&lt;STRONG&gt;checkpointLocation&lt;/STRONG&gt;&lt;SPAN&gt;", x)) to an abfss location in azure:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"abfss://datalake@abc.dfs.core.windows.net/test002/x05"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DB1To3_0-1794251574660.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/33163iC15DD7646A472B60/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DB1To3_0-1794251574660.png" alt="DB1To3_0-1794251574660.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Later when the streaming compute stops running, I try to audit the state of the checkpointLocation and it fails:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;SELECT * FROM read_statestore('abfss://datalake@abc.dfs.core.windows.net/test002/x05/')&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That &lt;STRONG&gt;checkpointLocation&lt;/STRONG&gt; is very intimidating to me. It is doing ALL the heavy lifting when it comes to keeping track of the zerobus records that have been processed. There needs to be a way to &lt;STRONG&gt;recover an audit trail&lt;/STRONG&gt; from this statestore location. Why is the statestore API giving meaningless errorrs? I tried both the pyspark equivalent of this SELECT statement and it has the same error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Nov 2026 19:16:28 GMT</pubDate>
    <dc:creator>DB1To3</dc:creator>
    <dc:date>2026-11-09T19:16:28Z</dc:date>
    <item>
      <title>Statestore is not valid when using Spark Structured Streaming</title>
      <link>https://community.databricks.com/t5/data-engineering/statestore-is-not-valid-when-using-spark-structured-streaming/m-p/176002#M57087</link>
      <description>&lt;P&gt;I'm using spark structured streaming and it works properly at first.&amp;nbsp; But when I try to audit the checkpointLocation I can't get it to work.&amp;nbsp; It seems like it should be a relatively simple task to query the statestore and audit the processing of a stream.&amp;nbsp; I'm attempting to follow these docs:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/structured-streaming/read-state" target="_blank"&gt;https://docs.databricks.com/aws/en/structured-streaming/read-state&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using dbx 16.4 and spark 3.5.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The error is always something meaningless like so:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[STDS_FAILED_TO_READ_STATE_SCHEMA] Failed to read the state schema. Either the file does not exist, or the file is corrupted. options: StateSourceOptions(checkpointLocation=abfss://datalake@xxx.dfs.core.windows.net/test002/x05, batchId=1, operatorId=0, storeName=default, joinSide=none, stateVarName=None, +flattenCollectionTypes=true).

Rerun the streaming query to construct the state schema, and report to the corresponding communities or vendors if the error persists. SQLSTATE: 42K03&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given the importance of Spark Structured Streaming, and the popularity, I did not think there would be so many sharp edges when auditing the statestore.&lt;/P&gt;&lt;P&gt;My source table is just a UC managed table that is writted by zerobus.&amp;nbsp; It is like so:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE TABLE a.b.streaming_c (
  MyA STRING NOT NULL,
  MyB INT NOT NULL,
  MyC STRING,
  MyDetails VARIANT,
  ZerobusRescueJson VARIANT)
USING delta
TBLPROPERTIES (
  'delta.checkpoint.writeStatsAsJson' = 'false',
  'delta.checkpoint.writeStatsAsStruct' = 'true',
  'delta.enableDeletionVectors' = 'true',
  'delta.enableRowTracking' = 'true',
  'delta.feature.appendOnly' = 'supported',
  'delta.feature.deletionVectors' = 'supported',
  'delta.feature.domainMetadata' = 'supported',
  'delta.feature.invariants' = 'supported',
  'delta.feature.rowTracking' = 'supported',
  'delta.feature.variantType' = 'supported',
  'delta.minReaderVersion' = '3',
  'delta.minWriterVersion' = '7',
  'delta.parquet.compression.codec' = 'zstd',
  'delta.parquet.format.version' = '2.12.0',
  'delta.parquet.format.version.afe.internal' = '2.12.0',
  'delta.rowTracking.materializedRowCommitVersionColumnName' = '_row-commit-version-col-777ca68b-c04b-4b5d-9a9d-5c5535e32d20',
  'delta.rowTracking.materializedRowIdColumnName' = '_row-id-col-1885c4cd-1354-4ce6-9726-ed098a251a62',
  'io.unitycatalog.tableId' = '6f07a65b-4887-4aa2-8f56-569b2922aec4')&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;I use &lt;/SPAN&gt;&lt;STRONG&gt;readStream/writeStream&lt;/STRONG&gt;&lt;SPAN&gt; to move the data to a different place. I set the checkpointLocation (ie. .option("&lt;/SPAN&gt;&lt;STRONG&gt;checkpointLocation&lt;/STRONG&gt;&lt;SPAN&gt;", x)) to an abfss location in azure:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"abfss://datalake@abc.dfs.core.windows.net/test002/x05"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DB1To3_0-1794251574660.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/33163iC15DD7646A472B60/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DB1To3_0-1794251574660.png" alt="DB1To3_0-1794251574660.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Later when the streaming compute stops running, I try to audit the state of the checkpointLocation and it fails:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;SELECT * FROM read_statestore('abfss://datalake@abc.dfs.core.windows.net/test002/x05/')&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That &lt;STRONG&gt;checkpointLocation&lt;/STRONG&gt; is very intimidating to me. It is doing ALL the heavy lifting when it comes to keeping track of the zerobus records that have been processed. There needs to be a way to &lt;STRONG&gt;recover an audit trail&lt;/STRONG&gt; from this statestore location. Why is the statestore API giving meaningless errorrs? I tried both the pyspark equivalent of this SELECT statement and it has the same error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2026 19:16:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/statestore-is-not-valid-when-using-spark-structured-streaming/m-p/176002#M57087</guid>
      <dc:creator>DB1To3</dc:creator>
      <dc:date>2026-11-09T19:16:28Z</dc:date>
    </item>
  </channel>
</rss>

