rdblue edited a comment on issue #569: Use broadcast variables in IcebergSource
URL: https://github.com/apache/incubator-iceberg/pull/569#issuecomment-561897938
 
 
   Here's a slightly cleaner way. I updated `HadoopFileIO` to use a 
`Supplier<Configuration>` instead of a `SerializableConfiguration`:
   
   ```java
   public class HadoopFileIO implements FileIO {
   
     private final Supplier<Configuration> hadoopConf;
   
     public HadoopFileIO(Configuration hadoopConf) {
       this(new SerializableConfiguration(hadoopConf)::get);
     }
   
     public HadoopFileIO(Supplier<Configuration> hadoopConf) {
       this.hadoopConf = hadoopConf;
     }
   
     public Configuration conf() {
       return hadoopConf.get();
     }
   
     ...
   }
   ```
   
   Then we just need to pass Spark's `SerializableConfiguration` in Spark:
   
   ```java
       if (table.io() instanceof HadoopFileIO) {
         this.fileIo = new HadoopFileIO(new 
SerializableConfiguration(((HadoopFileIO) table.io()).conf())::value);
       } else {
         this.fileIo = table.io();
       }
   ```
   
   Here's a branch: 
https://github.com/rdblue/iceberg/commit/84aa3ba434898b5c8b9ca71c9754c437ec3cff51
   
   It shouldn't be too difficult to add the broadcast to that.

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


With regards,
Apache Git Services

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

Reply via email to