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

Xuefu Zhang commented on PIG-1693:
----------------------------------

I have reviewed the parser related changes:

1. in LogicalPlanGenerator.g
        $expr = builder.buildRangeProjectExpr(
                    loc, plan, $GScope::currentOp,
                    $statement::inputIndex, 
                    startExpr == null ? null : startExpr.expr, 
                    endExpr == null ? null : endExpr.expr
                );

  instead of  startExpr == null ? null : startExpr.expr, just use 
$startExpr.expr.

2. LogicalPlanBuilder.java
        try {
            plan.removeAndReconnect(startExpr);
            plan.removeAndReconnect(endExpr);
        } catch (FrontendException e) {
            throw new ParserValidationException(intStream, loc, e);
        }
  It is probably better to check if startExpr and endExpr are null.

3. An observation. ProjectExpression class seems getting a little overloaded. 
We might need to consider subclass it to take care of STAR, RANGE, etc, though 
it doesn't have to happen now.



> support project-range expression. (was: There needs to be a way in foreach to 
> indicate "and all the rest of the fields" )
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: PIG-1693
>                 URL: https://issues.apache.org/jira/browse/PIG-1693
>             Project: Pig
>          Issue Type: New Feature
>          Components: impl
>            Reporter: Alan Gates
>            Assignee: Thejas M Nair
>             Fix For: 0.9.0
>
>         Attachments: PIG-1693.1.patch
>
>
> A common use case we see in Pig is people have many columns in their data and 
> they only want to operate on a few of them.  Consider for example if before 
> storing data with ten columns, the user wants to perform a cast on one column:
> {code}
> ...
> Z = foreach Y generate (int)firstcol, secondcol, thridcol, forthcol, 
> fifthcol, sixthcol, seventhcol, eigthcol, ninethcol, tenthcol;
> store Z into 'output';
> {code}
> Obviously this only gets worse as the user has more columns.  Ideally the 
> above could be transformed to something like:
> {code}
> ...
> Z = foreach Y generate (int)firstcol, "and all the rest";
> store Z into 'output'
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to