@Test public void testFindSmallerSibling1() { CubeDesc cube = getTestKylinCubeWithoutSeller(); CuboidScheduler scheduler = new CuboidScheduler(cube); Collection<Long> siblings; siblings = scheduler.findSmallerSibling(255); assertEquals("[]", siblings.toString()); siblings = scheduler.findSmallerSibling(133); assertEquals("[131]", siblings.toString()); siblings = scheduler.findSmallerSibling(127); assertEquals("[]", siblings.toString()); siblings = scheduler.findSmallerSibling(134); assertEquals("[131, 133]", sortToString(siblings)); siblings = scheduler.findSmallerSibling(130); assertEquals("[129]", siblings.toString()); siblings = scheduler.findSmallerSibling(5); assertEquals("[]", siblings.toString()); siblings = scheduler.findSmallerSibling(135); assertEquals("[]", siblings.toString()); }
public Collection<Long> findSmallerSibling(long cuboid) { if (!Cuboid.isValid(cubeDef, cuboid)) { return Collections.emptyList(); } RowKeyDesc rowkey = cubeDef.getRowkey(); long groupAllBitMask = 0; for (AggrGroupMask mask : rowkey.getAggrGroupMasks()) { if ((mask.groupMask & cuboid) > 0) { groupAllBitMask |= mask.groupMask; } } long groupBitValue = cuboid & groupAllBitMask; long leftBitValue = cuboid & ~groupAllBitMask; long[] groupOneBits = bits(groupAllBitMask); Collection<Long> siblings = new HashSet<Long>(); combination(cuboid, siblings, groupOneBits, 0, leftBitValue, Long.bitCount(groupBitValue)); return siblings; }
CuboidScheduler { public Collection<Long> findSmallerSibling(long cuboid) { if (!Cuboid.isValid(cubeDef, cuboid)) { return Collections.emptyList(); } RowKeyDesc rowkey = cubeDef.getRowkey(); long groupAllBitMask = 0; for (AggrGroupMask mask : rowkey.getAggrGroupMasks()) { if ((mask.groupMask & cuboid) > 0) { groupAllBitMask |= mask.groupMask; } } long groupBitValue = cuboid & groupAllBitMask; long leftBitValue = cuboid & ~groupAllBitMask; long[] groupOneBits = bits(groupAllBitMask); Collection<Long> siblings = new HashSet<Long>(); combination(cuboid, siblings, groupOneBits, 0, leftBitValue, Long.bitCount(groupBitValue)); return siblings; } }
CuboidScheduler { public Collection<Long> findSmallerSibling(long cuboid) { if (!Cuboid.isValid(cubeDef, cuboid)) { return Collections.emptyList(); } RowKeyDesc rowkey = cubeDef.getRowkey(); long groupAllBitMask = 0; for (AggrGroupMask mask : rowkey.getAggrGroupMasks()) { if ((mask.groupMask & cuboid) > 0) { groupAllBitMask |= mask.groupMask; } } long groupBitValue = cuboid & groupAllBitMask; long leftBitValue = cuboid & ~groupAllBitMask; long[] groupOneBits = bits(groupAllBitMask); Collection<Long> siblings = new HashSet<Long>(); combination(cuboid, siblings, groupOneBits, 0, leftBitValue, Long.bitCount(groupBitValue)); return siblings; } CuboidScheduler(CubeDesc cube); }
CuboidScheduler { public Collection<Long> findSmallerSibling(long cuboid) { if (!Cuboid.isValid(cubeDef, cuboid)) { return Collections.emptyList(); } RowKeyDesc rowkey = cubeDef.getRowkey(); long groupAllBitMask = 0; for (AggrGroupMask mask : rowkey.getAggrGroupMasks()) { if ((mask.groupMask & cuboid) > 0) { groupAllBitMask |= mask.groupMask; } } long groupBitValue = cuboid & groupAllBitMask; long leftBitValue = cuboid & ~groupAllBitMask; long[] groupOneBits = bits(groupAllBitMask); Collection<Long> siblings = new HashSet<Long>(); combination(cuboid, siblings, groupOneBits, 0, leftBitValue, Long.bitCount(groupBitValue)); return siblings; } CuboidScheduler(CubeDesc cube); Collection<Long> getSpanningCuboid(long cuboid); Collection<Long> findSmallerSibling(long cuboid); int getCardinality(long cuboid); }
CuboidScheduler { public Collection<Long> findSmallerSibling(long cuboid) { if (!Cuboid.isValid(cubeDef, cuboid)) { return Collections.emptyList(); } RowKeyDesc rowkey = cubeDef.getRowkey(); long groupAllBitMask = 0; for (AggrGroupMask mask : rowkey.getAggrGroupMasks()) { if ((mask.groupMask & cuboid) > 0) { groupAllBitMask |= mask.groupMask; } } long groupBitValue = cuboid & groupAllBitMask; long leftBitValue = cuboid & ~groupAllBitMask; long[] groupOneBits = bits(groupAllBitMask); Collection<Long> siblings = new HashSet<Long>(); combination(cuboid, siblings, groupOneBits, 0, leftBitValue, Long.bitCount(groupBitValue)); return siblings; } CuboidScheduler(CubeDesc cube); Collection<Long> getSpanningCuboid(long cuboid); Collection<Long> findSmallerSibling(long cuboid); int getCardinality(long cuboid);  }