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 2019/11/28 09:19:20 UTC

[GitHub] [incubator-hudi] hddong opened a new pull request #1059: [HUDI-374] Unable to generateUpdates in QuickstartUtils

hddong opened a new pull request #1059: [HUDI-374] Unable to generateUpdates in QuickstartUtils
URL: https://github.com/apache/incubator-hudi/pull/1059
 
 
   ## *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
   
   *Fix unable to generateUpdates in QuickstartUtils*
   ```
   scala> convertToStringList(dataGen.generateInserts(1))
   res0: java.util.List[String] = [{"ts": 0.0, "uuid": "78956d3a-c13b-4871-8b14-596b2a7e11d9", "rider": "rider-213", "driver": "driver-213", "begin_lat": 0.4726905879569653, "begin_lon": 0.46157858450465483, "end_lat": 0.754803407008858, "end_lon": 0.9671159942018241, "fare": 34.158284716382845, "partitionpath": "americas/brazil/sao_paulo"}]
   
   
   scala> convertToStringList(dataGen.generateUpdates(1))
   java.lang.IllegalArgumentException: bound must be positive
     at java.util.Random.nextInt(Random.java:388)
     at org.apache.hudi.QuickstartUtils$DataGenerator.generateUpdates(QuickstartUtils.java:163)
     ... 73 elided
   ```
   When `numExistingKeys = 1`, `rand.nextInt(numExistingKeys - 1 )`  is equivalent to `rand.nextInt(0)` and bound of nextInt() must be  positive.  On the other hand,  the range of nextInt is [0, numExistingKeys),  rand.nextInt(numExistingKeys) here is right.
   
   ## Brief change log
   
   *(for example:)*
     - *Modify QuickstartUtils*
   
   ## Verify this pull request
   
   This pull request is a trivial rework / code cleanup without any test coverage.
   
   ## 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


With regards,
Apache Git Services