Takuya-Omi
Valued Contributor III

@dbhavesh 

I apologize for the lack of explanation.

The ROW_NUMBER function requires ordering over the entire dataset, making it a non-time-based window function. When applied to streaming data, it results in the "NON_TIME_WINDOW_NOT_SUPPORTED_IN_STREAMING" error.

This issue occurs specifically in DLT streaming tables because they continuously process incoming data. However, in the case of materialized views, data is processed as a snapshot at a given point in time, allowing ordering without triggering this error.

If you need to generate sequential numbers, consider either:

  1. Using a materialized view instead of a streaming table, or
  2. Defining an IDENTITY column in the table schema, which automatically assigns unique sequential numbers upon data insertion.*

Databricks Documentation – Identity Columns in Delta Lake

--------------------------
Takuya Omi (尾美拓哉)