Search in sources :

Example 1 with OptimizationTask

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

the class SqlServiceImpl method prepare.

private SqlPlan prepare(String schema, String sql, List<Object> arguments, SqlExpectedResultType expectedResultType) {
    List<List<String>> searchPaths = prepareSearchPaths(schema);
    PlanKey planKey = new PlanKey(searchPaths, sql);
    SqlPlan plan = planCache.get(planKey);
    if (plan == null) {
        SqlCatalog catalog = new SqlCatalog(optimizer.tableResolvers());
        plan = optimizer.prepare(new OptimizationTask(sql, arguments, searchPaths, catalog));
        if (plan.isCacheable()) {
            planCache.put(planKey, plan);
        }
    }
    checkReturnType(plan, expectedResultType);
    return plan;
}
Also used : SqlCatalog(com.hazelcast.sql.impl.schema.SqlCatalog) PlanKey(com.hazelcast.sql.impl.optimizer.PlanKey) OptimizationTask(com.hazelcast.sql.impl.optimizer.OptimizationTask) SqlPlan(com.hazelcast.sql.impl.optimizer.SqlPlan) ArrayList(java.util.ArrayList) Arrays.asList(java.util.Arrays.asList) List(java.util.List)

Aggregations

OptimizationTask (com.hazelcast.sql.impl.optimizer.OptimizationTask)1 PlanKey (com.hazelcast.sql.impl.optimizer.PlanKey)1 SqlPlan (com.hazelcast.sql.impl.optimizer.SqlPlan)1 SqlCatalog (com.hazelcast.sql.impl.schema.SqlCatalog)1 ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1