Package com.yahoo.searchlib.aggregation
Class AggregationResult
- java.lang.Object
-
- com.yahoo.vespa.objects.Selectable
-
- com.yahoo.vespa.objects.Identifiable
-
- com.yahoo.searchlib.expression.ExpressionNode
-
- com.yahoo.searchlib.aggregation.AggregationResult
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
AverageAggregationResult
,CountAggregationResult
,ExpressionCountAggregationResult
,HitsAggregationResult
,MaxAggregationResult
,MinAggregationResult
,StandardDeviationAggregationResult
,SumAggregationResult
,XorAggregationResult
public abstract class AggregationResult extends ExpressionNode
The result of some aggregation- Author:
- baldersheim, Simon Thoresen Hult
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
classId
-
Constructor Summary
Constructors Constructor Description AggregationResult()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AggregationResult
clone()
protected abstract boolean
equalsAggregation(AggregationResult obj)
protected boolean
equalsExpression(ExpressionNode obj)
ExpressionNode
getExpression()
Returns the expression to aggregate on.abstract ResultNode
getRank()
Returns a value that can be used for ranking.ResultNode
getResult()
Get the result of this expression.int
getTag()
Returns the tag of this aggregation result.void
merge(AggregationResult result)
Called when merging aggregation results.protected void
onDeserialize(com.yahoo.vespa.objects.Deserializer buf)
boolean
onExecute()
protected int
onGetClassId()
protected abstract void
onMerge(AggregationResult result)
Mmust be implemented by subclasses to support merge.void
onPrepare()
protected void
onSerialize(com.yahoo.vespa.objects.Serializer buf)
void
postMerge()
Hook called when all aggregation results have been merged.AggregationResult
setExpression(ExpressionNode exp)
Sets the expression to aggregate on.AggregationResult
setTag(int tag)
Assigns a tag to this group.void
visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor)
-
Methods inherited from class com.yahoo.searchlib.expression.ExpressionNode
equals, execute, executeIterative, onArgument, prepare
-
-
-
-
Method Detail
-
getTag
public int getTag()
Returns the tag of this aggregation result. This is useful for uniquely identifying a result.- Returns:
- The numerical tag.
-
setTag
public AggregationResult setTag(int tag)
Assigns a tag to this group.- Parameters:
tag
- the numerical tag to set.- Returns:
- this, to allow chaining.
-
merge
public void merge(AggregationResult result)
Called when merging aggregation results. This method is simply a proxy for the abstractonMerge(AggregationResult)
method.- Parameters:
result
- the result to merge with.
-
postMerge
public void postMerge()
Hook called when all aggregation results have been merged. This method can be overloaded by subclasses that need special behaviour to occur after merge.
-
getRank
public abstract ResultNode getRank()
Returns a value that can be used for ranking.
-
setExpression
public AggregationResult setExpression(ExpressionNode exp)
Sets the expression to aggregate on.- Parameters:
exp
- the expression- Returns:
- this, to allow chaining
-
getExpression
public ExpressionNode getExpression()
Returns the expression to aggregate on.
-
onMerge
protected abstract void onMerge(AggregationResult result)
Mmust be implemented by subclasses to support merge. It is called as themerge(AggregationResult)
method is invoked.- Parameters:
result
- the result to merge with
-
getResult
public ResultNode getResult()
Description copied from class:ExpressionNode
Get the result of this expression.- Specified by:
getResult
in classExpressionNode
- Returns:
- the result as a ResultNode.
-
onPrepare
public void onPrepare()
- Overrides:
onPrepare
in classExpressionNode
-
onExecute
public boolean onExecute()
- Overrides:
onExecute
in classExpressionNode
-
onGetClassId
protected int onGetClassId()
- Overrides:
onGetClassId
in classExpressionNode
-
onSerialize
protected void onSerialize(com.yahoo.vespa.objects.Serializer buf)
- Overrides:
onSerialize
in classExpressionNode
-
onDeserialize
protected void onDeserialize(com.yahoo.vespa.objects.Deserializer buf)
- Overrides:
onDeserialize
in classExpressionNode
-
clone
public AggregationResult clone()
- Overrides:
clone
in classExpressionNode
-
equalsExpression
protected final boolean equalsExpression(ExpressionNode obj)
- Specified by:
equalsExpression
in classExpressionNode
-
equalsAggregation
protected abstract boolean equalsAggregation(AggregationResult obj)
-
visitMembers
public void visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor)
- Overrides:
visitMembers
in classExpressionNode
-
-