boolean groupingSetsExpression = false; if (groupBy.indicator) { Group aggregateType = Aggregate.Group.induce(groupBy.getGroupSet(), groupBy.getGroupSets()); if (aggregateType == Group.ROLLUP) {
@Test public void testInduceGroupingType0() { final ImmutableBitSet groupSet = ImmutableBitSet.of(); // Could be CUBE or ROLLUP but we choose SIMPLE List<ImmutableBitSet> groupSets = new ArrayList<>(); groupSets.add(groupSet); assertEquals(Aggregate.Group.SIMPLE, Aggregate.Group.induce(groupSet, groupSets)); groupSets = new ArrayList<>(); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); } }
@Test public void testInduceGroupingType0() { final ImmutableBitSet groupSet = ImmutableBitSet.of(); // Could be CUBE or ROLLUP but we choose SIMPLE List<ImmutableBitSet> groupSets = new ArrayList<>(); groupSets.add(groupSet); assertEquals(Aggregate.Group.SIMPLE, Aggregate.Group.induce(groupSet, groupSets)); groupSets = new ArrayList<>(); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); } }
boolean groupingSetsExpression = false; if (groupBy.indicator) { Group aggregateType = Aggregate.Group.induce(groupBy.getGroupSet(), groupBy.getGroupSets()); if (aggregateType == Group.ROLLUP) {
groupSets.add(groupSet); assertEquals(Aggregate.Group.SIMPLE, Aggregate.Group.induce(groupSet, groupSets)); Aggregate.Group.induce(groupSet, groupSets)); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.ROLLUP, Aggregate.Group.induce(groupSet, groupSets)); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); groupSets.add(ImmutableBitSet.of(1)); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); final Aggregate.Group x = Aggregate.Group.induce(groupSet, groupSets); fail("expected error, got " + x); } catch (IllegalArgumentException ignore) { Aggregate.Group.induce(groupSet, groupSets)); Aggregate.Group.induce(groupSet, groupSets)); Aggregate.Group.induce(groupSet, groupSets));
groupSets.add(groupSet); assertEquals(Aggregate.Group.SIMPLE, Aggregate.Group.induce(groupSet, groupSets)); Aggregate.Group.induce(groupSet, groupSets)); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.ROLLUP, Aggregate.Group.induce(groupSet, groupSets)); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); groupSets.add(ImmutableBitSet.of(1)); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); final Aggregate.Group x = Aggregate.Group.induce(groupSet, groupSets); fail("expected error, got " + x); } catch (IllegalArgumentException ignore) { Aggregate.Group.induce(groupSet, groupSets)); Aggregate.Group.induce(groupSet, groupSets)); Aggregate.Group.induce(groupSet, groupSets));
/** Tests a singleton grouping set {2}, whose power set has only two elements, * { {2}, {} }. */ @Test public void testInduceGroupingType1() { final ImmutableBitSet groupSet = ImmutableBitSet.of(2); // Could be ROLLUP but we prefer CUBE List<ImmutableBitSet> groupSets = new ArrayList<>(); groupSets.add(groupSet); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.CUBE, Aggregate.Group.induce(groupSet, groupSets)); groupSets = new ArrayList<>(); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); groupSets = new ArrayList<>(); groupSets.add(groupSet); assertEquals(Aggregate.Group.SIMPLE, Aggregate.Group.induce(groupSet, groupSets)); groupSets = new ArrayList<>(); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); }
/** Tests a singleton grouping set {2}, whose power set has only two elements, * { {2}, {} }. */ @Test public void testInduceGroupingType1() { final ImmutableBitSet groupSet = ImmutableBitSet.of(2); // Could be ROLLUP but we prefer CUBE List<ImmutableBitSet> groupSets = new ArrayList<>(); groupSets.add(groupSet); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.CUBE, Aggregate.Group.induce(groupSet, groupSets)); groupSets = new ArrayList<>(); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); groupSets = new ArrayList<>(); groupSets.add(groupSet); assertEquals(Aggregate.Group.SIMPLE, Aggregate.Group.induce(groupSet, groupSets)); groupSets = new ArrayList<>(); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); }
public Aggregate.Group getGroupType() { return Aggregate.Group.induce(groupSet, groupSets); }
public Aggregate.Group getGroupType() { return Aggregate.Group.induce(groupSet, groupSets); }
/** * Returns the type of roll-up. * * @return Type of roll-up */ public Group getGroupType() { return Group.induce(groupSet, groupSets); }
/** * Returns the type of roll-up. * * @return Type of roll-up */ public Group getGroupType() { return Group.induce(groupSet, groupSets); }
public Aggregate.Group getGroupType() { return Aggregate.Group.induce(groupSet, groupSets); } }