Esempio n. 1
0
  @Test(expected = ScanOutOfLimitException.class)
  @Ignore
  public void testScanOutOfLimit() {
    context.setThreshold(1);
    List<TblColRef> groups = mockup.buildGroups();
    List<FunctionDesc> aggregations = mockup.buildAggregations();

    search(groups, aggregations, null, context);
  }
Esempio n. 2
0
  @Test
  public void test01() {
    List<TblColRef> groups = mockup.buildGroups();
    List<FunctionDesc> aggregations = mockup.buildAggregations();
    TupleFilter filter = mockup.buildFilter1(groups.get(0));

    int count = search(groups, aggregations, filter, context);
    assertTrue(count >= 0);
  }
Esempio n. 3
0
  /*
      @Test
      public void test02() {
          List<TblColRef> groups = buildGroups();
          List<FunctionDesc> aggregations = buildAggregations();
          TupleFilter filter = buildFilter2(groups.get(1));

          int count = search(groups, aggregations, filter, context);
          assertTrue(count > 0);
      }

      @Test
      public void test03() {
          List<TblColRef> groups = buildGroups();
          List<FunctionDesc> aggregations = buildAggregations();
          TupleFilter filter = buildAndFilter(groups);

          int count = search(groups, aggregations, filter, context);
          assertTrue(count > 0);
      }

      @Test
      public void test04() {
          List<TblColRef> groups = buildGroups();
          List<FunctionDesc> aggregations = buildAggregations();
          TupleFilter filter = buildOrFilter(groups);

          int count = search(groups, aggregations, filter, context);
          assertTrue(count > 0);
      }

      @Test
      public void test05() {
          List<TblColRef> groups = buildGroups();
          List<FunctionDesc> aggregations = buildAggregations();

          int count = search(groups, aggregations, null, context);
          assertTrue(count > 0);
      }
  */
  private int search(
      List<TblColRef> groups,
      List<FunctionDesc> aggregations,
      TupleFilter filter,
      StorageContext context) {
    int count = 0;
    ITupleIterator iterator = null;
    try {
      SQLDigest sqlDigest =
          new SQLDigest(
              "default.test_kylin_fact",
              filter,
              null,
              Collections.<TblColRef>emptySet(),
              groups,
              Sets.<TblColRef>newHashSet(),
              Collections.<TblColRef>emptySet(),
              Collections.<TblColRef>emptySet(),
              aggregations,
              Collections.<SQLCall>emptyList(),
              new ArrayList<TblColRef>(),
              new ArrayList<SQLDigest.OrderEnum>(),
              false);
      iterator =
          storageEngine.search(context, sqlDigest, mockup.newTupleInfo(groups, aggregations));
      while (iterator.hasNext()) {
        ITuple tuple = iterator.next();
        System.out.println("Tuple = " + tuple);
        count++;
      }
    } finally {
      if (iterator != null) iterator.close();
    }
    return count;
  }