You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/02/25 13:40:03 UTC

[GitHub] [iceberg] chenjunjiedada opened a new pull request #2273: Core: Add predicate to rewrite action

chenjunjiedada opened a new pull request #2273:
URL: https://github.com/apache/iceberg/pull/2273


   In our production environment, the Flink iceberg sink could produce a large number of small files, especially when the checkpoint interval is set to a small value, for example, one minute. Or when online business is spare. When rewriting the small files, we found the filter is not enough for collecting small files especially when the table is partitioned by the bucket. 
   
   This adds a predicate to rewrite action so that we could filter out data files according to data file properties, such as record count, or file size. It collects small files in the specified size range and thus mitigates the overhead of the compaction service.
   
   


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

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


[GitHub] [iceberg] RussellSpitzer commented on pull request #2273: Core: Add predicate to rewrite action

Posted by GitBox <gi...@apache.org>.
RussellSpitzer commented on pull request #2273:
URL: https://github.com/apache/iceberg/pull/2273#issuecomment-786261493


   I believe so, for a preview i'm thinking that we should make rewrite/optimize an action which takes a variable "CompactionStrategy" class that has a form like
   ```java
     /**
      * Removes all file references which this plan will not rewrite.
      * @param dataFiles iterator of live datafiles in a given partition
      * @return iterator containing only files to be rewritten
      */
     Iterator<DataFile> filesToCompact(Iterator<DataFile> dataFiles);
   
     /**
      * Groups files into lists which will be processed in a single executable
      * unit. Each group will end up being committed as an independent set of
      * changes.
      * @param dataFiles iterator of files to be rewritten
      * @return iterator of sets of files to be processed together
      */
     Iterator<List<DataFile>> groupsFilesPerJob(Iterator<DataFile> dataFiles);
   
     /**
      * Method which will actually rewrite and commit changes to a group of files
      * based on the particular CompactionStrategy's algorithm
      * @param filesToRewrite a group of files to be rewritten together
      * @return a list of newly committed files
      */
     List<DataFile> rewriteFiles(List<DataFile> filesToRewrite);
   }
   ```
   
   Although I think we may need to have the methods use FileScanTask since we are going to need access to DeleteFiles and Data files to properly run the "rewrite" action ... I hope to get this up soon, I just have been wavering on that issue since it is no longer trivial to take a set of DataFiles and generate tasks to read them.


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

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


[GitHub] [iceberg] RussellSpitzer edited a comment on pull request #2273: Core: Add predicate to rewrite action

Posted by GitBox <gi...@apache.org>.
RussellSpitzer edited a comment on pull request #2273:
URL: https://github.com/apache/iceberg/pull/2273#issuecomment-786261493


   I believe so, for a preview i'm thinking that we should make rewrite/optimize an action which takes a variable "CompactionStrategy" class that has a fulfills an interface like
   ```java
     /**
      * Removes all file references which this plan will not rewrite.
      * @param dataFiles iterator of live datafiles in a given partition
      * @return iterator containing only files to be rewritten
      */
     Iterator<DataFile> filesToCompact(Iterator<DataFile> dataFiles);
   
     /**
      * Groups files into lists which will be processed in a single executable
      * unit. Each group will end up being committed as an independent set of
      * changes.
      * @param dataFiles iterator of files to be rewritten
      * @return iterator of sets of files to be processed together
      */
     Iterator<List<DataFile>> groupsFilesPerJob(Iterator<DataFile> dataFiles);
   
     /**
      * Method which will actually rewrite and commit changes to a group of files
      * based on the particular CompactionStrategy's algorithm
      * @param filesToRewrite a group of files to be rewritten together
      * @return a list of newly committed files
      */
     List<DataFile> rewriteFiles(List<DataFile> filesToRewrite);
   }
   ```
   
   Although I think we may need to have the methods use FileScanTask since we are going to need access to DeleteFiles and Data files to properly run the "rewrite" action ... I hope to get this up soon, I just have been wavering on that issue since it is no longer trivial to take a set of DataFiles and generate tasks to read them.
   
   What I want to be sure of here is that we don't just allow a "filter" expression because some algorithms may want to collect the entire list of files before considering which files to compact or not.


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

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


[GitHub] [iceberg] aokolnychyi commented on pull request #2273: Core: Add predicate to rewrite action

Posted by GitBox <gi...@apache.org>.
aokolnychyi commented on pull request #2273:
URL: https://github.com/apache/iceberg/pull/2273#issuecomment-786258918


   @RussellSpitzer is working on a data compaction proposal and there is a PR to rework the Action API in #2255.
   
   I'd prefer to get #2255 and subsequent PRs (which I have locally) in before we make more changes around actions.
   
   @RussellSpitzer, could you please take a look at this PR? I think you have a solution for this and it would be great to confirm it works for @chenjunjiedada. 
   


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

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


[GitHub] [iceberg] RussellSpitzer edited a comment on pull request #2273: Core: Add predicate to rewrite action

Posted by GitBox <gi...@apache.org>.
RussellSpitzer edited a comment on pull request #2273:
URL: https://github.com/apache/iceberg/pull/2273#issuecomment-786261493


   I believe so, for a preview i'm thinking that we should make rewrite/optimize an action which takes a variable "CompactionStrategy" class that has a fulfills an interface like
   ```java
     /**
      * Removes all file references which this plan will not rewrite.
      * @param dataFiles iterator of live datafiles in a given partition
      * @return iterator containing only files to be rewritten
      */
     Iterator<DataFile> filesToCompact(Iterator<DataFile> dataFiles);
   
     /**
      * Groups files into lists which will be processed in a single executable
      * unit. Each group will end up being committed as an independent set of
      * changes.
      * @param dataFiles iterator of files to be rewritten
      * @return iterator of sets of files to be processed together
      */
     Iterator<List<DataFile>> groupsFilesPerJob(Iterator<DataFile> dataFiles);
   
     /**
      * Method which will actually rewrite and commit changes to a group of files
      * based on the particular CompactionStrategy's algorithm
      * @param filesToRewrite a group of files to be rewritten together
      * @return a list of newly committed files
      */
     List<DataFile> rewriteFiles(List<DataFile> filesToRewrite);
   }
   ```
   
   Although I think we may need to have the methods use FileScanTask since we are going to need access to DeleteFiles and Data files to properly run the "rewrite" action ... I hope to get this up soon, I just have been wavering on that issue since it is no longer trivial to take a set of DataFiles and generate tasks to read them.


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

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


[GitHub] [iceberg] chenjunjiedada commented on pull request #2273: Core: Add predicate to rewrite action

Posted by GitBox <gi...@apache.org>.
chenjunjiedada commented on pull request #2273:
URL: https://github.com/apache/iceberg/pull/2273#issuecomment-786480334


   The `CompactionStrategy` looks great!  We have encountered a table with tens of millions of small files, the rewrite action takes days and fails eventually because of HDFS overhead. So I added an option to break down the grouped scan files into partitions and then execute the rewrite partition by partition.  With the `CompactionStrategy` we could tell the user to customize the rewrite strategy case by case.


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

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


[GitHub] [iceberg] chenjunjiedada closed pull request #2273: Core: Add predicate to rewrite action

Posted by GitBox <gi...@apache.org>.
chenjunjiedada closed pull request #2273:
URL: https://github.com/apache/iceberg/pull/2273


   


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

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


[GitHub] [iceberg] chenjunjiedada commented on pull request #2273: Core: Add predicate to rewrite action

Posted by GitBox <gi...@apache.org>.
chenjunjiedada commented on pull request #2273:
URL: https://github.com/apache/iceberg/pull/2273#issuecomment-861106556


   Close this since we have `RewriteStrategy` and `RewriteDatafilesAction` now. Thanks @RussellSpitzer  


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

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