use of com.alibaba.maxgraph.compiler.tree.AndTreeNode in project GraphScope by alibaba.
the class LabelPushDownStrategy method apply.
@Override
public void apply(TreeManager treeManager) {
while (true) {
BaseTreeNode treeNode = (BaseTreeNode) TreeNodeUtils.getSourceTreeNode(treeManager.getTreeLeaf());
boolean labelOptimizeFlag = false;
while (true) {
Map<QueryFlowOuterClass.RequirementType, Object> afterRequirementList = treeNode.getAfterRequirementList();
BaseTreeNode outputNode = (BaseTreeNode) treeNode.getOutputNode();
if (null != outputNode && !(outputNode instanceof RepeatTreeNode) && !(outputNode instanceof UnionTreeNode) && !(outputNode instanceof AndTreeNode) && !(outputNode instanceof WherePredicateTreeNode) && outputNode.getNodeType() != NodeType.AGGREGATE) {
Set<String> labelList = (Set<String>) afterRequirementList.remove(QueryFlowOuterClass.RequirementType.LABEL_START);
if (null != labelList) {
labelOptimizeFlag = true;
outputNode.getBeforeRequirementList().put(QueryFlowOuterClass.RequirementType.LABEL_START, labelList);
}
}
if (outputNode == null) {
break;
}
treeNode = outputNode;
}
if (!labelOptimizeFlag) {
break;
}
}
}
Aggregations