Search in sources :

Example 1 with Organization

use of org.apache.ignite.yardstick.cache.model.Organization in project ignite by apache.

the class IgniteSqlQueryJoinBenchmark method setUp.

/** {@inheritDoc} */
@Override
public void setUp(BenchmarkConfiguration cfg) throws Exception {
    super.setUp(cfg);
    println(cfg, "Populating query data...");
    long start = System.nanoTime();
    try (IgniteDataStreamer<Object, Object> dataLdr = ignite().dataStreamer(cache.getName())) {
        final int orgRange = args.range() / 10;
        // Populate organizations.
        for (int i = 0; i < orgRange && !Thread.currentThread().isInterrupted(); i++) dataLdr.addData(i, new Organization(i, "org" + i));
        dataLdr.flush();
        // Populate persons.
        for (int i = orgRange; i < orgRange + args.range() && !Thread.currentThread().isInterrupted(); i++) {
            Person p = new Person(i, nextRandom(orgRange), "firstName" + i, "lastName" + i, (i - orgRange) * 1000);
            dataLdr.addData(i, p);
            if (i % 100000 == 0)
                println(cfg, "Populated persons: " + i);
        }
    }
    println(cfg, "Finished populating join query data in " + ((System.nanoTime() - start) / 1_000_000) + " ms.");
}
Also used : Organization(org.apache.ignite.yardstick.cache.model.Organization) Person(org.apache.ignite.yardstick.cache.model.Person)

Example 2 with Organization

use of org.apache.ignite.yardstick.cache.model.Organization in project ignite by apache.

the class IgniteSqlQueryDistributedJoinBenchmark method setUp.

/** {@inheritDoc} */
@Override
public void setUp(BenchmarkConfiguration cfg) throws Exception {
    super.setUp(cfg);
    broadcast = broadcastJoin();
    println(cfg, "Populating query data...");
    long start = System.nanoTime();
    range = args.range();
    if (range <= 0)
        throw new IllegalArgumentException();
    try (IgniteDataStreamer<Object, Object> dataLdr = ignite().dataStreamer(cache.getName())) {
        for (int orgId = 0; orgId < range; orgId++) {
            dataLdr.addData(orgId, new Organization(orgId, "org" + orgId));
            int personId = range + orgId;
            Person p = new Person(personId, orgId, "firstName" + personId, "lastName" + personId, 1000);
            dataLdr.addData(personId, p);
            if (orgId % 1000 == 0 && Thread.currentThread().isInterrupted())
                return;
        }
        dataLdr.close();
    }
    println(cfg, "Finished populating join query [orgCnt=" + range + ", personCnt=" + range + ", broadcastJoin=" + broadcast + ", time=" + ((System.nanoTime() - start) / 1_000_000) + "ms]");
    executeQueryJoin(0, broadcast, true);
}
Also used : Organization(org.apache.ignite.yardstick.cache.model.Organization) Person(org.apache.ignite.yardstick.cache.model.Person)

Example 3 with Organization

use of org.apache.ignite.yardstick.cache.model.Organization in project ignite by apache.

the class ModelUtil method create.

/**
     * @param c model class
     * @param id object id
     * @return object from model
     */
public static Object create(Class c, int id) {
    Object res = null;
    switch(c.getSimpleName()) {
        case "Double":
            res = id;
            break;
        case "Identifier":
            res = new Identifier(id, "id " + id);
            break;
        case "Mark":
            res = new Mark(id, UUID.nameUUIDFromBytes(Integer.toString(id).getBytes()));
            break;
        case "Integer":
            res = id;
            break;
        case "UUID":
            res = UUID.nameUUIDFromBytes(Integer.toString(id).getBytes());
            break;
        case "Car":
            int colorCnt = Color.values().length;
            res = new Car(id, "Mark " + id, id / 2.123 * 100, Color.values()[id % colorCnt]);
            break;
        case "Truck":
            int colors = Color.values().length;
            res = new Truck(id, "Mark " + id, id / 2.123 * 100, Color.values()[id % colors], id / 4.123 * 100);
            break;
        case "Person":
            res = new Person(id, id + 1, "First Name " + id, "Last Name " + id, id / 2.123 * 100);
            break;
        case "Organization":
            res = new Organization(id, "Organization " + id);
            break;
        case "Account":
            res = new Account(id);
            break;
        case "Person1":
            res = new Person1(id);
            break;
        case "Person2":
            res = new Person2(id);
            break;
        case "Person8":
            res = new Person8(id);
            break;
        case "String":
            res = String.valueOf(id);
    }
    return res;
}
Also used : Account(org.apache.ignite.yardstick.cache.model.Account) Identifier(org.apache.ignite.yardstick.cache.load.model.key.Identifier) Organization(org.apache.ignite.yardstick.cache.model.Organization) Person1(org.apache.ignite.yardstick.cache.model.Person1) Car(org.apache.ignite.yardstick.cache.load.model.value.Car) Person2(org.apache.ignite.yardstick.cache.model.Person2) Mark(org.apache.ignite.yardstick.cache.load.model.key.Mark) Truck(org.apache.ignite.yardstick.cache.load.model.value.Truck) Person8(org.apache.ignite.yardstick.cache.model.Person8) Person(org.apache.ignite.yardstick.cache.model.Person)

Aggregations

Organization (org.apache.ignite.yardstick.cache.model.Organization)3 Person (org.apache.ignite.yardstick.cache.model.Person)3 Identifier (org.apache.ignite.yardstick.cache.load.model.key.Identifier)1 Mark (org.apache.ignite.yardstick.cache.load.model.key.Mark)1 Car (org.apache.ignite.yardstick.cache.load.model.value.Car)1 Truck (org.apache.ignite.yardstick.cache.load.model.value.Truck)1 Account (org.apache.ignite.yardstick.cache.model.Account)1 Person1 (org.apache.ignite.yardstick.cache.model.Person1)1 Person2 (org.apache.ignite.yardstick.cache.model.Person2)1 Person8 (org.apache.ignite.yardstick.cache.model.Person8)1