当前位置: 首页>>代码示例>>Java>>正文


Java FunctionDesc.needRewrite方法代码示例

本文整理汇总了Java中org.apache.kylin.metadata.model.FunctionDesc.needRewrite方法的典型用法代码示例。如果您正苦于以下问题:Java FunctionDesc.needRewrite方法的具体用法?Java FunctionDesc.needRewrite怎么用?Java FunctionDesc.needRewrite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.kylin.metadata.model.FunctionDesc的用法示例。


在下文中一共展示了FunctionDesc.needRewrite方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listEffectiveRewriteMeasures

import org.apache.kylin.metadata.model.FunctionDesc; //导入方法依赖的package包/类
public List<MeasureDesc> listEffectiveRewriteMeasures(String project, String table, boolean onlyRewriteMeasure) {
    Set<IRealization> realizations = getRealizationsByTable(project, table);
    List<MeasureDesc> result = Lists.newArrayList();
    for (IRealization r : realizations) {
        if (!r.isReady())
            continue;

        for (MeasureDesc m : r.getMeasures()) {
            FunctionDesc func = m.getFunction();
            if (belongToTable(func, table, r.getModel())) {
                if (!onlyRewriteMeasure || func.needRewrite()) {
                    result.add(m);
                }
            }
        }
    }
    return result;
}
 
开发者ID:apache,项目名称:kylin,代码行数:19,代码来源:ProjectL2Cache.java

示例2: implementRewrite

import org.apache.kylin.metadata.model.FunctionDesc; //导入方法依赖的package包/类
@Override
public void implementRewrite(RewriteImplementor implementor) {
    // only rewrite the innermost aggregation
    if (needRewrite()) {
        translateAggregation();
        buildRewriteFieldsAndMetricsColumns();
    }

    implementor.visitChild(this, getInput());
    // only rewrite the innermost aggregation
    if (needRewrite()) {
        // rewrite the aggCalls
        this.rewriteAggCalls = new ArrayList<AggregateCall>(aggCalls.size());
        for (int i = 0; i < this.aggCalls.size(); i++) {
            AggregateCall aggCall = this.aggCalls.get(i);
            FunctionDesc cubeFunc = this.context.aggregations.get(i);
            // filter needn,t rewrite aggfunc
            // if it's not a cube, then the "needRewriteField func" should not resort to any rewrite fields,
            // which do not exist at all
            if (!(noPrecaculatedFieldsAvailable() && cubeFunc.needRewriteField())) {
                if (cubeFunc.needRewrite()) {
                    aggCall = rewriteAggregateCall(aggCall, cubeFunc);
                }

                //if not dim as measure (using some measure), differentiate it with a new class
                if (cubeFunc.getMeasureType() != null &&
                // DimCountDistinct case
                        cubeFunc.getMeasureType().needRewriteField()) {
                    aggCall = new KylinAggregateCall(aggCall, cubeFunc);
                }
            } else {
                logger.info(aggCall + "skip rewriteAggregateCall because no pre-aggregated field available");
            }

            this.rewriteAggCalls.add(aggCall);
            this.context.aggrSqlCalls.add(toSqlCall(aggCall));
        }
    }

    // rebuild rowType & columnRowType
    this.rowType = this.deriveRowType();
    this.columnRowType = this.buildColumnRowType();

}
 
开发者ID:apache,项目名称:kylin,代码行数:45,代码来源:OLAPAggregateRel.java

示例3: CubeTupleConverter

import org.apache.kylin.metadata.model.FunctionDesc; //导入方法依赖的package包/类
public CubeTupleConverter(CubeSegment cubeSeg, Cuboid cuboid, //
        Set<TblColRef> selectedDimensions, Set<FunctionDesc> selectedMetrics, int[] gtColIdx, TupleInfo returnTupleInfo) {
    this.cubeSeg = cubeSeg;
    this.cuboid = cuboid;
    this.gtColIdx = gtColIdx;
    this.tupleInfo = returnTupleInfo;
    this.derivedColFillers = Lists.newArrayList();

    nSelectedDims = selectedDimensions.size();
    tupleIdx = new int[selectedDimensions.size() + selectedMetrics.size()];

    // measure types don't have this many, but aligned length make programming easier
    measureTypes = new MeasureType[selectedDimensions.size() + selectedMetrics.size()];

    advMeasureFillers = Lists.newArrayListWithCapacity(1);
    advMeasureIndexInGTValues = Lists.newArrayListWithCapacity(1);

    ////////////

    int i = 0;

    // pre-calculate dimension index mapping to tuple
    for (TblColRef dim : selectedDimensions) {
        tupleIdx[i] = tupleInfo.hasColumn(dim) ? tupleInfo.getColumnIndex(dim) : -1;
        i++;
    }

    for (FunctionDesc metric : selectedMetrics) {
        if (metric.needRewrite()) {
            String rewriteFieldName = metric.getRewriteFieldName();
            tupleIdx[i] = tupleInfo.hasField(rewriteFieldName) ? tupleInfo.getFieldIndex(rewriteFieldName) : -1;
        } else {
            // a non-rewrite metrics (like sum, or dimension playing as metrics) is like a dimension column
            TblColRef col = metric.getParameter().getColRefs().get(0);
            tupleIdx[i] = tupleInfo.hasColumn(col) ? tupleInfo.getColumnIndex(col) : -1;
        }

        MeasureType<?> measureType = metric.getMeasureType();
        if (measureType.needAdvancedTupleFilling()) {
            Map<TblColRef, Dictionary<String>> dictionaryMap = buildDictionaryMap(measureType.getColumnsNeedDictionary(metric));
            advMeasureFillers.add(measureType.getAdvancedTupleFiller(metric, returnTupleInfo, dictionaryMap));
            advMeasureIndexInGTValues.add(i);
        } else {
            measureTypes[i] = measureType;
        }

        i++;
    }

    // prepare derived columns and filler
    Map<Array<TblColRef>, List<DeriveInfo>> hostToDerivedInfo = cuboid.getCubeDesc().getHostToDerivedInfo(cuboid.getColumns(), null);
    for (Entry<Array<TblColRef>, List<DeriveInfo>> entry : hostToDerivedInfo.entrySet()) {
        TblColRef[] hostCols = entry.getKey().data;
        for (DeriveInfo deriveInfo : entry.getValue()) {
            IDerivedColumnFiller filler = newDerivedColumnFiller(hostCols, deriveInfo);
            if (filler != null) {
                derivedColFillers.add(filler);
            }
        }
    }
}
 
开发者ID:apache,项目名称:kylin,代码行数:62,代码来源:CubeTupleConverter.java


注:本文中的org.apache.kylin.metadata.model.FunctionDesc.needRewrite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。