kylin-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 仇同心 <qiutong...@jd.com>
Subject 答复: which cube to use when u build many cubes under a model
Date Wed, 14 Sep 2016 06:16:00 GMT
     Kylin completed a customized Adapter, completed in Calcite SQL parsing, forming a syntax
tree (AST), defined by Kylin syntax tree each node query execution rules.Calcite after traversal
syntax tree node generated a Kylin describe the Digest of the query model, Kylin will Digest
to judge whether there is a match for this Cube.If there is a Cube with the query matching,
that is, to choose a minimum Cost of query to query the Cube (KylinCube query Cost calculation
is an open interface, can according to the number of dimensions, can be based on the quantity
to calculate Cost data)

In CubeInstance.java:

You  can see:
      @Override
    public CapabilityResult isCapable(SQLDigest digest) {
        CapabilityResult result = CubeCapabilityChecker.check(this, digest);
        if (result.capable) {
            result.cost = getCost(digest);
            for (CapabilityInfluence i : result.influences) {
                result.cost *= (i.suggestCostMultiplier() == 0) ? 1.0 : i.suggestCostMultiplier();
            }
        } else {
            result.cost = -1;
        }
        return result;
    }

    private int getCost(SQLDigest digest) {
        int calculatedCost = cost;

        //the number of dimensions is not as accurate as number of row key cols
        calculatedCost += getRowKeyColumnCount() * COST_WEIGHT_DIMENSION + getMeasures().size()
* COST_WEIGHT_MEASURE;

        for (LookupDesc lookupDesc : this.getDescriptor().getModel().getLookups()) {
            // more tables, more cost
            if ("inner".equals(lookupDesc.getJoin().getType())) {
                // inner join cost is bigger than left join, as it will filter some records
                calculatedCost += COST_WEIGHT_INNER_JOIN;
            }
        }

        return calculatedCost;
    }

发件人: Mars J [mailto:xujiao.mycafe@gmail.com]
发送时间: 2016年9月13日 15:04
收件人: user@kylin.apache.org
主题: which cube to use when u build many cubes under a model

Hi ,
     I'm every curious about that if I define and build many cubes under one specific model,
e.g cube1,cube2,cube3, these cubes may have same dimensions, so if a query invole such a dimension
,which cube kylin will use to respond ?
Mime
View raw message