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; }
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; } }
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(); }
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; }
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; }
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; } }
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(); }
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; }
private static long translateToValidCuboid(CubeDesc cubeDesc, long cuboidID) { long mandatoryColumnMask = rowkey.getMandatoryColumnMask(); if (cuboidID < mandatoryColumnMask) { cuboidID = cuboidID | mandatoryColumnMask; long cuboidWithoutMandatory = cuboidID & ~rowkey.getMandatoryColumnMask(); long leftover; for (AggrGroupMask mask : rowkey.getAggrGroupMasks()) {