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

Gianmarco De Francisci Morales updated PIG-1926:
------------------------------------------------

    Attachment: PIG-1926.patch

First implementation of the feature.
Focusing on LIMIT for now.

- Modified the grammar to *also* allow an expression in LIMIT.
    Retained old behavior and code-path for constant expressions.
    The rule is split into 2 fragments to solve problems with ANTLR's syntactic 
predicates and local variables. (see The Definitive ANTLR Reference, 14.7 
Issues with Actions and Syntactic Predicates, p.353)
- Modified LOLimit to keep also an expression plan.
    Constant expressions have priority over expression plans. (even though both 
should never be set at the same time).
- Modified LogicalPlanBuilder to allow creation of LOLimit in 2 steps.

The expression evaluation does not work yet because I need to modify POLimit 
accordingly, but it compiles, the changes do not disrupt the old behaviour and 
no runtime exception is thrown when using the new one.

Next steps:
Modify POLimit to evaluate the expression.
Evaluate which changes are required in LogToPhyTranslationVisitor to correctly 
create POLimit.
Evaluate which changes are required in TypeCheckingRelVisitor to ensure type 
safety.
Evaluate which changes are required in MRCompiler to retain correct POLimit 
compilation
  (LimitOptimizer breaks the current modifications).

There are some whitespace/format changes in the current patch due to automatic 
formatting.
Should I try to remove them?

> Sample/Limit should take scalar
> -------------------------------
>
>                 Key: PIG-1926
>                 URL: https://issues.apache.org/jira/browse/PIG-1926
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Daniel Dai
>              Labels: gsoc2011
>         Attachments: PIG-1926.patch
>
>
> Currently, Limit, Sample only takes a constant. It would be better we can use 
> a scalar in the place of constant. Eg:
> {code}
> a = load 'a.txt';
> b = group a all;
> c = foreach b generate COUNT(a) as sum;
> d = order a by $0;
> e = limit d c.sum/100;
> {code}
> This is a candidate project for Google summer of code 2011. More information 
> about the program can be found at http://wiki.apache.org/pig/GSoc2011

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

Reply via email to