<?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: Delta comparison architecture using flatMapGroupsWithState in Structured Streaming in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/delta-comparison-architecture-using-flatmapgroupswithstate-in/m-p/135060#M10865</link>
    <description>&lt;P&gt;Hi Hubert,&lt;BR /&gt;First of all Thank you for answering.&lt;/P&gt;&lt;P&gt;Source and target are Azure event hubs.&lt;BR /&gt;Here is the design , Could you please verify and help me enhance it, Thanks for all your support, much appreciated.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VamsiDatabricks_0-1760579563861.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/20762iEA1A5722B975DA2E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VamsiDatabricks_0-1760579563861.png" alt="VamsiDatabricks_0-1760579563861.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Oct 2025 01:53:50 GMT</pubDate>
    <dc:creator>VamsiDatabricks</dc:creator>
    <dc:date>2025-10-16T01:53:50Z</dc:date>
    <item>
      <title>Delta comparison architecture using flatMapGroupsWithState in Structured Streaming</title>
      <link>https://community.databricks.com/t5/get-started-discussions/delta-comparison-architecture-using-flatmapgroupswithstate-in/m-p/134997#M10861</link>
      <description>&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;I am designing structured streaming job in Azure data bricks(using Scala) which will consume messages from two event hubs, lets call them source and target.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I would like your feedback on below flow, whether it is will survive the production load and suggestions to make it better.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;we consume messages from source and target EventHub&lt;/LI&gt;&lt;LI&gt;Parse and get the id which will be used to identify the message uniquely and also store the actual message in storage account.&lt;/LI&gt;&lt;LI&gt;Now we will have a one data set for both source and target.&lt;/LI&gt;&lt;LI&gt;Combine both source and target dataset and create a single dataset and group them by unique key.&lt;/LI&gt;&lt;LI&gt;On the keyed Dataset, we will run flatmapgroupswithstate operator so that the comparison runs for every minute and checks if source and target keys exist.&lt;/LI&gt;&lt;LI&gt;Once both Source and Target events for a given key are available, we fetch their corresponding JSONs from Delta using the stored pointers, perform the comparison, emit a DeltaRecord, and clear the state.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This is the design diagram.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://i.sstatic.net/5177TdlH.png" target="_blank" rel="nofollow noopener noreferrer"&gt;Structured Streaming&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here’s a simplified pseudocode snippet:&lt;/P&gt;&lt;PRE&gt;keyed.flatMapGroupsWithState[StateValue, DeltaRecord](
  OutputMode.Append(),
  GroupStateTimeout.EventTimeTimeout()
)(handleKey)&lt;/PRE&gt;&lt;P&gt;Could you please validate this approach for ,&lt;/P&gt;&lt;P&gt;Any hidden pitfalls in production especially around Delta I/O under load, event skew, or watermarking.&lt;/P&gt;&lt;P&gt;Whether others have adopted similar pointer-based approaches for large-scale streaming comparisons, and any tuning lessons learned.&lt;/P&gt;&lt;P&gt;Appreciate any feedback, design critiques, or optimization suggestions from those who’ve run this pattern at scale&lt;/P&gt;</description>
      <pubDate>Wed, 15 Oct 2025 12:53:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/delta-comparison-architecture-using-flatmapgroupswithstate-in/m-p/134997#M10861</guid>
      <dc:creator>VamsiDatabricks</dc:creator>
      <dc:date>2025-10-15T12:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Delta comparison architecture using flatMapGroupsWithState in Structured Streaming</title>
      <link>https://community.databricks.com/t5/get-started-discussions/delta-comparison-architecture-using-flatmapgroupswithstate-in/m-p/135053#M10862</link>
      <description>&lt;P&gt;It is hard to understand what the source is and what the target is. Some charts could be useful. Also, information on how long the state is kept. My solution usually is:&lt;BR /&gt;- Use declarative lakeflow pipelines if possible (dlt)&lt;/P&gt;
&lt;P&gt;- if not, consider handling the state by yourself using transformWithStateInPandas (here is my example&amp;nbsp;&lt;A href="https://databrickster.medium.com/transformwithstate-is-here-to-clean-duplicates-77b86c359392" target="_blank"&gt;https://databrickster.medium.com/transformwithstate-is-here-to-clean-duplicates-77b86c359392&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;- also sometimes easiest is just to use forEatchBatch and process stream as micro batches&lt;/P&gt;</description>
      <pubDate>Wed, 15 Oct 2025 19:12:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/delta-comparison-architecture-using-flatmapgroupswithstate-in/m-p/135053#M10862</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2025-10-15T19:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Delta comparison architecture using flatMapGroupsWithState in Structured Streaming</title>
      <link>https://community.databricks.com/t5/get-started-discussions/delta-comparison-architecture-using-flatmapgroupswithstate-in/m-p/135060#M10865</link>
      <description>&lt;P&gt;Hi Hubert,&lt;BR /&gt;First of all Thank you for answering.&lt;/P&gt;&lt;P&gt;Source and target are Azure event hubs.&lt;BR /&gt;Here is the design , Could you please verify and help me enhance it, Thanks for all your support, much appreciated.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VamsiDatabricks_0-1760579563861.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/20762iEA1A5722B975DA2E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VamsiDatabricks_0-1760579563861.png" alt="VamsiDatabricks_0-1760579563861.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Oct 2025 01:53:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/delta-comparison-architecture-using-flatmapgroupswithstate-in/m-p/135060#M10865</guid>
      <dc:creator>VamsiDatabricks</dc:creator>
      <dc:date>2025-10-16T01:53:50Z</dc:date>
    </item>
  </channel>
</rss>

