<?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 Order of delta table after read not as expected in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/order-of-delta-table-after-read-not-as-expected/m-p/38631#M26688</link>
    <description>&lt;P&gt;Dear Databricks Community,&lt;/P&gt;&lt;P&gt;I am performing three consecutive 'append' writes to a delta table, whereas the first append creates the table. Each append consists of two rows, which are ordered by column 'id' (see example in the attached screenshot). When I read in the dataframe after all appends have completed, the rows are ordered with respect to column 'id' in the following order: '1, 2, 5, 6, 3, 4'. My expectation is '1, 2, 3, 4, 5, 6', as the original data has been ordered by 'id', and the appends to the delta table happened in order '1, 2', '3, 4', and '5,6'.&lt;/P&gt;&lt;P&gt;Is this behavior expected?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to obtain the same order upon read in which the data has been appended to the table?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your consideration and help.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jul 2023 07:00:01 GMT</pubDate>
    <dc:creator>felix_counter</dc:creator>
    <dc:date>2023-07-28T07:00:01Z</dc:date>
    <item>
      <title>Order of delta table after read not as expected</title>
      <link>https://community.databricks.com/t5/data-engineering/order-of-delta-table-after-read-not-as-expected/m-p/38631#M26688</link>
      <description>&lt;P&gt;Dear Databricks Community,&lt;/P&gt;&lt;P&gt;I am performing three consecutive 'append' writes to a delta table, whereas the first append creates the table. Each append consists of two rows, which are ordered by column 'id' (see example in the attached screenshot). When I read in the dataframe after all appends have completed, the rows are ordered with respect to column 'id' in the following order: '1, 2, 5, 6, 3, 4'. My expectation is '1, 2, 3, 4, 5, 6', as the original data has been ordered by 'id', and the appends to the delta table happened in order '1, 2', '3, 4', and '5,6'.&lt;/P&gt;&lt;P&gt;Is this behavior expected?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to obtain the same order upon read in which the data has been appended to the table?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your consideration and help.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 07:00:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/order-of-delta-table-after-read-not-as-expected/m-p/38631#M26688</guid>
      <dc:creator>felix_counter</dc:creator>
      <dc:date>2023-07-28T07:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Order of delta table after read not as expected</title>
      <link>https://community.databricks.com/t5/data-engineering/order-of-delta-table-after-read-not-as-expected/m-p/38667#M26705</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/85492"&gt;@felix_counter&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While fetching the data from a delta table, the order is not maintained as the data is fetched parallely. This is an expected scenario. If you want to display the data in a certain order, it is advised to query the data with the order by or sort by clause.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 12:52:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/order-of-delta-table-after-read-not-as-expected/m-p/38667#M26705</guid>
      <dc:creator>Lakshay</dc:creator>
      <dc:date>2023-07-28T12:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Order of delta table after read not as expected</title>
      <link>https://community.databricks.com/t5/data-engineering/order-of-delta-table-after-read-not-as-expected/m-p/38806#M26769</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/85492"&gt;@felix_counter&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adding on to Lakshay's answer, you have to rewrite your query as&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;from pyspark.sql.functions import col
df.orderBy(col("id")).show()&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 01 Aug 2023 05:22:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/order-of-delta-table-after-read-not-as-expected/m-p/38806#M26769</guid>
      <dc:creator>Tharun-Kumar</dc:creator>
      <dc:date>2023-08-01T05:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Order of delta table after read not as expected</title>
      <link>https://community.databricks.com/t5/data-engineering/order-of-delta-table-after-read-not-as-expected/m-p/38920#M26817</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/75976"&gt;@Lakshay&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/39403"&gt;@Tharun-Kumar&lt;/a&gt;&amp;nbsp;for your valued contributions!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 11:49:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/order-of-delta-table-after-read-not-as-expected/m-p/38920#M26817</guid>
      <dc:creator>felix_counter</dc:creator>
      <dc:date>2023-08-02T11:49:23Z</dc:date>
    </item>
  </channel>
</rss>

