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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to