You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "madeirak (via GitHub)" <gi...@apache.org> on 2025/04/10 11:35:04 UTC

[I] How to maintain sorting status of data files, maybe using rewrite_data_files procedure or something... [iceberg]

madeirak opened a new issue, #12761:
URL: https://github.com/apache/iceberg/issues/12761

   ### Query engine
   
   Spark 3.5
   
   ### Question
   
   I want data files to stay sorted. I noticed the rewrite_data_files procedure can do this, but it has min-file-size-bytes and max-file-size-bytes to limit the scope.
   This leads to the files between this two limit will not included in rewrite_data_files procedure, naturally, they will not be sorted.
   How can I make all files be sorted asynchronously?
   
   ---
   Make min-file-size-bytes equal to max-file-size-bytes can hit all data files, but I dont want to process full amount of data everyday...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] How to handling incremental data file sorting, maybe using rewrite_data_files procedure or something... [iceberg]

Posted by "madeirak (via GitHub)" <gi...@apache.org>.
madeirak commented on issue #12761:
URL: https://github.com/apache/iceberg/issues/12761#issuecomment-2795935464

   > [@madeirak](https://github.com/madeirak): Do you have a way to identify the non-sorted files somehow? Maybe the `filter` option could help you on the Java API. It is not an easy solution, but could be used whenever the other options are exhausted.
   
   Unfortunately, It cannot determine which data is not sorted from the table columns and partitions.
   By the way, https://iceberg.apache.org/docs/latest/spark-ddl/#alter-table-write-ordered-by
   Is this effective?
   1. After adding this config, will all write operations to this table become ordered?
   2. How much does this write-time sorting action increase the cost of the write operation?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] How to maintain sorting status of data files, maybe using rewrite_data_files procedure or something... [iceberg]

Posted by "pvary (via GitHub)" <gi...@apache.org>.
pvary commented on issue #12761:
URL: https://github.com/apache/iceberg/issues/12761#issuecomment-2792562489

   You can use `rewriteAll` to rewrite every data file.
   This will not skip already sorted files.
   Usually this is good, as based on the `max-file-group-size-bytes` multiple files are compacted in a group. The sorting happens on group level, and the resulting files will contain distinct ranges for the sorted columns.
   When a query uses filtering for the sorting columns most of the files could be filtered out on metadata level which could speed up the query massively.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] How to handling incremental data file sorting, maybe using rewrite_data_files procedure or something... [iceberg]

Posted by "pvary (via GitHub)" <gi...@apache.org>.
pvary commented on issue #12761:
URL: https://github.com/apache/iceberg/issues/12761#issuecomment-2796396531

   > By the way, https://iceberg.apache.org/docs/latest/spark-ddl/#alter-table-write-ordered-by Is this effective?
   > 
   > 1. After adding this config, will all write operations to this table become ordered?
   
   This depends on the writer. AFAIK Spark uses this config, but Flink just ignores it (because streaming writes has different constraints)
   
   > 3. How much does this write-time sorting action increase the cost of the write operation?
   
   I can't help you here 😢 as I did not run tests with Spark. That said, sorting is never a trivial task, and definitely involves at least one shuffle stage, which can cause performance degradation. You can check your Spark job's plan for this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] How to maintain sorting status of data files, maybe using rewrite_data_files procedure or something... [iceberg]

Posted by "madeirak (via GitHub)" <gi...@apache.org>.
madeirak commented on issue #12761:
URL: https://github.com/apache/iceberg/issues/12761#issuecomment-2795732698

   > You can use `rewriteAll` to rewrite every data file. This will not skip already sorted files. Usually this is good, as based on the `max-file-group-size-bytes` multiple files are compacted in a group. The sorting happens on group level, and the resulting files will contain distinct ranges for the sorted columns. When a query uses filtering for the sorting columns most of the files could be filtered out on metadata level which could speed up the query massively.
   
   Thx for reply.
   I am sorting the data indeed to accelerate query execution.​
   
   Currently, the partition of this Iceberg table is date. I want to have a way to make almost all the data in order. This can speed up the query speed of large table (PB level). At present, the problem encountered when `using rewrite_data_files procedure` is that `min-file-size-bytes` and `max-file-size-bytes` need to be set. When some newly written files are between `min-file-size-bytes` and `max-file-size-bytes`, they will not be sorted. But at the same time, because it is a large table, PB level, I don’t want to run the full sort frequently every time. Is there a better way?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] How to handling incremental data file sorting, maybe using rewrite_data_files procedure or something... [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #12761:
URL: https://github.com/apache/iceberg/issues/12761#issuecomment-3383626206

   This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] How to handling incremental data file sorting, maybe using rewrite_data_files procedure or something... [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #12761: How to handling incremental data file sorting, maybe using rewrite_data_files procedure or something...
URL: https://github.com/apache/iceberg/issues/12761


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] How to handling incremental data file sorting, maybe using rewrite_data_files procedure or something... [iceberg]

Posted by "pvary (via GitHub)" <gi...@apache.org>.
pvary commented on issue #12761:
URL: https://github.com/apache/iceberg/issues/12761#issuecomment-2795896962

   @madeirak: Do you have a way to identify the non-sorted files somehow? Maybe the `filter` option could help you on the Java API. It is not an easy solution, but could be used whenever the other options are exhausted.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] How to maintain sorting status of data files, maybe using rewrite_data_files procedure or something... [iceberg]

Posted by "madeirak (via GitHub)" <gi...@apache.org>.
madeirak commented on issue #12761:
URL: https://github.com/apache/iceberg/issues/12761#issuecomment-2792454552

   Make min-file-size-bytes equal to max-file-size-bytes can hit all data files, will it intelligently skip already sorted files?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [I] How to handling incremental data file sorting, maybe using rewrite_data_files procedure or something... [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #12761:
URL: https://github.com/apache/iceberg/issues/12761#issuecomment-3434635562

   This issue has been closed because it has not received any activity in the last 14 days since being marked as 'stale'


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org