<?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: Regarding : How to use Row_number() in dlt pipelines in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/regarding-how-to-use-row-number-in-dlt-pipelines/m-p/135485#M50362</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/192976"&gt;@anusha98&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I'm not well-versed with Structured Streaming but it certainly interests me.&lt;BR /&gt;&lt;BR /&gt;Not sure if you've looked up the limitations on Streaming Tables yet:&amp;nbsp;&lt;A href="https://docs.databricks.com/aws/en/ldp/streaming-tables#streaming-table-limitations" target="_blank"&gt;https://docs.databricks.com/aws/en/ldp/streaming-tables#streaming-table-limitations&lt;/A&gt;&amp;nbsp;and if you look into the docs for Window functions for Structured Streaming:&amp;nbsp;&lt;A href="https://spark.apache.org/docs/latest/streaming/apis-on-dataframes-and-datasets.html#operations-on-streaming-dataframesdatasets" target="_blank"&gt;https://spark.apache.org/docs/latest/streaming/apis-on-dataframes-and-datasets.html#operations-on-streaming-dataframesdatasets&lt;/A&gt;&amp;nbsp;it indicates that the window functions typically need some time event&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BS_THE_ANALYST_0-1761033298844.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/20871i8341F1BEED6236A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BS_THE_ANALYST_0-1761033298844.png" alt="BS_THE_ANALYST_0-1761033298844.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hopefully that's not a red herring and is pointing in the right direction for the issue at hand. If nobody responds, I'll try and recreate the issue after work today.&lt;BR /&gt;&lt;BR /&gt;All the best,&lt;BR /&gt;BS&lt;/P&gt;</description>
    <pubDate>Tue, 21 Oct 2025 07:56:04 GMT</pubDate>
    <dc:creator>BS_THE_ANALYST</dc:creator>
    <dc:date>2025-10-21T07:56:04Z</dc:date>
    <item>
      <title>Regarding : How to use Row_number() in dlt pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/regarding-how-to-use-row-number-in-dlt-pipelines/m-p/135436#M50350</link>
      <description>&lt;P&gt;We have two streaming tables : customer_info and customer_info_history and we&amp;nbsp; joined them using full join to create temp table in pyspark and now we want to eliminate the de-duped records from this temp table. Tried using row_number() but facing below error ..if anyone have solution to fix this error, kindly let me know.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;error:Failed to start stream table in either append mode or complete mode. Append mode error: [NON_TIME_WINDOW_NOT_SUPPORTED_IN_STREAMING] Window function is not supported in ROW_NUMBER() (as column `row_num`) on streaming DataFrames/Datasets. Structured Streaming only supports time-window aggregation using the WINDOW function.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;code:&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;dlt&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;table&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;name&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"table"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;def&lt;/SPAN&gt; &lt;SPAN&gt;temp_latest_email&lt;/SPAN&gt;&lt;SPAN&gt;():&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;n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N&gt;&lt;SPAN&gt;().&lt;/SPAN&gt;&lt;SPAN&gt;over&lt;/SPAN&gt;&lt;SPAN&gt;(window_spec))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; df_with_rownum&lt;/SPAN&gt;&lt;SPAN&gt;.filter&lt;/SPAN&gt;&lt;SPAN&gt;(col(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;row_num&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;==&lt;/SPAN&gt; &lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;drop&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"row_num"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 20 Oct 2025 17:22:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/regarding-how-to-use-row-number-in-dlt-pipelines/m-p/135436#M50350</guid>
      <dc:creator>anusha98</dc:creator>
      <dc:date>2025-10-20T17:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding : How to use Row_number() in dlt pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/regarding-how-to-use-row-number-in-dlt-pipelines/m-p/135485#M50362</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/192976"&gt;@anusha98&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I'm not well-versed with Structured Streaming but it certainly interests me.&lt;BR /&gt;&lt;BR /&gt;Not sure if you've looked up the limitations on Streaming Tables yet:&amp;nbsp;&lt;A href="https://docs.databricks.com/aws/en/ldp/streaming-tables#streaming-table-limitations" target="_blank"&gt;https://docs.databricks.com/aws/en/ldp/streaming-tables#streaming-table-limitations&lt;/A&gt;&amp;nbsp;and if you look into the docs for Window functions for Structured Streaming:&amp;nbsp;&lt;A href="https://spark.apache.org/docs/latest/streaming/apis-on-dataframes-and-datasets.html#operations-on-streaming-dataframesdatasets" target="_blank"&gt;https://spark.apache.org/docs/latest/streaming/apis-on-dataframes-and-datasets.html#operations-on-streaming-dataframesdatasets&lt;/A&gt;&amp;nbsp;it indicates that the window functions typically need some time event&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BS_THE_ANALYST_0-1761033298844.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/20871i8341F1BEED6236A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BS_THE_ANALYST_0-1761033298844.png" alt="BS_THE_ANALYST_0-1761033298844.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hopefully that's not a red herring and is pointing in the right direction for the issue at hand. If nobody responds, I'll try and recreate the issue after work today.&lt;BR /&gt;&lt;BR /&gt;All the best,&lt;BR /&gt;BS&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 07:56:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/regarding-how-to-use-row-number-in-dlt-pipelines/m-p/135485#M50362</guid>
      <dc:creator>BS_THE_ANALYST</dc:creator>
      <dc:date>2025-10-21T07:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding : How to use Row_number() in dlt pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/regarding-how-to-use-row-number-in-dlt-pipelines/m-p/135486#M50363</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/192976"&gt;@anusha98&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You’re hitting a real limitation of Structured Streaming: non-time window functions (like &lt;STRONG&gt;row_number() over (...)&lt;/STRONG&gt;) aren’t allowed on streaming DFs.&lt;/P&gt;
&lt;P&gt;You need to use agg().max() to get the “latest value per key”&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;@dlt.table(name="temp_latest_email")
def temp_latest_email():
    df = dlt.read_stream("table")
    return (
        df.groupBy("col1","col2")
          .agg(F.max(F.struct("col3","col1","col2")).alias("r"))
          .select(F.col("r.col1").alias("col1"),
                  F.col("r.col2").alias("col2"),
                  F.col("r.col3").alias("col3"))  
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or use &lt;STRONG&gt;dropDuplicates&lt;/STRONG&gt; to de-dupe before the actual join.&lt;/P&gt;
&lt;P&gt;Please let me know if you have any further questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 07:59:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/regarding-how-to-use-row-number-in-dlt-pipelines/m-p/135486#M50363</guid>
      <dc:creator>K_Anudeep</dc:creator>
      <dc:date>2025-10-21T07:59:16Z</dc:date>
    </item>
  </channel>
</rss>

