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/01/28 18:38:37 UTC

[GitHub] [iceberg] wypoon commented on a change in pull request #2170: Make lookup of data file by file path robust.

wypoon commented on a change in pull request #2170:
URL: https://github.com/apache/iceberg/pull/2170#discussion_r566322395



##########
File path: flink/src/main/java/org/apache/iceberg/flink/source/DataIterator.java
##########
@@ -71,12 +72,13 @@
 
   InputFile getInputFile(FileScanTask task) {
     Preconditions.checkArgument(!task.isDataTask(), "Invalid task type");
-
-    return inputFiles.get(task.file().path().toString());
+    return getInputFile(task.file().path().toString());
   }
 
   InputFile getInputFile(String location) {
-    return inputFiles.get(location);
+    // normalize the path before looking it up in the map
+    Path path = new Path(location);

Review comment:
       For @steveloughran's information, the reason the keys in the `inputFiles` map became normalized paths is that the files for the scan tasks go through encryption and decryption:
   ```
       Stream<EncryptedInputFile> encrypted = keyMetadata.entrySet().stream()
           .map(entry -> EncryptedFiles.encryptedInput(io.newInputFile(entry.getKey()), entry.getValue()));
   
       // decrypt with the batch call to avoid multiple RPCs to a key server, if possible
       Iterable<InputFile> decryptedFiles = encryptionManager.decrypt(encrypted::iterator);
   ```
   and the keys are the location of the decrypted files. The call to `io.newInputFile` either passes through `HadoopFileIO` or `S3FileIO` (currently the two implementations of `FileIO`), and the `newInputFile` process normalized the path. The normalization through `HadoopFileIO` is exactly what I'm replicating here. I think it will work for an S3 path too.
   
   @rdblue, from the decrypted files, I do not see a natural way to recover the original path string written in the manifest. Instead, can we add a method to the `FileIO` interface to return the normalized path for a path String, and then `HadoopFileIO` and `S3FileIO` will have to implement it?




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