Java Code Examples for org.apache.kylin.cube.model.RowKeyDesc#getMandatoryColumnMask()

The following examples show how to use org.apache.kylin.cube.model.RowKeyDesc#getMandatoryColumnMask() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CuboidScheduler.java    From Kylin with Apache License 2.0 6 votes vote down vote up
private void generateZeroTailBase(long cuboid, Collection<Long> result) {
    RowKeyDesc rowkey = cubeDef.getRowkey();

    long cuboidWithoutMandatory = cuboid & ~rowkey.getMandatoryColumnMask();

    for (AggrGroupMask mask : rowkey.getAggrGroupMasks()) {
        if ((cuboidWithoutMandatory & mask.groupMask) == mask.groupMask && (cuboidWithoutMandatory & mask.leftoverMask) == mask.leftoverMask) {
            long zeroTail = rowkey.getMandatoryColumnMask() | mask.groupMask;
            if (zeroTail > 0 && zeroTail != cuboid) {
                result.add(zeroTail);
            }
        }
        if ((cuboidWithoutMandatory & mask.uniqueMask) > 0)
            break;
    }
}
 
Example 2
Source File: CuboidScheduler.java    From Kylin with Apache License 2.0 5 votes vote down vote up
private Collection<Long> generateChildren(long cuboid) {
    Collection<Long> result = new HashSet<Long>();

    // generate zero tail cuboid -- the one with all 1 in the first
    // aggregation group and all 0 for the rest bits
    generateZeroTailBase(cuboid, result);

    RowKeyDesc rowkey = cubeDef.getRowkey();
    long cuboidWithoutMandatory = cuboid & ~rowkey.getMandatoryColumnMask();
    for (AggrGroupMask mask : rowkey.getAggrGroupMasks()) {
        if (belongTo(cuboidWithoutMandatory, mask) == false)
            continue;

        long[] groupOneBitMasks = mask.groupOneBitMasks;
        for (int i = 0; i < groupOneBitMasks.length; i++) {
            long oneBit = groupOneBitMasks[i];
            if ((cuboid & oneBit) == 0)
                continue;

            long child = cuboid ^ oneBit;
            if (Cuboid.isValid(cubeDef, child)) {
                result.add(child);
            }
        }

        if ((cuboidWithoutMandatory & mask.uniqueMask) > 0)
            break;
    }

    return result;
}
 
Example 3
Source File: Cuboid.java    From Kylin with Apache License 2.0 5 votes vote down vote up
private static boolean checkMandatoryColumns(RowKeyDesc rowkey, long cuboidID) {
    long mandatoryColumnMask = rowkey.getMandatoryColumnMask();

    // note the all-zero cuboid (except for mandatory) is not valid
    if (cuboidID <= mandatoryColumnMask)
        return false;

    return (cuboidID & mandatoryColumnMask) == mandatoryColumnMask;
}
 
Example 4
Source File: Cuboid.java    From Kylin with Apache License 2.0 5 votes vote down vote up
private static boolean checkAggregationGroup(RowKeyDesc rowkey, long cuboidID) {
    long cuboidWithoutMandatory = cuboidID & ~rowkey.getMandatoryColumnMask();
    long leftover;
    for (AggrGroupMask mask : rowkey.getAggrGroupMasks()) {
        if ((cuboidWithoutMandatory & mask.uniqueMask) != 0) {
            leftover = cuboidWithoutMandatory & ~mask.groupMask;
            return leftover == 0 || leftover == mask.leftoverMask;
        }
    }

    leftover = cuboidWithoutMandatory & rowkey.getTailMask();
    return leftover == 0 || leftover == rowkey.getTailMask();
}