> On Sept. 29, 2014, 12:56 a.m., Matthew Hayes wrote: > > > > Russell Jurney wrote: > Actually, I think renaming this to SelectStringFieldByName might make > more sense. The way this UDF is used, you are looking for a tag that > identifies a group. These are almost always chararrays. This doesn't limit > the usefulness of the UDF at all. > > Matthew Hayes wrote: > I like the new name ;) I still think we need to have a schema for the > output. For example, you could set the output schema to consist of a single > chararray value and require that all inputs be chararrays. This should be > simple to do for now. If we find that this is needed for other non-chararray > cases we could relax the requirements. > > Russell Jurney wrote: > Yeah, I agree. I'll have it return a chararray inside a tuple, in > addition to changing the name.
Okay sounds good. chararray in a tuple as the schema seems fine. Also validate in getSchema that the inputs are chararray as well. - Matthew ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/25564/#review54788 ----------------------------------------------------------- On Oct. 2, 2014, 4:19 p.m., Russell Jurney wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/25564/ > ----------------------------------------------------------- > > (Updated Oct. 2, 2014, 4:19 p.m.) > > > Review request for DataFu, Jonathan Coveney, Jakob Homan, Matthew Hayes, and > Sam Shah. > > > Repository: datafu > > > Description > ------- > > Example use: > group_fields = LOAD '/e8/smalldata/group_fields.txt' AS > (groupField:chararray); > with_group = CROSS group_fields, hour_rounded; > with_group = FOREACH with_group GENERATE group_fields::groupField AS > groupField, > hour_rounded::sourceNameOrIp AS sourceNameOrIp, > hour_rounded::destinationNameOrIp AS destinationNameOrIp, > ...; > with_value_substitution = FOREACH with_group GENERATE > ChooseFieldByValue(groupField, *) AS groupValue:tuple(value:chararray), *; > with_value_substitution = FOREACH with_value_substitution GENERATE > FLATTEN(groupValue) AS groupValue:chararray, > groupField, > foo, > bar, > ...; > all_success = FOREACH (GROUP with_value_substitution BY (groupField, > groupValue, day)) GENERATE > FLATTEN(group) AS (seriesType, groupValue, day), > (int)COUNT_STAR(with_value_substitution) AS connections:int; > > > Diffs > ----- > > datafu-pig/src/main/java/datafu/pig/util/SelectFieldByName.java > PRE-CREATION > datafu-pig/src/test/java/datafu/test/pig/util/SelectFieldByNameTest.java > PRE-CREATION > > Diff: https://reviews.apache.org/r/25564/diff/ > > > Testing > ------- > > This UDF was used to replace a very inefficient pig script where macros that > did many individual GROUP BY's took many minutes to plan. > > Testing: unit tests and used on real data on a cluster. > > > Thanks, > > Russell Jurney > >