[
https://issues.apache.org/jira/browse/HUDI-374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
leesf closed HUDI-374.
----------------------
Fix Version/s: 0.5.1
Resolution: Fixed
Fixed via master: b65a897856259e7872e39a9e3e68661926592d7b
> 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
> Fix For: 0.5.1
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> {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)