You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/04/30 08:58:53 UTC

[GitHub] [hudi] lanyuanxiaoyao opened a new pull request, #5473: [HUDI-4003] Try to read all the log file to parse schema

lanyuanxiaoyao opened a new pull request, #5473:
URL: https://github.com/apache/hudi/pull/5473

   ## *Tips*
   - *Thank you very much for contributing to Apache Hudi.*
   - *Please review https://hudi.apache.org/contribute/how-to-contribute before opening a pull request.*
   
   ## What is the purpose of the pull request
   
   I have two partitions named p1 and p2.
   I only delete record to p1 and write update record to p2.
   Run flink offline compaction and it will throw NPE, because the log file in p1 only contains delete operation and hudi cannot get schema from it.
   
   If a `.log` file only contain delete operation, we can't parse schema from this file. So it should scan another `.log` file to parse schema when the code runs in the moment.
   
   ## Brief change log
   
   *(for example:)*
     - *Modify AnnotationLocation checkstyle rule in checkstyle.xml*
   
   ## Verify this pull request
   
   *(Please pick either of the following options)*
   
   This pull request is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This pull request is already covered by existing tests, such as *(please describe tests)*.
   
   (or)
   
   This change added tests and can be verified as follows:
   
   *(example:)*
   
     - *Added integration tests for end-to-end.*
     - *Added HoodieClientWriteTest to verify the change.*
     - *Manually verified the change by running a job locally.*
   
   ## Committer checklist
   
    - [ ] Has a corresponding JIRA in PR title & commit
    
    - [ ] Commit message is descriptive of the change
    
    - [ ] CI is green
   
    - [ ] Necessary doc changes done or have another open PR
          
    - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.
   


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #5473:
URL: https://github.com/apache/hudi/pull/5473#issuecomment-1113955287

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405",
       "triggerID" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8997ecfddab6ddf5b1b87a853fa5c871adabd86e Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] lanyuanxiaoyao commented on a diff in pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] nsivabalan commented on a diff in pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on code in PR #5473:
URL: https://github.com/apache/hudi/pull/5473#discussion_r869603600


##########
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:
   guess Alexey's suggestion was to introduce a private method and call from both places. 



-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #5473:
URL: https://github.com/apache/hudi/pull/5473#issuecomment-1122802881

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405",
       "triggerID" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8440",
       "triggerID" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "triggerType" : "PUSH"
     }, {
       "hash" : "842f31170072f6e21ca95447caa9d7968326034b",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8553",
       "triggerID" : "842f31170072f6e21ca95447caa9d7968326034b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b4fa0ffb833669426d69f6d80346d31b39eee5ec Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8440) 
   * 842f31170072f6e21ca95447caa9d7968326034b Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8553) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #5473:
URL: https://github.com/apache/hudi/pull/5473#issuecomment-1113969200

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405",
       "triggerID" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8997ecfddab6ddf5b1b87a853fa5c871adabd86e Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #5473:
URL: https://github.com/apache/hudi/pull/5473#issuecomment-1113954910

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8997ecfddab6ddf5b1b87a853fa5c871adabd86e UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] alexeykudinkin commented on a diff in pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
alexeykudinkin commented on code in PR #5473:
URL: https://github.com/apache/hudi/pull/5473#discussion_r865347231


##########
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:
   Let's unify this behavior across both MOR/COW



-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] lanyuanxiaoyao commented on a diff in pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
lanyuanxiaoyao commented on code in PR #5473:
URL: https://github.com/apache/hudi/pull/5473#discussion_r866425592


##########
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:
   Ok. Thanks for reviewing, and the new commit has fixed 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.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] nsivabalan commented on pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on PR #5473:
URL: https://github.com/apache/hudi/pull/5473#issuecomment-1122793274

   I have pushed out a commit myself to address the feedback. 


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] nsivabalan merged pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
nsivabalan merged PR #5473:
URL: https://github.com/apache/hudi/pull/5473


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #5473:
URL: https://github.com/apache/hudi/pull/5473#issuecomment-1122913900

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405",
       "triggerID" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8440",
       "triggerID" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "triggerType" : "PUSH"
     }, {
       "hash" : "842f31170072f6e21ca95447caa9d7968326034b",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8553",
       "triggerID" : "842f31170072f6e21ca95447caa9d7968326034b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 842f31170072f6e21ca95447caa9d7968326034b Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8553) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #5473:
URL: https://github.com/apache/hudi/pull/5473#issuecomment-1122800172

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405",
       "triggerID" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8440",
       "triggerID" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "triggerType" : "PUSH"
     }, {
       "hash" : "842f31170072f6e21ca95447caa9d7968326034b",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "842f31170072f6e21ca95447caa9d7968326034b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b4fa0ffb833669426d69f6d80346d31b39eee5ec Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8440) 
   * 842f31170072f6e21ca95447caa9d7968326034b UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #5473:
URL: https://github.com/apache/hudi/pull/5473#issuecomment-1118294999

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405",
       "triggerID" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8440",
       "triggerID" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8997ecfddab6ddf5b1b87a853fa5c871adabd86e Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405) 
   * b4fa0ffb833669426d69f6d80346d31b39eee5ec Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8440) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] alexeykudinkin commented on a diff in pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
alexeykudinkin commented on code in PR #5473:
URL: https://github.com/apache/hudi/pull/5473#discussion_r866120175


##########
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:
   Understood. But behavior should be consistent regardless of whether this is COW or MOR



-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #5473:
URL: https://github.com/apache/hudi/pull/5473#issuecomment-1118265976

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405",
       "triggerID" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8997ecfddab6ddf5b1b87a853fa5c871adabd86e Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405) 
   * b4fa0ffb833669426d69f6d80346d31b39eee5ec UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
hudi-bot commented on PR #5473:
URL: https://github.com/apache/hudi/pull/5473#issuecomment-1118447098

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8405",
       "triggerID" : "8997ecfddab6ddf5b1b87a853fa5c871adabd86e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8440",
       "triggerID" : "b4fa0ffb833669426d69f6d80346d31b39eee5ec",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b4fa0ffb833669426d69f6d80346d31b39eee5ec Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=8440) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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-unsubscribe@hudi.apache.org

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


[GitHub] [hudi] lanyuanxiaoyao commented on a diff in pull request #5473: [HUDI-4003] Try to read all the log file to parse schema

Posted by GitBox <gi...@apache.org>.
lanyuanxiaoyao commented on code in PR #5473:
URL: https://github.com/apache/hudi/pull/5473#discussion_r869811175


##########
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:
   > guess Alexey's suggestion was to introduce a private method and call from both places.
   
   Got it, thanks for your suggestion.



-- 
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-unsubscribe@hudi.apache.org

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