cancel
Showing results for 
Search instead for 
Did you mean: 
Community Discussions
cancel
Showing results for 
Search instead for 
Did you mean: 

Maintaining Order Consistency: Table Creation in Databricks SQL vs. DLT Pipeline

Archana_Mathan
New Contributor

I have a CTE table with the below names as values. My objective is to create another table by concatenating all the rows from the CTE table in ascending order, resulting in the final output sequence: "Abi, Rahul, ram, Siva". When executing the query in DataBricks SQL, the expected outcome is achieved. However, when creating the table through the DLT pipeline, the order is altered, resulting in the following sequence: "Abi, Siva, ram, Rahul". Is there a solution to maintain the original order consistently, regardless of whether the table is created manually or through the DLT pipeline?

Archana_Mathan_0-1713354324971.png

1 REPLY 1

-werners-
Esteemed Contributor III

when writing, order is not guaranteed due to the nature of distributed processing.
If you want the order to be guaranteed, you should order it when reading the data.

Your query does not write any data, DLT does, that is the difference.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.