You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2019/11/28 09:20:00 UTC

[jira] [Updated] (HUDI-374) Unable to generateUpdates in QuickstartUtils

     [ https://issues.apache.org/jira/browse/HUDI-374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated HUDI-374:
--------------------------------
    Labels: pull-request-available  (was: )

> Unable to generateUpdates in QuickstartUtils
> --------------------------------------------
>
>                 Key: HUDI-374
>                 URL: https://issues.apache.org/jira/browse/HUDI-374
>             Project: Apache Hudi (incubating)
>          Issue Type: Bug
>          Components: Spark datasource
>            Reporter: hong dongdong
>            Priority: Major
>              Labels: pull-request-available
>
> {code:java}
> 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
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)