Note that there are some explanatory texts on larger screens.

plurals
  1. POCascading - merge 2 aggregations
    primarykey
    data
    text
    <p>I have the following problem whicj I am trying to solve with cascading: I have csv file of records with the structure: o,a,f,i,c</p> <p>I need to to aggregate the records by o,a,f and to sum the i's and c's per group.</p> <p>For example:</p> <p>100,200,300,5,1</p> <p>100,200,300,6,2</p> <p>101,201,301,20,5</p> <p>101,201,301,21,6</p> <p>should yield:</p> <p>100,200,300,11,3</p> <p>101,201,301,41,11</p> <p>I could not understand how to merge the 2 Every instances that I have (can I aggregate both fields in the same time?). </p> <p>Do you have any idea?</p> <p>Yosi</p> <pre><code>public class CascMain { public static void main(String[] args){ Scheme sourceScheme = new TextLine(new Fields("line")); Tap source = new Lfs(sourceScheme, "/tmp/casc/group.csv"); Scheme sinkScheme = new TextDelimited(new Fields("o", "a", "f", "ti", "tc"), ","); Tap sink = new Lfs(sinkScheme, "/tmp/casc/output/", SinkMode.REPLACE); Pipe assembly = new Pipe("agg-pipe"); Function function = new RegexSplitter(new Fields("o", "a", "f", "i", "c"), ","); assembly = new Each(assembly, new Fields("line"), function); Pipe groupAssembly = new GroupBy("group", assembly, new Fields("o", "a", "f")); Sum impSum = new Sum(new Fields("ti")); Pipe i = new Every(groupAssembly, new Fields("i"), impSum); Sum clickSum = new Sum(new Fields("tc")); Pipe c = new Every(groupAssembly, new Fields("c"), clickSum); // WHAT SHOULD I DO HERE Properties properties = new Properties(); FlowConnector.setApplicationJarClass(properties, CascMain.class); FlowConnector flowConnector = new FlowConnector(properties); Flow flow = flowConnector.connect("agg", source, sink, assembly); flow.complete(); } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload