[
https://issues.apache.org/jira/browse/PIG-5311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16304806#comment-16304806
]
Koji Noguchi commented on PIG-5311:
-----------------------------------
First time looking at sampling.
I need to test it myself but two questions.
\(i) Unrelated to this patch, but
{code:java}
118 if (res == null || res.returnStatus != POStatus.STATUS_EOP) {
119 Random randGen = new Random();
{code}
Do we need to set the seed like we did in PIG-4819 ?
(ii)
{code:java}
182 private Result retrieveSample() throws ExecException {
183 if(nextSampleIdx < Math.min(rowProcessed, samples.length)){
...
193 }
194 else{
195 samples = null; // Free memory
196 return RESULT_EOP;
197 }
{code}
When rowProcessed is wrapped around to a negative number, wouldn't this always
return null ?
> POReservoirSample fails for more than Integer.MAX_VALUE records
> ---------------------------------------------------------------
>
> Key: PIG-5311
> URL: https://issues.apache.org/jira/browse/PIG-5311
> Project: Pig
> Issue Type: Bug
> Reporter: Rohini Palaniswamy
> Assignee: Rohini Palaniswamy
> Fix For: 0.18.0
>
> Attachments: PIG-5311-1.patch
>
>
> https://github.com/apache/pig/blob/branch-0.17/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POReservoirSample.java#L128
> The rowProcessed is a int. When it exceeds the int range it wraps around and
> becomes a negative number throwing below exception. It needs to be changed to
> long.
> {code}
> Caused by: java.lang.IllegalArgumentException: bound must be positive
> at java.util.Random.nextInt(Random.java:388)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POReservoirSample.getNextTuple(POReservoirSample.java:128)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.processInput(PhysicalOperator.java:305)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.getNextTuple(POForEach.java:284)
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)