print group id for physical plan node (#17742)
This commit is contained in:
@ -183,4 +183,15 @@ public abstract class AbstractPlan extends AbstractTreeNode<Plan> implements Pla
|
||||
public void setMutableState(String key, Object state) {
|
||||
this.mutableState = this.mutableState.set(key, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* used in treeString()
|
||||
* @return "" if groupExpression is empty, o.w. string format of group id
|
||||
*/
|
||||
public String getGroupIdAsString() {
|
||||
String groupId = getGroupExpression().isPresent()
|
||||
? "#" + getGroupExpression().get().getOwnerGroup().getGroupId().asInt()
|
||||
: "";
|
||||
return groupId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public class PhysicalAssertNumRows<CHILD_TYPE extends Plan> extends PhysicalUnar
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalAssertNumRows",
|
||||
return Utils.toSqlString("PhysicalAssertNumRows" + getGroupIdAsString(),
|
||||
"assertNumRowsElement", assertNumRowsElement);
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ public class PhysicalAssertNumRows<CHILD_TYPE extends Plan> extends PhysicalUnar
|
||||
@Override
|
||||
public PhysicalAssertNumRows<CHILD_TYPE> withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalAssertNumRows<>(assertNumRowsElement, Optional.empty(),
|
||||
return new PhysicalAssertNumRows<>(assertNumRowsElement, groupExpression,
|
||||
getLogicalProperties(), physicalProperties, statistics, child());
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ public class PhysicalDistribute<CHILD_TYPE extends Plan> extends PhysicalUnary<C
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalDistribute[" + id.asInt() + "]",
|
||||
return Utils.toSqlString("PhysicalDistribute[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"distributionSpec", distributionSpec,
|
||||
"stats", statistics
|
||||
);
|
||||
@ -102,7 +102,7 @@ public class PhysicalDistribute<CHILD_TYPE extends Plan> extends PhysicalUnary<C
|
||||
@Override
|
||||
public PhysicalDistribute<CHILD_TYPE> withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalDistribute<>(distributionSpec, Optional.empty(),
|
||||
return new PhysicalDistribute<>(distributionSpec, groupExpression,
|
||||
getLogicalProperties(), physicalProperties, statistics, child());
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ public class PhysicalFilter<CHILD_TYPE extends Plan> extends PhysicalUnary<CHILD
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalFilter[" + id.asInt() + "]",
|
||||
return Utils.toSqlString("PhysicalFilter[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"predicates", getPredicate(),
|
||||
"stats", statistics
|
||||
);
|
||||
@ -120,7 +120,7 @@ public class PhysicalFilter<CHILD_TYPE extends Plan> extends PhysicalUnary<CHILD
|
||||
@Override
|
||||
public PhysicalFilter<CHILD_TYPE> withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalFilter<>(conjuncts, Optional.empty(), getLogicalProperties(), physicalProperties,
|
||||
return new PhysicalFilter<>(conjuncts, groupExpression, getLogicalProperties(), physicalProperties,
|
||||
statistics, child());
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ public class PhysicalHashAggregate<CHILD_TYPE extends Plan> extends PhysicalUnar
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalHashAggregate[" + id.asInt() + "]",
|
||||
return Utils.toSqlString("PhysicalHashAggregate[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"aggPhase", aggregateParam.aggPhase,
|
||||
"aggMode", aggregateParam.aggMode,
|
||||
"maybeUseStreaming", maybeUsingStream,
|
||||
@ -249,7 +249,7 @@ public class PhysicalHashAggregate<CHILD_TYPE extends Plan> extends PhysicalUnar
|
||||
public PhysicalHashAggregate<CHILD_TYPE> withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalHashAggregate<>(groupByExpressions, outputExpressions, partitionExpressions,
|
||||
aggregateParam, maybeUsingStream, Optional.empty(), getLogicalProperties(),
|
||||
aggregateParam, maybeUsingStream, groupExpression, getLogicalProperties(),
|
||||
requireProperties, physicalProperties, statistics,
|
||||
child());
|
||||
}
|
||||
@ -257,7 +257,7 @@ public class PhysicalHashAggregate<CHILD_TYPE extends Plan> extends PhysicalUnar
|
||||
@Override
|
||||
public PhysicalHashAggregate<CHILD_TYPE> withAggOutput(List<NamedExpression> newOutput) {
|
||||
return new PhysicalHashAggregate<>(groupByExpressions, newOutput, partitionExpressions,
|
||||
aggregateParam, maybeUsingStream, Optional.empty(), getLogicalProperties(),
|
||||
aggregateParam, maybeUsingStream, groupExpression, getLogicalProperties(),
|
||||
requireProperties, physicalProperties, statistics, child());
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,8 @@ public class PhysicalHashJoin<
|
||||
args.add("hint");
|
||||
args.add(hint);
|
||||
}
|
||||
return Utils.toSqlString("PhysicalHashJoin[" + id.asInt() + "]", args.toArray());
|
||||
return Utils.toSqlString("PhysicalHashJoin[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
args.toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -142,6 +143,6 @@ public class PhysicalHashJoin<
|
||||
public PhysicalHashJoin<LEFT_CHILD_TYPE, RIGHT_CHILD_TYPE> withPhysicalPropertiesAndStats(
|
||||
PhysicalProperties physicalProperties, Statistics statistics) {
|
||||
return new PhysicalHashJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint, markJoinSlotReference,
|
||||
Optional.empty(), getLogicalProperties(), physicalProperties, statistics, left(), right());
|
||||
groupExpression, getLogicalProperties(), physicalProperties, statistics, left(), right());
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ public class PhysicalLimit<CHILD_TYPE extends Plan> extends PhysicalUnary<CHILD_
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalLimit",
|
||||
return Utils.toSqlString("PhysicalLimit[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"limit", limit,
|
||||
"offset", offset,
|
||||
"phase", phase,
|
||||
|
||||
@ -115,7 +115,7 @@ public class PhysicalNestedLoopJoin<
|
||||
@Override
|
||||
public String toString() {
|
||||
// TODO: Maybe we could pull up this to the abstract class in the future.
|
||||
return Utils.toSqlString("PhysicalNestedLoopJoin",
|
||||
return Utils.toSqlString("PhysicalNestedLoopJoin[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"type", joinType,
|
||||
"otherJoinCondition", otherJoinConjuncts,
|
||||
"isMarkJoin", markJoinSlotReference.isPresent(),
|
||||
@ -151,7 +151,7 @@ public class PhysicalNestedLoopJoin<
|
||||
public PhysicalNestedLoopJoin<LEFT_CHILD_TYPE, RIGHT_CHILD_TYPE> withPhysicalPropertiesAndStats(
|
||||
PhysicalProperties physicalProperties, Statistics statistics) {
|
||||
return new PhysicalNestedLoopJoin<>(joinType,
|
||||
hashJoinConjuncts, otherJoinConjuncts, markJoinSlotReference, Optional.empty(),
|
||||
hashJoinConjuncts, otherJoinConjuncts, markJoinSlotReference, groupExpression,
|
||||
getLogicalProperties(), physicalProperties, statistics, left(), right());
|
||||
}
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ public class PhysicalOlapScan extends PhysicalRelation implements OlapScan {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalOlapScan",
|
||||
return Utils.toSqlString("PhysicalOlapScan[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"qualified", Utils.qualifiedName(qualifier, olapTable.getName()),
|
||||
"output", getOutput(),
|
||||
"stats", statistics
|
||||
@ -158,7 +158,7 @@ public class PhysicalOlapScan extends PhysicalRelation implements OlapScan {
|
||||
public PhysicalOlapScan withPhysicalPropertiesAndStats(
|
||||
PhysicalProperties physicalProperties, Statistics statistics) {
|
||||
return new PhysicalOlapScan(id, olapTable, qualifier, selectedIndexId, selectedTabletIds,
|
||||
selectedPartitionIds, distributionSpec, preAggStatus, Optional.empty(),
|
||||
selectedPartitionIds, distributionSpec, preAggStatus, groupExpression,
|
||||
getLogicalProperties(), physicalProperties, statistics);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ public class PhysicalOneRowRelation extends PhysicalLeaf implements OneRowRelati
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalOneRowRelation",
|
||||
return Utils.toSqlString("PhysicalOneRowRelation[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"expressions", projects,
|
||||
"buildUnionNode", buildUnionNode
|
||||
);
|
||||
@ -116,7 +116,7 @@ public class PhysicalOneRowRelation extends PhysicalLeaf implements OneRowRelati
|
||||
@Override
|
||||
public PhysicalOneRowRelation withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalOneRowRelation(projects, buildUnionNode, Optional.empty(),
|
||||
return new PhysicalOneRowRelation(projects, buildUnionNode, groupExpression,
|
||||
logicalPropertiesSupplier.get(), physicalProperties, statistics);
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ public class PhysicalProject<CHILD_TYPE extends Plan> extends PhysicalUnary<CHIL
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalProject[" + id.asInt() + "]",
|
||||
return Utils.toSqlString("PhysicalProject[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"projects", projects,
|
||||
"stats", statistics
|
||||
);
|
||||
@ -119,7 +119,7 @@ public class PhysicalProject<CHILD_TYPE extends Plan> extends PhysicalUnary<CHIL
|
||||
@Override
|
||||
public PhysicalProject<CHILD_TYPE> withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalProject<>(projects, Optional.empty(), getLogicalProperties(), physicalProperties,
|
||||
return new PhysicalProject<>(projects, groupExpression, getLogicalProperties(), physicalProperties,
|
||||
statistics, child());
|
||||
}
|
||||
|
||||
|
||||
@ -91,13 +91,13 @@ public class PhysicalQuickSort<CHILD_TYPE extends Plan> extends AbstractPhysical
|
||||
@Override
|
||||
public PhysicalQuickSort<CHILD_TYPE> withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalQuickSort<>(orderKeys, phase, Optional.empty(), getLogicalProperties(), physicalProperties,
|
||||
return new PhysicalQuickSort<>(orderKeys, phase, groupExpression, getLogicalProperties(), physicalProperties,
|
||||
statistics, child());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalQuickSort",
|
||||
return Utils.toSqlString("PhysicalQuickSort[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"orderKeys", orderKeys,
|
||||
"phase", phase.toString()
|
||||
);
|
||||
|
||||
@ -92,7 +92,7 @@ public class PhysicalRepeat<CHILD_TYPE extends Plan> extends PhysicalUnary<CHILD
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalRepeat",
|
||||
return Utils.toSqlString("PhysicalRepeat[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"groupingSets", groupingSets,
|
||||
"outputExpressions", outputExpressions,
|
||||
"stats", statistics
|
||||
@ -160,7 +160,7 @@ public class PhysicalRepeat<CHILD_TYPE extends Plan> extends PhysicalUnary<CHILD
|
||||
@Override
|
||||
public PhysicalRepeat<CHILD_TYPE> withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalRepeat<>(groupingSets, outputExpressions, Optional.empty(),
|
||||
return new PhysicalRepeat<>(groupingSets, outputExpressions, groupExpression,
|
||||
getLogicalProperties(), physicalProperties, statistics, child());
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ public class PhysicalStorageLayerAggregate extends PhysicalRelation {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalStorageLayerAggregate",
|
||||
return Utils.toSqlString("PhysicalStorageLayerAggregate[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"pushDownAggOp", aggOp,
|
||||
"relation", relation,
|
||||
"stats", statistics
|
||||
@ -131,7 +131,7 @@ public class PhysicalStorageLayerAggregate extends PhysicalRelation {
|
||||
@Override
|
||||
public PhysicalPlan withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalStorageLayerAggregate(relation, aggOp, Optional.empty(),
|
||||
return new PhysicalStorageLayerAggregate(relation, aggOp, groupExpression,
|
||||
getLogicalProperties(), physicalProperties, statistics);
|
||||
}
|
||||
|
||||
|
||||
@ -125,13 +125,13 @@ public class PhysicalTopN<CHILD_TYPE extends Plan> extends AbstractPhysicalSort<
|
||||
@Override
|
||||
public PhysicalTopN<CHILD_TYPE> withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalTopN<>(orderKeys, limit, offset, phase, Optional.empty(),
|
||||
return new PhysicalTopN<>(orderKeys, limit, offset, phase, groupExpression,
|
||||
getLogicalProperties(), physicalProperties, statistics, child());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalTopN",
|
||||
return Utils.toSqlString("PhysicalTopN[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"limit", limit,
|
||||
"offset", offset,
|
||||
"orderKeys", orderKeys,
|
||||
|
||||
@ -61,7 +61,7 @@ public class PhysicalUnion extends PhysicalSetOperation {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalUnion",
|
||||
return Utils.toSqlString("PhysicalUnion" + getGroupIdAsString(),
|
||||
"qualifier", qualifier,
|
||||
"stats", statistics);
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public class PhysicalWindow<CHILD_TYPE extends Plan> extends PhysicalUnary<CHILD
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toSqlString("PhysicalWindow[" + id.asInt() + "]",
|
||||
return Utils.toSqlString("PhysicalWindow[" + id.asInt() + "]" + getGroupIdAsString(),
|
||||
"windowFrameGroup", windowFrameGroup,
|
||||
"requiredProperties", requireProperties
|
||||
);
|
||||
@ -146,7 +146,7 @@ public class PhysicalWindow<CHILD_TYPE extends Plan> extends PhysicalUnary<CHILD
|
||||
@Override
|
||||
public PhysicalPlan withPhysicalPropertiesAndStats(PhysicalProperties physicalProperties,
|
||||
Statistics statistics) {
|
||||
return new PhysicalWindow<>(windowFrameGroup, requireProperties, Optional.empty(),
|
||||
return new PhysicalWindow<>(windowFrameGroup, requireProperties, groupExpression,
|
||||
getLogicalProperties(), physicalProperties, statistics, child());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user