@Test public void testDimensionRangeCheck() { CubeSegment cubeSegment = cube.getSegments().getFirstSegment(); TblColRef qtyCol = cube.getModel().findColumn("V_LINEORDER.LO_QUANTITY"); TblColRef revCol = cube.getModel().findColumn("V_LINEORDER.V_REVENUE"); TupleFilter constFilter_LO_QUANTITY0 = new ConstantTupleFilter(Sets.newHashSet("8", "18", "28")); TupleFilter constFilter_LO_QUANTITY1 = new ConstantTupleFilter("1"); TupleFilter constFilter_LO_QUANTITY2 = new ConstantTupleFilter("50"); TupleFilter constFilter_LO_QUANTITY3 = new ConstantTupleFilter("0"); TupleFilter constFilter_LO_QUANTITY4 = new ConstantTupleFilter("200"); TupleFilter constFilter_LO_QUANTITY5 = new ConstantTupleFilter(Sets.newHashSet("51", "52", "53")); { TupleFilter f = compare(qtyCol, FilterOperatorEnum.EQ, revCol); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertTrue(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.ISNULL); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertTrue(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.LT, constFilter_LO_QUANTITY1); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertFalse(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.LTE, constFilter_LO_QUANTITY1); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertTrue(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.LT, constFilter_LO_QUANTITY2); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertTrue(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.GT, constFilter_LO_QUANTITY2); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertFalse(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.GTE, constFilter_LO_QUANTITY2); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertTrue(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.GT, constFilter_LO_QUANTITY1); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertTrue(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.IN, constFilter_LO_QUANTITY5); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertFalse(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.IN, constFilter_LO_QUANTITY0); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertTrue(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.LTE, constFilter_LO_QUANTITY3); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertFalse(segmentPruner.check(cubeSegment)); } { TupleFilter f = compare(qtyCol, FilterOperatorEnum.GTE, constFilter_LO_QUANTITY4); SegmentPruner segmentPruner = new SegmentPruner(f); Assert.assertFalse(segmentPruner.check(cubeSegment)); } }
public boolean check(CubeSegment seg) { if (seg.getInputRecords() == 0) { if (seg.getConfig().isSkippingEmptySegments()) { logger.debug("Prune segment {} due to 0 input record", seg); return false; } else { logger.debug("Insist scan of segment {} having 0 input record", seg); } } if (!node.checkSeg(seg)) { logger.debug("Prune segment {} due to given filter", seg); return false; } logger.debug("Pruner passed on segment {}", seg); return true; }
SegmentPruner { public boolean check(CubeSegment seg) { if (seg.getInputRecords() == 0) { if (seg.getConfig().isSkippingEmptySegments()) { logger.debug("Prune segment {} due to 0 input record", seg); return false; } else { logger.debug("Insist scan of segment {} having 0 input record", seg); } } if (!node.checkSeg(seg)) { logger.debug("Prune segment {} due to given filter", seg); return false; } logger.debug("Pruner passed on segment {}", seg); return true; } }
SegmentPruner { public boolean check(CubeSegment seg) { if (seg.getInputRecords() == 0) { if (seg.getConfig().isSkippingEmptySegments()) { logger.debug("Prune segment {} due to 0 input record", seg); return false; } else { logger.debug("Insist scan of segment {} having 0 input record", seg); } } if (!node.checkSeg(seg)) { logger.debug("Prune segment {} due to given filter", seg); return false; } logger.debug("Pruner passed on segment {}", seg); return true; } SegmentPruner(TupleFilter filter); }
SegmentPruner { public boolean check(CubeSegment seg) { if (seg.getInputRecords() == 0) { if (seg.getConfig().isSkippingEmptySegments()) { logger.debug("Prune segment {} due to 0 input record", seg); return false; } else { logger.debug("Insist scan of segment {} having 0 input record", seg); } } if (!node.checkSeg(seg)) { logger.debug("Prune segment {} due to given filter", seg); return false; } logger.debug("Pruner passed on segment {}", seg); return true; } SegmentPruner(TupleFilter filter); List<CubeSegment> listSegmentsForQuery(CubeInstance cube); boolean check(CubeSegment seg); static DimensionRangeInfo tryDeduceRangeFromPartitionCol(CubeSegment seg, TblColRef col); static boolean satisfy(CompareTupleFilter comp, String minVal, String maxVal); }
SegmentPruner { public boolean check(CubeSegment seg) { if (seg.getInputRecords() == 0) { if (seg.getConfig().isSkippingEmptySegments()) { logger.debug("Prune segment {} due to 0 input record", seg); return false; } else { logger.debug("Insist scan of segment {} having 0 input record", seg); } } if (!node.checkSeg(seg)) { logger.debug("Prune segment {} due to given filter", seg); return false; } logger.debug("Pruner passed on segment {}", seg); return true; } SegmentPruner(TupleFilter filter); List<CubeSegment> listSegmentsForQuery(CubeInstance cube); boolean check(CubeSegment seg); static DimensionRangeInfo tryDeduceRangeFromPartitionCol(CubeSegment seg, TblColRef col); static boolean satisfy(CompareTupleFilter comp, String minVal, String maxVal);  }