use of io.crate.exceptions.VersionInvalidException in project crate by crate.
the class ESGetStatementPlanner method convert.
public static Plan convert(QueriedDocTable table, Planner.Context context) {
QuerySpec querySpec = table.querySpec();
Optional<DocKeys> optKeys = querySpec.where().docKeys();
assert !querySpec.hasAggregates() : "Can't create ESGet plan for queries with aggregates";
assert !querySpec.groupBy().isPresent() : "Can't create ESGet plan for queries with group by";
assert optKeys.isPresent() : "Can't create ESGet without docKeys";
DocTableInfo tableInfo = table.tableRelation().tableInfo();
DocKeys docKeys = optKeys.get();
if (docKeys.withVersions()) {
throw new VersionInvalidException();
}
Limits limits = context.getLimits(querySpec);
if (limits.hasLimit() && limits.finalLimit() == 0) {
return new NoopPlan(context.jobId());
}
table.tableRelation().validateOrderBy(querySpec.orderBy());
return new ESGet(context.nextExecutionPhaseId(), tableInfo, querySpec.outputs(), optKeys.get(), querySpec.orderBy(), limits.finalLimit(), limits.offset(), context.jobId());
}
Aggregations