aokolnychyi commented on issue #90: Add finalizer for Hadoop streams to catch 
paths that don't call close.
URL: https://github.com/apache/incubator-iceberg/pull/90#issuecomment-464769205
 
 
   My suspicion is that we have a problem in `BaseTableScan$planFiles`. 
Specifically, this piece:
   
   ```
         ConcurrentLinkedQueue<Closeable> toClose = new 
ConcurrentLinkedQueue<>();
         Iterable<Iterable<FileScanTask>> readers = Iterables.transform(
             matchingManifests,
             manifest -> {
               ManifestReader reader = 
ManifestReader.read(ops.io().newInputFile(manifest.path()));
               toClose.add(reader);
               String schemaString = 
SchemaParser.toJson(reader.spec().schema());
               String specString = PartitionSpecParser.toJson(reader.spec());
               ResidualEvaluator residuals = new 
ResidualEvaluator(reader.spec(), rowFilter);
               return Iterables.transform(
                   reader.filterRows(rowFilter).select(SNAPSHOT_COLUMNS),
                   file -> new BaseFileScanTask(file, schemaString, specString, 
residuals)
               );
             });
   
         if (PLAN_SCANS_WITH_WORKER_POOL && snapshot.manifests().size() > 1) {
           return CloseableIterable.combine(
               new ParallelIterable<>(readers, getWorkerPool()),
               toClose);
         } else {
           return CloseableIterable.combine(Iterables.concat(readers), toClose);
         }
   ```
   
   The closure that adds `ManifestReader reader` to `toClose` is lazy. Hence, 
`toClose` is empty when we return 
`CloseableIterable.combine(Iterables.concat(readers), toClose)`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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