Search in sources :

Example 1 with FoldTreeNode

use of com.alibaba.maxgraph.compiler.tree.FoldTreeNode in project GraphScope by alibaba.

the class CostEstimate method estimateNetworkCost.

public double estimateNetworkCost(TreeNode node) {
    if (node instanceof FoldTreeNode) {
        return NET_DEFAULT_COST * NET_DEFAULT_SCALE_RATIO * NET_FOLD_RATIO;
    } else if (node.getNodeType() == NodeType.AGGREGATE) {
        return NET_DEFAULT_COST * NET_DEFAULT_SCALE_RATIO;
    } else if (node instanceof PropertyNode) {
        PropertyNode propertyNode = (PropertyNode) node;
        Set<String> propNameList = propertyNode.getPropKeyList();
        if (propNameList.size() <= 0) {
            return NET_DEFAULT_COST * NET_DEFAULT_SCALE_RATIO * PROP_DEFAULT_COUNT;
        } else {
            return NET_DEFAULT_COST * NET_DEFAULT_SCALE_RATIO * propNameList.size();
        }
    } else if (node.getOutputValueType() instanceof VertexValueType) {
        return NET_DEFAULT_COST;
    } else {
        return NET_DEFAULT_COST * NET_DEFAULT_SCALE_RATIO;
    }
}
Also used : VertexValueType(com.alibaba.maxgraph.compiler.tree.value.VertexValueType) PropertyNode(com.alibaba.maxgraph.compiler.tree.addition.PropertyNode) FoldTreeNode(com.alibaba.maxgraph.compiler.tree.FoldTreeNode)

Aggregations

FoldTreeNode (com.alibaba.maxgraph.compiler.tree.FoldTreeNode)1 PropertyNode (com.alibaba.maxgraph.compiler.tree.addition.PropertyNode)1 VertexValueType (com.alibaba.maxgraph.compiler.tree.value.VertexValueType)1