lanyuanxiaoyao commented on code in PR #5473:
URL: https://github.com/apache/hudi/pull/5473#discussion_r865639874


##########
hudi-common/src/main/java/org/apache/hudi/common/table/TableSchemaResolver.java:
##########
@@ -109,13 +110,18 @@ private MessageType getTableParquetSchemaFromDataFile() {
           // Determine the file format based on the file name, and then 
extract schema from it.
           if (instantAndCommitMetadata.isPresent()) {
             HoodieCommitMetadata commitMetadata = 
instantAndCommitMetadata.get().getRight();
-            String filePath = 
commitMetadata.getFileIdAndFullPaths(metaClient.getBasePath()).values().stream().findAny().get();
-            if 
(filePath.contains(HoodieFileFormat.HOODIE_LOG.getFileExtension())) {
-              // this is a log file
-              return readSchemaFromLogFile(new Path(filePath));
-            } else {
-              return readSchemaFromBaseFile(filePath);
+            Iterator<String> filePaths = 
commitMetadata.getFileIdAndFullPaths(metaClient.getBasePath()).values().iterator();
+            MessageType type = null;
+            while (filePaths.hasNext() && type == null) {

Review Comment:
   No problem, but this NPE may only happen in `.log` file



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to