Class AggregationNode
- java.lang.Object
-
- org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNode
-
- org.apache.iotdb.db.mpp.plan.planner.plan.node.process.ProcessNode
-
- org.apache.iotdb.db.mpp.plan.planner.plan.node.process.MultiChildNode
-
- org.apache.iotdb.db.mpp.plan.planner.plan.node.process.AggregationNode
-
- All Implemented Interfaces:
org.apache.iotdb.consensus.common.request.IConsensusRequest
public class AggregationNode extends MultiChildNode
This node is used to aggregate required series from multiple sources. The source data will be input as a TsBlock, it may be raw data or partial aggregation result. This node will output the final series aggregated result represented by TsBlock.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<AggregationDescriptor>aggregationDescriptorListprotected GroupByTimeParametergroupByTimeParameterprotected OrderingscanOrder-
Fields inherited from class org.apache.iotdb.db.mpp.plan.planner.plan.node.process.MultiChildNode
children
-
Fields inherited from class org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNode
CHILD_COUNT_NO_LIMIT, NO_CHILD_ALLOWED, ONE_CHILD
-
-
Constructor Summary
Constructors Constructor Description AggregationNode(PlanNodeId id, java.util.List<PlanNode> children, java.util.List<AggregationDescriptor> aggregationDescriptorList, GroupByTimeParameter groupByTimeParameter, Ordering scanOrder)AggregationNode(PlanNodeId id, java.util.List<AggregationDescriptor> aggregationDescriptorList, GroupByTimeParameter groupByTimeParameter, Ordering scanOrder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R,C>
Raccept(PlanVisitor<R,C> visitor, C context)voidaddChild(PlanNode child)intallowedChildCount()PlanNodeclone()static AggregationNodedeserialize(java.nio.ByteBuffer byteBuffer)booleanequals(java.lang.Object o)java.util.List<AggregationDescriptor>getAggregationDescriptorList()java.util.List<PlanNode>getChildren()static java.util.List<AggregationDescriptor>getDeduplicatedDescriptors(java.util.List<AggregationDescriptor> aggregationDescriptors)If aggregation function COUNT and AVG for one time series appears at the same time, and outputs intermediate result, the output columns will be like | COUNT | COUNT | SUM |.GroupByTimeParametergetGroupByTimeParameter()java.util.List<java.lang.String>getOutputColumnNames()OrderinggetScanOrder()inthashCode()protected voidserializeAttributes(java.io.DataOutputStream stream)protected voidserializeAttributes(java.nio.ByteBuffer byteBuffer)voidsetAggregationDescriptorList(java.util.List<AggregationDescriptor> aggregationDescriptorList)java.lang.StringtoString()-
Methods inherited from class org.apache.iotdb.db.mpp.plan.planner.plan.node.process.MultiChildNode
setChildren
-
Methods inherited from class org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNode
cloneWithChildren, getPlanNodeId, serialize, serialize, serializeToByteBuffer, setPlanNodeId
-
-
-
-
Field Detail
-
aggregationDescriptorList
protected java.util.List<AggregationDescriptor> aggregationDescriptorList
-
groupByTimeParameter
@Nullable protected GroupByTimeParameter groupByTimeParameter
-
scanOrder
protected Ordering scanOrder
-
-
Constructor Detail
-
AggregationNode
public AggregationNode(PlanNodeId id, java.util.List<AggregationDescriptor> aggregationDescriptorList, @Nullable GroupByTimeParameter groupByTimeParameter, Ordering scanOrder)
-
AggregationNode
public AggregationNode(PlanNodeId id, java.util.List<PlanNode> children, java.util.List<AggregationDescriptor> aggregationDescriptorList, @Nullable GroupByTimeParameter groupByTimeParameter, Ordering scanOrder)
-
-
Method Detail
-
getAggregationDescriptorList
public java.util.List<AggregationDescriptor> getAggregationDescriptorList()
-
getGroupByTimeParameter
@Nullable public GroupByTimeParameter getGroupByTimeParameter()
-
getScanOrder
public Ordering getScanOrder()
-
getChildren
public java.util.List<PlanNode> getChildren()
- Specified by:
getChildrenin classPlanNode
-
allowedChildCount
public int allowedChildCount()
- Specified by:
allowedChildCountin classPlanNode
-
getOutputColumnNames
public java.util.List<java.lang.String> getOutputColumnNames()
- Specified by:
getOutputColumnNamesin classPlanNode
-
setAggregationDescriptorList
public void setAggregationDescriptorList(java.util.List<AggregationDescriptor> aggregationDescriptorList)
-
accept
public <R,C> R accept(PlanVisitor<R,C> visitor, C context)
-
serializeAttributes
protected void serializeAttributes(java.nio.ByteBuffer byteBuffer)
- Specified by:
serializeAttributesin classPlanNode
-
serializeAttributes
protected void serializeAttributes(java.io.DataOutputStream stream) throws java.io.IOException- Specified by:
serializeAttributesin classPlanNode- Throws:
java.io.IOException
-
deserialize
public static AggregationNode deserialize(java.nio.ByteBuffer byteBuffer)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classMultiChildNode
-
hashCode
public int hashCode()
- Overrides:
hashCodein classMultiChildNode
-
getDeduplicatedDescriptors
public static java.util.List<AggregationDescriptor> getDeduplicatedDescriptors(java.util.List<AggregationDescriptor> aggregationDescriptors)
If aggregation function COUNT and AVG for one time series appears at the same time, and outputs intermediate result, the output columns will be like | COUNT | COUNT | SUM |. In this situation, one COUNT column is not needed. Therefore, when COUNT(or SUM) appears with AVG and outputs intermediate result(if they output final result, they will be all necessary), we need to REMOVE the COUNT aggregation, and only keep AVG function no matter their appearing order.The related functions include AVG(COUNT AND SUM), FIRST_VALUE(FIRST_VALUE AND MIN_TIME), LAST_VALUE(LAST_VALUE AND MAX_TIME).
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-