You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Koji Noguchi (JIRA)" <ji...@apache.org> on 2016/05/16 21:35:12 UTC

[jira] [Commented] (PIG-4896) Param substitution ignored when redefined

    [ https://issues.apache.org/jira/browse/PIG-4896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15285367#comment-15285367 ] 

Koji Noguchi commented on PIG-4896:
-----------------------------------

For pig 0.11 shell call, it doesn't reuse the previous result because PreprocessorContext simply compare the result of the shell call {{20160515_17:32_1463346752'}} with the shell command line {{bash \-c "date \-v\-$number +'%Y%m%d_%H:%S_%s'; sleep 1"}} and simply decides they are different. 

They should be comparing the command themselves. 

For trunk, non-shell parameter substitution is comparing {{$output.out}} and {{$output.out}} and deciding they represent the same value even though{{$output}} was different for each.  Same for its shell calls. 

> Param substitution ignored when redefined 
> ------------------------------------------
>
>                 Key: PIG-4896
>                 URL: https://issues.apache.org/jira/browse/PIG-4896
>             Project: Pig
>          Issue Type: Bug
>          Components: parser
>            Reporter: Koji Noguchi
>            Priority: Minor
>
> After PIG-3359, the way we cache parameter substitution results changed a bit.
> {code:title=test.pig}
> A = load 'input.txt' ;
> %declare output '/tmp/abc';
> %declare actualoutput '$output.out';
> store A into '$actualoutput';
> %declare output '/tmp/def';
> %declare actualoutput '$output.out';
> store A into '$actualoutput';
> %declare number '1d';
> %declare shellout `bash -c "date -v-$number +'%Y%m%d_%H:%S_%s'; sleep 1" `
> store A into '$shellout';
> %declare shellout `bash -c "date -v-$number +'%Y%m%d_%H:%S_%s'; sleep 1" `
> store A into '$shellout';
> %declare number '2d';
> %declare shellout `bash -c "date -v-$number +'%Y%m%d_%H:%S_%s'; sleep 1" `
> store A into '$shellout';
> {code}
> Result from pig 0.11 (almost correct)
> {panel}
> A = load 'input.txt' ;
> store A into '/tmp/abc.out';
> store A into '/tmp/def.out';
> store A into '20160515_17:32_1463346752';
> store A into '20160515_17:33_1463346753'; {color:red}NO{color}
> store A into '20160514_17:34_1463260354';
> {panel}
> Result from trunk 
> {panel}
> A = load 'input.txt' ;
> store A into '/tmp/abc.out';
> store A into '/tmp/abc.out';  {color:red} NO{color}
> store A into '20160515_15:10_1463338810';
> store A into '20160515_15:10_1463338810';
> store A into '20160515_15:10_1463338810'; {color:red}NO{color}
> {panel}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)