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 2020/10/20 15:04:43 UTC

[GitHub] [hudi] lw309637554 opened a new pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns …

lw309637554 opened a new pull request #2190:
URL: https://github.com/apache/hudi/pull/2190


   …if there are no log files
   
   ## *Tips*
   - *Thank you very much for contributing to Apache Hudi.*
   - *Please review https://hudi.apache.org/contributing.html before opening a pull request.*
   
   ## What is the purpose of the pull request
   
   RealtimeParquetInputFormat skip adding projection columns if there are no log files
   
   ## 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.

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



[GitHub] [hudi] codecov-io commented on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-720273452


   # [Codecov](https://codecov.io/gh/apache/hudi/pull/2190?src=pr&el=h1) Report
   > Merging [#2190](https://codecov.io/gh/apache/hudi/pull/2190?src=pr&el=desc) into [master](https://codecov.io/gh/apache/hudi/commit/fd269ddeb07fad015f71fc2c7daa53ace0e0e2da?el=desc) will **decrease** coverage by `0.02%`.
   > The diff coverage is `42.85%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/hudi/pull/2190/graphs/tree.svg?width=650&height=150&src=pr&token=VTTXabwbs2)](https://codecov.io/gh/apache/hudi/pull/2190?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2190      +/-   ##
   ============================================
   - Coverage     53.70%   53.67%   -0.03%     
   - Complexity     2848     2851       +3     
   ============================================
     Files           359      359              
     Lines         16554    16579      +25     
     Branches       1780     1786       +6     
   ============================================
   + Hits           8890     8899       +9     
   - Misses         6907     6921      +14     
   - Partials        757      759       +2     
   ```
   
   | Flag | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | hudicli | `38.37% <ø> (ø)` | `193.00 <ø> (ø)` | |
   | hudiclient | `100.00% <ø> (ø)` | `0.00 <ø> (ø)` | |
   | hudicommon | `54.70% <ø> (ø)` | `1794.00 <ø> (ø)` | |
   | hudihadoopmr | `33.13% <42.85%> (+0.08%)` | `183.00 <3.00> (+2.00)` | |
   | hudispark | `65.95% <ø> (ø)` | `304.00 <ø> (ø)` | |
   | huditimelineservice | `62.29% <ø> (ø)` | `50.00 <ø> (ø)` | |
   | hudiutilities | `70.09% <ø> (-0.27%)` | `327.00 <ø> (+1.00)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/hudi/pull/2190?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...oop/realtime/HoodieParquetRealtimeInputFormat.java](https://codecov.io/gh/apache/hudi/pull/2190/diff?src=pr&el=tree#diff-aHVkaS1oYWRvb3AtbXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvaGFkb29wL3JlYWx0aW1lL0hvb2RpZVBhcnF1ZXRSZWFsdGltZUlucHV0Rm9ybWF0LmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [.../hadoop/utils/HoodieRealtimeRecordReaderUtils.java](https://codecov.io/gh/apache/hudi/pull/2190/diff?src=pr&el=tree#diff-aHVkaS1oYWRvb3AtbXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvaGFkb29wL3V0aWxzL0hvb2RpZVJlYWx0aW1lUmVjb3JkUmVhZGVyVXRpbHMuamF2YQ==) | `74.38% <77.77%> (-0.19%)` | `30.00 <3.00> (+1.00)` | :arrow_down: |
   | [...hadoop/realtime/RealtimeCompactedRecordReader.java](https://codecov.io/gh/apache/hudi/pull/2190/diff?src=pr&el=tree#diff-aHVkaS1oYWRvb3AtbXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvaGFkb29wL3JlYWx0aW1lL1JlYWx0aW1lQ29tcGFjdGVkUmVjb3JkUmVhZGVyLmphdmE=) | `71.69% <100.00%> (+0.54%)` | `12.00 <0.00> (+1.00)` | |
   | [...in/java/org/apache/hudi/utilities/UtilHelpers.java](https://codecov.io/gh/apache/hudi/pull/2190/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL1V0aWxIZWxwZXJzLmphdmE=) | `64.19% <0.00%> (-3.34%)` | `30.00% <0.00%> (ø%)` | |
   | [...i/utilities/deltastreamer/HoodieDeltaStreamer.java](https://codecov.io/gh/apache/hudi/pull/2190/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL2RlbHRhc3RyZWFtZXIvSG9vZGllRGVsdGFTdHJlYW1lci5qYXZh) | `69.23% <0.00%> (-0.32%)` | `18.00% <0.00%> (ø%)` | |
   | [...ava/org/apache/hudi/keygen/CustomKeyGenerator.java](https://codecov.io/gh/apache/hudi/pull/2190/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9rZXlnZW4vQ3VzdG9tS2V5R2VuZXJhdG9yLmphdmE=) | `82.60% <0.00%> (ø)` | `16.00% <0.00%> (ø%)` | |
   | [...udi/utilities/sources/helpers/DFSPathSelector.java](https://codecov.io/gh/apache/hudi/pull/2190/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvaGVscGVycy9ERlNQYXRoU2VsZWN0b3IuamF2YQ==) | `84.44% <0.00%> (+4.00%)` | `14.00% <0.00%> (+1.00%)` | |
   


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



[GitHub] [hudi] vinothchandar commented on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-716075816


   I have rekicked the test. seems like a timeout. (AFAIK, the scenarios in integ test all do MOR with log files.) 


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



[GitHub] [hudi] vinothchandar commented on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-716078386


   Okay test fails again. @lw309637554 can you please investigate. 


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



[GitHub] [hudi] vinothchandar commented on a change in pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
vinothchandar commented on a change in pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#discussion_r511530095



##########
File path: hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/realtime/RealtimeCompactedRecordReader.java
##########
@@ -85,53 +85,55 @@ public boolean next(NullWritable aVoid, ArrayWritable arrayWritable) throws IOEx
       // if the result is false, then there are no more records
       return false;
     } else {
-      // TODO(VC): Right now, we assume all records in log, have a matching base record. (which
-      // would be true until we have a way to index logs too)
-      // return from delta records map if we have some match.
-      String key = arrayWritable.get()[HoodieInputFormatUtils.HOODIE_RECORD_KEY_COL_POS].toString();
-      if (deltaRecordMap.containsKey(key)) {
-        // TODO(NA): Invoke preCombine here by converting arrayWritable to Avro. This is required since the
-        // deltaRecord may not be a full record and needs values of columns from the parquet
-        Option<GenericRecord> rec;
-        if (usesCustomPayload) {
-          rec = deltaRecordMap.get(key).getData().getInsertValue(getWriterSchema());
-        } else {
-          rec = deltaRecordMap.get(key).getData().getInsertValue(getReaderSchema());
-        }
-        if (!rec.isPresent()) {
-          // If the record is not present, this is a delete record using an empty payload so skip this base record
-          // and move to the next record
-          return next(aVoid, arrayWritable);
-        }
-        GenericRecord recordToReturn = rec.get();
-        if (usesCustomPayload) {
-          // If using a custom payload, return only the projection fields. The readerSchema is a schema derived from
-          // the writerSchema with only the projection fields
-          recordToReturn = HoodieAvroUtils.rewriteRecordWithOnlyNewSchemaFields(rec.get(), getReaderSchema());
-        }
-        // we assume, a later safe record in the log, is newer than what we have in the map &
-        // replace it. Since we want to return an arrayWritable which is the same length as the elements in the latest
-        // schema, we use writerSchema to create the arrayWritable from the latest generic record
-        ArrayWritable aWritable = (ArrayWritable) HoodieRealtimeRecordReaderUtils.avroToArrayWritable(recordToReturn, getHiveSchema());
-        Writable[] replaceValue = aWritable.get();
-        if (LOG.isDebugEnabled()) {
-          LOG.debug(String.format("key %s, base values: %s, log values: %s", key, HoodieRealtimeRecordReaderUtils.arrayWritableToString(arrayWritable),
-              HoodieRealtimeRecordReaderUtils.arrayWritableToString(aWritable)));
-        }
-        Writable[] originalValue = arrayWritable.get();
-        try {
-          // Sometime originalValue.length > replaceValue.length.
-          // This can happen when hive query is looking for pseudo parquet columns like BLOCK_OFFSET_INSIDE_FILE
-          System.arraycopy(replaceValue, 0, originalValue, 0,
-              Math.min(originalValue.length, replaceValue.length));
-          arrayWritable.set(originalValue);
-        } catch (RuntimeException re) {
-          LOG.error("Got exception when doing array copy", re);
-          LOG.error("Base record :" + HoodieRealtimeRecordReaderUtils.arrayWritableToString(arrayWritable));
-          LOG.error("Log record :" + HoodieRealtimeRecordReaderUtils.arrayWritableToString(aWritable));
-          String errMsg = "Base-record :" + HoodieRealtimeRecordReaderUtils.arrayWritableToString(arrayWritable)
-              + " ,Log-record :" + HoodieRealtimeRecordReaderUtils.arrayWritableToString(aWritable) + " ,Error :" + re.getMessage();
-          throw new RuntimeException(errMsg, re);
+      if (!deltaRecordMap.isEmpty()) {

Review comment:
       I think we can structure this as a if block without need for the else? since the if above anyway returns out. 




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



[GitHub] [hudi] vinothchandar commented on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-847425886


   @rmpifer #2722 should have fixed this issue. Could you please take a pass? If you find gaps, we can revert the original PR as you suggest. 


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



[GitHub] [hudi] lw309637554 commented on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
lw309637554 commented on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-716167363


   > Okay test fails again. @lw309637554 can you please investigate.
   > 
   > ```
   > [ERROR] Errors: 
   > [ERROR]   ITTestHoodieDemo.testParquetDemo:110->testIncrementalSparkSQLQuery:424->ITTestBase.executeSparkSQLCommand:236->ITTestBase.executeCommandStringInDocker:209->ITTestBase.executeCommandInDocker:177 » Timeout
   > [INFO] 
   > [ERROR] Tests run: 11, Failures: 4, Errors: 1, Skipped: 1
   > ```
   > 
   > https://travis-ci.org/github/apache/hudi/jobs/737741946
   
   okay


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



[GitHub] [hudi] lw309637554 edited a comment on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
lw309637554 edited a comment on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-720529324


   @vinothchandar  have fixed the build break error. it is because String.split() .
   Now the pull request will be okay.


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



[GitHub] [hudi] vinothchandar merged pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
vinothchandar merged pull request #2190:
URL: https://github.com/apache/hudi/pull/2190


   


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



[GitHub] [hudi] lw309637554 closed pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
lw309637554 closed pull request #2190:
URL: https://github.com/apache/hudi/pull/2190


   


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



[GitHub] [hudi] rmpifer commented on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
rmpifer commented on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-846843202


   Can we re-open this and potentially revert or find another way to accomplish? This change is causing frequent failures in Hive real time queries. Let me give scenario:
   1. First split being read by worker contains no delta log files so no Hudi projection columns needed are set and `HOODIE_READ_COLUMNS_PROP` is set so no further changes to job configuration by Hudi.
   2. Any subsequent split read by same worker which DOES contain log files will cause query failure as required projection columns never get set


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



[GitHub] [hudi] vinothchandar commented on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-720891746


   Ah got it. thanks @lw309637554 ! 


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



[GitHub] [hudi] lw309637554 commented on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
lw309637554 commented on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-720529324


   @vinothchandar  have fixed the build break error. it is because String.split() .


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



[GitHub] [hudi] codecov-io edited a comment on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-720273452






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



[GitHub] [hudi] vinothchandar edited a comment on pull request #2190: [HUDI-892] RealtimeParquetInputFormat skip adding projection columns if there are no log files

Posted by GitBox <gi...@apache.org>.
vinothchandar edited a comment on pull request #2190:
URL: https://github.com/apache/hudi/pull/2190#issuecomment-716078386


   Okay test fails again. @lw309637554 can you please investigate. 
   
   ```
   [ERROR] Errors: 
   [ERROR]   ITTestHoodieDemo.testParquetDemo:110->testIncrementalSparkSQLQuery:424->ITTestBase.executeSparkSQLCommand:236->ITTestBase.executeCommandStringInDocker:209->ITTestBase.executeCommandInDocker:177 » Timeout
   [INFO] 
   [ERROR] Tests run: 11, Failures: 4, Errors: 1, Skipped: 1
   ```
   
   https://travis-ci.org/github/apache/hudi/jobs/737741946
   


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