@Test public void testFindSmallerSibling2() { CubeDesc cube = getTestKylinCubeWithSeller(); CuboidScheduler scheduler = new CuboidScheduler(cube); Collection<Long> siblings; siblings = scheduler.findSmallerSibling(511); assertEquals("[]", siblings.toString()); siblings = scheduler.findSmallerSibling(toLong("110111111")); assertEquals("[383]", siblings.toString()); siblings = scheduler.findSmallerSibling(toLong("101110111")); assertEquals("[319]", siblings.toString()); siblings = scheduler.findSmallerSibling(toLong("111111000")); assertEquals("[]", siblings.toString()); siblings = scheduler.findSmallerSibling(toLong("111111000")); assertEquals("[]", siblings.toString()); siblings = scheduler.findSmallerSibling(toLong("110000000")); assertEquals("[288, 320]", sortToString(siblings)); }
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);  }