MCPcopy Create free account
hub / github.com/crate/crate / build

Method build

server/src/main/java/io/crate/planner/operators/Fetch.java:110–176  ·  view source on GitHub ↗
(DependencyCarrier executor,
                               PlannerContext plannerContext,
                               Set<PlanHint> hints,
                               ProjectionBuilder projectionBuilder,
                               int limit,
                               int offset,
                               @Nullable OrderBy order,
                               @Nullable Integer pageSizeHint,
                               Row params,
                               SubQueryResults subQueryResults)

Source from the content-addressed store, hash-verified

108 }
109
110 @Override
111 public ExecutionPlan build(DependencyCarrier executor,
112 PlannerContext plannerContext,
113 Set<PlanHint> hints,
114 ProjectionBuilder projectionBuilder,
115 int limit,
116 int offset,
117 @Nullable OrderBy order,
118 @Nullable Integer pageSizeHint,
119 Row params,
120 SubQueryResults subQueryResults) {
121 plannerContext.newReaderAllocations();
122 var executionPlan = Merge.ensureOnHandler(
123 source.build(
124 executor,
125 plannerContext,
126 hints,
127 projectionBuilder,
128 limit,
129 offset,
130 order,
131 pageSizeHint,
132 params,
133 subQueryResults
134 ),
135 plannerContext
136 );
137 ReaderAllocations readerAllocations = plannerContext.buildReaderAllocations();
138 UnaryOperator<Symbol> paramBinder = new SubQueryAndParamBinder(params, subQueryResults);
139 FetchPhase fetchPhase = new FetchPhase(
140 plannerContext.nextExecutionPhaseId(),
141 readerAllocations.nodeReaders().keySet(),
142 readerAllocations.bases(),
143 readerAllocations.tableIndices(),
144 fetchRefs
145 );
146
147 ArrayList<Symbol> boundOutputs = new ArrayList<>(replacedOutputs.size());
148 for (var entry : replacedOutputs.entrySet()) {
149 Symbol key = entry.getKey();
150 Symbol value = entry.getValue();
151 if (source.outputs().contains(key)) {
152 boundOutputs.add(paramBinder.apply(key));
153 } else {
154 boundOutputs.add(paramBinder.apply(value));
155 }
156 }
157 List<DataType<?>> inputTypes = Symbols.typeView(source.outputs());
158 // Must bind source outputs to ensure InputColumns.create can associate parameters. Example:
159 // boundOutputs: [FetchStub<_doc['name']>, Function(ints + 1)]
160 // source.outputs(): [FetchMarker<_fetchid>, Function(ints + $1)]
161 // boundedSourceOutputs: [FetchMarker<_fetchid>, Function(ints + 1)]
162 List<Symbol> boundSourceOutputs = Lists.map(source.outputs(), paramBinder);
163 List<Symbol> fetchOutputs = InputColumns.create(boundOutputs, new InputColumns.SourceSymbols(boundSourceOutputs));
164 FetchProjection fetchProjection = new FetchProjection(
165 fetchPhase.phaseId(),
166 plannerContext.fetchSize(),
167 fetchSourceByRelation,

Callers

nothing calls this directly

Calls 15

ensureOnHandlerMethod · 0.95
nodeReadersMethod · 0.95
basesMethod · 0.95
tableIndicesMethod · 0.95
applyMethod · 0.95
typeViewMethod · 0.95
mapMethod · 0.95
createMethod · 0.95
phaseIdMethod · 0.95
indicesMethod · 0.95
indicesToIdentsMethod · 0.95
newReaderAllocationsMethod · 0.80

Tested by

no test coverage detected