ahmedabu98 commented on code in PR #40614:
URL: https://github.com/apache/beam/pull/40614#discussion_r4317888312


##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/ReadFooterSchema.java:
##########
@@ -161,29 +161,51 @@ private static void count(ReadResult result) {
   private Callable<ReadResult> createReadTask(
       String filePath, Instant timestamp, BoundedWindow window, PaneInfo 
paneInfo) {
     return () -> {
-      FileFormat format;
-      try {
-        format = AddFiles.inferFormat(filePath);
-      } catch (AddFiles.UnknownFormatException e) {
-        return new ReadResult(dryRunMarker(UNREADABLE_KEY), false, timestamp, 
window, paneInfo);
-      }
-      if (!format.equals(FileFormat.PARQUET)) {
-        return new ReadResult(
-            dryRunMarker(UNCHECKED_FORMAT_KEY), false, timestamp, window, 
paneInfo);
+      ParquetMetadata footer;
+      if (AddFiles.hasNoExtension(filePath)) {
+        try {
+          footer = ParquetFooters.read(filePath);
+        } catch (Exception e) {
+          return unknownFormat(timestamp, window, paneInfo);
+        }
+      } else {
+        FileFormat format;
+        try {
+          format = AddFiles.inferFormat(filePath);
+        } catch (AddFiles.UnknownFormatException e) {
+          return unknownFormat(timestamp, window, paneInfo);
+        }
+        if (!format.equals(FileFormat.PARQUET)) {
+          return new ReadResult(
+              dryRunMarker(UNCHECKED_FORMAT_KEY), false, timestamp, window, 
paneInfo);
+        }
+        try {
+          footer = ParquetFooters.read(filePath);
+        } catch (Exception e) {
+          return unreadableFooter(filePath, e, timestamp, window, paneInfo);
+        }
       }
       try {
-        ParquetMetadata footer = ParquetFooters.read(filePath);
         return new ReadResult(FileSchemas.schemaGroup(footer), false, 
timestamp, window, paneInfo);
       } catch (Exception e) {
-        LOG.warn(
-            "Could not read the footer of {}; the file will not contribute to 
schema inference: {}",
-            filePath,
-            AddFiles.errorMessage(e));
-        return new ReadResult(dryRunMarker(UNREADABLE_KEY), true, timestamp, 
window, paneInfo);

Review Comment:
   This shouldn't return `unreadableFooter` right? Since at this point we have 
a valid footer?
   Maybe remove this try-exception all together, I think it was only meant for 
the footer read operation



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to