use of io.crate.planner.consumer.ConsumerContext in project crate by crate.
the class Planner method visitUpdateStatement.
@Override
protected Plan visitUpdateStatement(UpdateAnalyzedStatement statement, Context context) {
ConsumerContext consumerContext = new ConsumerContext(context);
Plan plan = updateConsumer.consume(statement, consumerContext);
if (plan == null) {
throw new IllegalArgumentException("Couldn't plan Update statement");
}
return plan;
}
use of io.crate.planner.consumer.ConsumerContext in project crate by crate.
the class SelectStatementPlanner method subPlan.
private static Plan subPlan(AnalyzedRelation rel, Planner.Context context) {
ConsumerContext consumerContext = new ConsumerContext(context);
Plan subPlan = context.planSubRelation(rel, consumerContext);
assert subPlan != null : "plan must not be null";
ValidationException validationException = consumerContext.validationException();
if (validationException != null) {
throw validationException;
}
return subPlan;
}
use of io.crate.planner.consumer.ConsumerContext in project crate by crate.
the class CopyStatementPlanner method planCopyTo.
public Plan planCopyTo(CopyToAnalyzedStatement statement, Planner.Context context) {
WriterProjection.OutputFormat outputFormat = statement.outputFormat();
if (outputFormat == null) {
outputFormat = statement.columnsDefined() ? WriterProjection.OutputFormat.JSON_ARRAY : WriterProjection.OutputFormat.JSON_OBJECT;
}
WriterProjection projection = ProjectionBuilder.writerProjection(statement.subQueryRelation().querySpec().outputs(), statement.uri(), statement.compressionType(), statement.overwrites(), statement.outputNames(), outputFormat);
Plan plan = context.planSubRelation(statement.subQueryRelation(), new ConsumerContext(context));
if (plan == null) {
return null;
}
plan.addProjection(projection, null, null, 1, null);
return Merge.ensureOnHandler(plan, context, Collections.singletonList(MergeCountProjection.INSTANCE));
}
Aggregations