cascading.pipe.assembly
Class CountBy

java.lang.Object
  extended by cascading.pipe.Pipe
      extended by cascading.pipe.SubAssembly
          extended by cascading.pipe.assembly.AggregateBy
              extended by cascading.pipe.assembly.CountBy
All Implemented Interfaces:
FlowElement, Serializable

public class CountBy
extends AggregateBy

Class CountBy is used to count duplicates in a tuple stream.

Typically finding the count of a field in a tuple stream relies on a GroupBy and a Count Aggregator operation.

This SubAssembly also uses the CountBy.CountPartials AggregateBy.Functor to count field values before the GroupBy operator to reduce IO over the network.

This strategy is similar to using combiners, except no sorting or serialization is invoked and results in a much simpler mechanism.

The threshold value tells the underlying CountPartials functions how many unique key counts to accumulate in the LRU cache, before emitting the least recently used entry.

See Also:
AggregateBy, Serialized Form

Nested Class Summary
static class CountBy.CountPartials
          Class CountPartials is a AggregateBy.Functor that is used to count observed duplicates from the tuple stream.
 
Nested classes/interfaces inherited from class cascading.pipe.assembly.AggregateBy
AggregateBy.CompositeFunction, AggregateBy.Flush, AggregateBy.Functor
 
Field Summary
 
Fields inherited from class cascading.pipe.assembly.AggregateBy
AGGREGATE_BY_THRESHOLD
 
Fields inherited from class cascading.pipe.Pipe
configDef, previous, stepConfigDef
 
Constructor Summary
CountBy(Fields countField)
          Constructor CountBy creates a new CountBy instance.
CountBy(Pipe[] pipes, Fields groupingFields, Fields countField)
          Constructor CountBy creates a new CountBy instance.
CountBy(Pipe[] pipes, Fields groupingFields, Fields countField, int threshold)
          Constructor CountBy creates a new CountBy instance.
CountBy(Pipe pipe, Fields groupingFields, Fields countField)
          Constructor CountBy creates a new CountBy instance.
CountBy(Pipe pipe, Fields groupingFields, Fields countField, int threshold)
          Constructor CountBy creates a new CountBy instance.
CountBy(String name, Pipe[] pipes, Fields groupingFields, Fields countField)
          Constructor CountBy creates a new CountBy instance.
CountBy(String name, Pipe[] pipes, Fields groupingFields, Fields countField, int threshold)
          Constructor CountBy creates a new CountBy instance.
CountBy(String name, Pipe pipe, Fields groupingFields, Fields countField)
          Constructor CountBy creates a new CountBy instance.
CountBy(String name, Pipe pipe, Fields groupingFields, Fields countField, int threshold)
          Constructor CountBy creates a new CountBy instance.
 
Method Summary
 
Methods inherited from class cascading.pipe.assembly.AggregateBy
getAggregators, getArgumentFields, getFunctors, getGroupBy, initialize, initialize, verify
 
Methods inherited from class cascading.pipe.SubAssembly
getConfigDef, getName, getPrevious, getStepConfigDef, getTailNames, getTails, setTails, unwind
 
Methods inherited from class cascading.pipe.Pipe
equals, getHeads, getTrace, hasConfigDef, hashCode, hasStepConfigDef, isEquivalentTo, named, names, outgoingScopeFor, pipes, print, printInternal, resolveIncomingOperationArgumentFields, resolveIncomingOperationPassThroughFields, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CountBy

@ConstructorProperties(value="countField")
public CountBy(Fields countField)
Constructor CountBy creates a new CountBy instance. Use this constructor when used with a AggregateBy instance.

Parameters:
countField - of type Fields

CountBy

@ConstructorProperties(value={"pipe","groupingFields","countField"})
public CountBy(Pipe pipe,
                                          Fields groupingFields,
                                          Fields countField)
Constructor CountBy creates a new CountBy instance.

Parameters:
pipe - of type Pipe
groupingFields - of type Fields
countField - of type Fields

CountBy

@ConstructorProperties(value={"pipe","groupingFields","countField","threshold"})
public CountBy(Pipe pipe,
                                          Fields groupingFields,
                                          Fields countField,
                                          int threshold)
Constructor CountBy creates a new CountBy instance.

Parameters:
pipe - of type Pipe
groupingFields - of type Fields
countField - fo type Fields
threshold - of type int

CountBy

@ConstructorProperties(value={"name","pipe","groupingFields","countField"})
public CountBy(String name,
                                          Pipe pipe,
                                          Fields groupingFields,
                                          Fields countField)
Constructor CountBy creates a new CountBy instance.

Parameters:
name - of type String
pipe - of type Pipe
groupingFields - of type Fields
countField - of type Fields

CountBy

@ConstructorProperties(value={"name","pipe","groupingFields","countField","threshold"})
public CountBy(String name,
                                          Pipe pipe,
                                          Fields groupingFields,
                                          Fields countField,
                                          int threshold)
Constructor CountBy creates a new CountBy instance.

Parameters:
name - of type String
pipe - of type Pipe
groupingFields - of type Fields
countField - of type Fields
threshold - of type int

CountBy

@ConstructorProperties(value={"pipes","groupingFields","countField"})
public CountBy(Pipe[] pipes,
                                          Fields groupingFields,
                                          Fields countField)
Constructor CountBy creates a new CountBy instance.

Parameters:
pipes - of type Pipe[]
groupingFields - of type Fields
countField - of type Fields

CountBy

@ConstructorProperties(value={"pipes","groupingFields","countField","threshold"})
public CountBy(Pipe[] pipes,
                                          Fields groupingFields,
                                          Fields countField,
                                          int threshold)
Constructor CountBy creates a new CountBy instance.

Parameters:
pipes - of type Pipe[]
groupingFields - of type Fields
countField - of type Fields
threshold - of type int

CountBy

@ConstructorProperties(value={"name","pipes","groupingFields","countField"})
public CountBy(String name,
                                          Pipe[] pipes,
                                          Fields groupingFields,
                                          Fields countField)
Constructor CountBy creates a new CountBy instance.

Parameters:
name - of type String
pipes - of type Pipe[]
groupingFields - of type Fields
countField - of type Fields

CountBy

@ConstructorProperties(value={"name","pipes","groupingFields","countField","threshold"})
public CountBy(String name,
                                          Pipe[] pipes,
                                          Fields groupingFields,
                                          Fields countField,
                                          int threshold)
Constructor CountBy creates a new CountBy instance.

Parameters:
name - of type String
pipes - of type Pipe[]
groupingFields - of type Fields
countField - of type Fields
threshold - of type int


Copyright © 2007-2012 Concurrent, Inc. All Rights Reserved.