Examples of avg()


Examples of com.jengine.orm.model.cluster.Cluster.avg()

        check( cluster1.select().distinct("Book.title").order("Book.title").list().equals(list("The Dark Tower", "The Shining")) );
        check( cluster1.select().distinct("Book.title").order("Book.title", "DESC").page(0, 2).list().equals(list("The Shining", "The Dark Tower")));
        check( cluster1.select().distinct("Book.title").order("Book.title", "DESC").page(0, 1).list().equals(list("The Shining")));
        check( cluster1.<Long>max("Book.id") == 2l);
        check( cluster1.<Long>min("Transaction.id") == 1l);
        check( cluster1.<Double>avg("Transaction.id") == 2.0);
        check( cluster1.<Long>sum("Transaction.id") == 6);
        check( cluster1.count() == 3);
        check( cluster1.count("Book.id") == 3);
//        check( cluster1.<Long>calc("%s + 10", "Transaction.id") > 0);
//        check( new Cluster("Transaction >> Book").fields("Transaction.id", new Calc("calc_field", Long.class, "%s + 10", "Transaction.id")).select().list() != null );
View Full Code Here

Examples of com.jengine.orm.model.cluster.Cluster.avg()

        check( cluster1.select().distinct("Book.title").order("Book.title").list().equals(list("The Dark Tower", "The Shining")) );
        check( cluster1.select().distinct("Book.title").order("Book.title", "DESC").page(0, 2).list().equals(list("The Shining", "The Dark Tower")));
        check( cluster1.select().distinct("Book.title").order("Book.title", "DESC").page(0, 1).list().equals(list("The Shining")));
        check( cluster1.<Long>max("Book.id") == 2l);
        check( cluster1.<Long>min("Transaction.id") == 1l);
        check( cluster1.<Double>avg("Transaction.id") == 2.0);
        check( cluster1.<Long>sum("Transaction.id") == 6);
        check( cluster1.count() == 3);
        check( cluster1.count("Book.id") == 3);
//        check( cluster1.<Long>calc("%s + 10", "Transaction.id") > 0);
//        check( new Cluster("Transaction >> Book").fields("Transaction.id", new Calc("calc_field", Long.class, "%s + 10", "Transaction.id")).select().list() != null );
View Full Code Here

Examples of javax.persistence.criteria.CriteriaBuilder.avg()

    private CriteriaQuery<Double> buildAvgCriteriaQuery(EntityManager em,
            Class<Double> type, SingularAttribute<AggEntity, Double> sa) {
        CriteriaBuilder cb = em.getCriteriaBuilder();
        CriteriaQuery<Double> cq = cb.createQuery(type);
        Root<AggEntity> aer = cq.from(AggEntity.class);
        return cq.select(cb.avg(aer.get(sa)));
    }

    private void verifyResult(EntityManager em, String[] aggregates,
            String[] attributes, boolean expectNull) {
        verifyResult(em, aggregates, attributes, expectNull, false);
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient.avg()

  public void testAvgWithValidRange() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY,TEST_QUALIFIER);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    double avg = aClient.avg(TEST_TABLE, ci,
        scan);
    assertEquals(9.5, avg, 0);
  }

  /**
 
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient.avg()

    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY,TEST_QUALIFIER);
    scan.setStartRow(ROWS[5]);
    scan.setStopRow(ROWS[15]);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    double avg = aClient.avg(TEST_TABLE, ci, scan);
    assertEquals(9.5, avg, 0);
  }

  @Test
  public void testAvgWithValidRangeWithNoCQ() throws Throwable {
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient.avg()

  public void testAvgWithValidRangeWithNoCQ() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addFamily(TEST_FAMILY);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    double avg = aClient.avg(TEST_TABLE, ci,
        scan);
    assertEquals(104.5, avg, 0);
  }

  @Test
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient.avg()

    Scan scan = new Scan();
    scan.addFamily(TEST_FAMILY);
    scan.setStartRow(ROWS[6]);
    scan.setStopRow(ROWS[7]);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    double avg = aClient.avg(TEST_TABLE, ci, scan);
    assertEquals(6 + 60, avg, 0);
  }

  @Test
  public void testAvgWithValidRangeWithNullCF() {
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient.avg()

    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    Double avg = null;
    try {
      avg = aClient.avg(TEST_TABLE, ci, scan);
    } catch (Throwable e) {
    }
    assertEquals(null, avg);// CP will throw an IOException about the
    // null column family, and max will be set to 0
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient.avg()

    scan.setStartRow(ROWS[5]);
    scan.setStopRow(ROWS[1]);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    Double avg = null;
    try {
      avg = aClient.avg(TEST_TABLE, ci, scan);
    } catch (Throwable e) {
    }
    assertEquals(null, avg);// control should go to the catch block
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient.avg()

    scan.addColumn(TEST_FAMILY,TEST_QUALIFIER);
    Filter f = new PrefixFilter(Bytes.toBytes("foo:bar"));
    scan.setFilter(f);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    Double avg = null;
    avg = aClient.avg(TEST_TABLE, ci, scan);
    assertEquals(Double.NaN, avg, 0);
  }

  /**
   * ****************** Test cases for STD **********************
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.