pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheolsoo Park (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PIG-3941) Piggybank's Over UDF returns an output schema with named fields
Date Mon, 19 May 2014 21:55:40 GMT

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

Cheolsoo Park updated PIG-3941:
-------------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

Committed to trunk. Thank you Philip!

> Piggybank's Over UDF returns an output schema with named fields
> ---------------------------------------------------------------
>
>                 Key: PIG-3941
>                 URL: https://issues.apache.org/jira/browse/PIG-3941
>             Project: Pig
>          Issue Type: Improvement
>          Components: piggybank
>            Reporter: Philip (flip) Kromer
>            Assignee: Philip (flip) Kromer
>            Priority: Minor
>              Labels: piggybank, schema, udf, window
>             Fix For: 0.13.0
>
>         Attachments: 0001-Over-accepts-a-field-spec-name-and-type-separated-by.patch
>
>
> With attached patch, if Over is constructed with a colon-delimited string like 'bob:int',
the first part is used to set the return field's name and the second part its type. Otherwise,
if a type is given the name of the return field is set to 'result'.
> {code}
> cities = LOAD 'us_city_pops.tsv' AS (city:chararray, state:chararray, pop:int);
> DEFINE IOver                  org.apache.pig.piggybank.evaluation.Over('state_rk:int');
> ranked = FOREACH(GROUP cities BY state) {
>   c_ord = ORDER cities BY pop DESC;
>   GENERATE FLATTEN(Stitch(c_ord,
>     IOver(c_ord, 'rank', -1, -1, 2))); -- beginning (-1) to end (-1) on third field (2)
> };
> DESCRIBE ranked;
> -- ranked: {stitched::city: chararray,stitched::state: chararray,stitched::pop: int,stitched::state_rk:
int}
> DUMP ranked;
> -- ...
> -- (Nashville,Tennessee,609644,2)
> -- (Houston,Texas,2145146,1)
> -- (San Antonio,Texas,1359758,2)
> -- (Dallas,Texas,1223229,3)
> -- (Austin,Texas,820611,4)
> -- ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message