use of io.crate.planner.operators.Fetch in project crate by crate.
the class RewriteToQueryThenFetch method apply.
@Override
public LogicalPlan apply(Limit limit, Captures captures, TableStats tableStats, TransactionContext txnCtx, NodeContext nodeCtx) {
if (Symbols.containsColumn(limit.outputs(), DocSysColumns.FETCHID)) {
return null;
}
FetchRewrite fetchRewrite = limit.source().rewriteToFetch(tableStats, Set.of());
if (fetchRewrite == null) {
return null;
}
List<Reference> fetchRefs = fetchRewrite.extractFetchRefs();
Map<RelationName, FetchSource> fetchSourceByRelation = fetchRewrite.createFetchSources();
return new Fetch(fetchRewrite.replacedOutputs(), fetchRefs, fetchSourceByRelation, limit.replaceSources(List.of(fetchRewrite.newPlan())));
}
use of io.crate.planner.operators.Fetch in project crate by crate.
the class RewriteToQueryThenFetch method doRewrite.
private static LogicalPlan doRewrite(AnalyzedRelation relation, LogicalPlan plan, TableStats tableStats) {
FetchRewrite fetchRewrite = plan.rewriteToFetch(tableStats, List.of());
if (fetchRewrite == null) {
return plan;
}
List<Reference> fetchRefs = fetchRewrite.extractFetchRefs();
Map<RelationName, FetchSource> fetchSourceByRelation = fetchRewrite.createFetchSources();
Fetch fetch = new Fetch(fetchRewrite.replacedOutputs(), fetchRefs, fetchSourceByRelation, fetchRewrite.newPlan());
return Eval.create(fetch, relation.outputs());
}
Aggregations