cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
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

2 REPLIES 2

-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.

standup1
New Contributor III

Hi @Archana_Mathan, did you solve this problem by any chance? I am having a similar problem maintaining the order of the dlt.

Thank you,

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group