use of com.hazelcast.jet.sql.impl.parse.QueryParseResult in project hazelcast by hazelcast.
the class CalciteSqlOptimizer method prepare.
@Override
public SqlPlan prepare(OptimizationTask task) {
// 1. Prepare context.
int memberCount = nodeEngine.getClusterService().getSize(MemberSelectors.DATA_MEMBER_SELECTOR);
OptimizerContext context = OptimizerContext.create(task.getSchema(), task.getSearchPaths(), task.getArguments(), memberCount, iMapResolver);
// 2. Parse SQL string and validate it.
QueryParseResult parseResult = context.parse(task.getSql());
// 3. Create plan.
return createPlan(task, parseResult, context);
}
use of com.hazelcast.jet.sql.impl.parse.QueryParseResult in project hazelcast by hazelcast.
the class OptimizerTestSupport method optimizeLogicalInternal.
private static LogicalRel optimizeLogicalInternal(String sql, OptimizerContext context) {
QueryParseResult parseResult = context.parse(sql);
RelNode rel = context.convert(parseResult.getNode()).getRel();
return (LogicalRel) context.optimize(rel, LogicalRules.getRuleSet(), OptUtils.toLogicalConvention(rel.getTraitSet()));
}
use of com.hazelcast.jet.sql.impl.parse.QueryParseResult in project hazelcast by hazelcast.
the class CalciteSqlOptimizer method toCreateJobPlan.
private SqlPlan toCreateJobPlan(PlanKey planKey, QueryParseResult parseResult, OptimizerContext context, String query) {
SqlCreateJob sqlCreateJob = (SqlCreateJob) parseResult.getNode();
SqlNode source = sqlCreateJob.dmlStatement();
QueryParseResult dmlParseResult = new QueryParseResult(source, parseResult.getParameterMetadata(), false);
QueryConvertResult dmlConvertedResult = context.convert(dmlParseResult.getNode());
SqlPlanImpl dmlPlan = toPlan(null, parseResult.getParameterMetadata(), dmlConvertedResult.getRel(), dmlConvertedResult.getFieldNames(), context, dmlParseResult.isInfiniteRows(), true, query);
assert dmlPlan instanceof DmlPlan && ((DmlPlan) dmlPlan).getOperation() == Operation.INSERT;
return new CreateJobPlan(planKey, sqlCreateJob.jobConfig(), sqlCreateJob.ifNotExists(), (DmlPlan) dmlPlan, query, parseResult.isInfiniteRows(), planExecutor);
}
Aggregations