Search in sources :

Example 1 with PlanObjectKey

use of com.hazelcast.sql.impl.optimizer.PlanObjectKey in project hazelcast by hazelcast.

the class PlanCacheTestSupport method createPlan.

public static SqlPlan createPlan(PlanKey key, Map<UUID, PartitionIdSet> partitions, int... objectKeys) {
    Set<PlanObjectKey> objectKeys0 = new HashSet<>();
    if (objectKeys != null) {
        for (int objectId : objectKeys) {
            objectKeys0.add(createObjectId(objectId));
        }
    }
    SqlPlan plan = new TestPlan(key, objectKeys0, partitions);
    assertEquals(key, plan.getPlanKey());
    assertEquals(0L, plan.getPlanLastUsed());
    return plan;
}
Also used : PlanObjectKey(com.hazelcast.sql.impl.optimizer.PlanObjectKey) SqlPlan(com.hazelcast.sql.impl.optimizer.SqlPlan) HashSet(java.util.HashSet)

Example 2 with PlanObjectKey

use of com.hazelcast.sql.impl.optimizer.PlanObjectKey in project hazelcast by hazelcast.

the class PlanCacheChecker method check.

public void check() {
    if (planCache.size() == 0) {
        return;
    }
    // Collect object IDs
    SqlCatalog catalog = new SqlCatalog(tableResolvers);
    Set<PlanObjectKey> objectKeys = new HashSet<>();
    for (Map<String, Table> tableMap : catalog.getSchemas().values()) {
        for (Table table : tableMap.values()) {
            PlanObjectKey objectKey = table.getObjectKey();
            if (objectKey != null) {
                objectKeys.add(objectKey);
            }
        }
    }
    // Prepare partition distribution
    Map<UUID, PartitionIdSet> partitions = QueryUtils.createPartitionMap(nodeEngine, null, false);
    // Do check
    planCache.check(new PlanCheckContext(objectKeys, partitions));
}
Also used : SqlCatalog(com.hazelcast.sql.impl.schema.SqlCatalog) PlanCheckContext(com.hazelcast.sql.impl.optimizer.PlanCheckContext) Table(com.hazelcast.sql.impl.schema.Table) PlanObjectKey(com.hazelcast.sql.impl.optimizer.PlanObjectKey) PartitionIdSet(com.hazelcast.internal.util.collection.PartitionIdSet) UUID(java.util.UUID) HashSet(java.util.HashSet)

Aggregations

PlanObjectKey (com.hazelcast.sql.impl.optimizer.PlanObjectKey)2 HashSet (java.util.HashSet)2 PartitionIdSet (com.hazelcast.internal.util.collection.PartitionIdSet)1 PlanCheckContext (com.hazelcast.sql.impl.optimizer.PlanCheckContext)1 SqlPlan (com.hazelcast.sql.impl.optimizer.SqlPlan)1 SqlCatalog (com.hazelcast.sql.impl.schema.SqlCatalog)1 Table (com.hazelcast.sql.impl.schema.Table)1 UUID (java.util.UUID)1