MCPcopy Create free account
hub / github.com/bytedance/bolt / apply

Method apply

bolt/functions/lib/ArraySort.cpp:270–298  ·  view source on GitHub ↗

Execute function.

Source from the content-addressed store, hash-verified

268 throwOnNestedNull_{throwOnNestedNull} {}
269
270 // Execute function.
271 void apply(
272 const SelectivityVector& rows,
273 std::vector<VectorPtr>& args,
274 const TypePtr& /*outputType*/,
275 exec::EvalCtx& context,
276 VectorPtr& result) const override {
277 auto& arg = args[0];
278
279 VectorPtr localResult;
280
281 // Input can be constant or flat.
282 if constexpr (Kind == TypeKind::UNKNOWN) {
283 // All elements are NULL. Hence, sorting doesn't change anything.
284 localResult = arg;
285 } else if (arg->isConstantEncoding()) {
286 auto* constantArray = arg->as<ConstantVector<ComplexType>>();
287 const auto& flatArray = constantArray->valueVector();
288 const auto flatIndex = constantArray->index();
289
290 exec::LocalSingleRow singleRow(context, flatIndex);
291 localResult = applyFlat(*singleRow, flatArray, context);
292 localResult =
293 BaseVector::wrapInConstant(rows.end(), flatIndex, localResult);
294 } else {
295 localResult = applyFlat(rows, arg, context);
296 }
297
298 context.moveOrCopyResult(localResult, rows, result);
299 }
300
301 private:

Callers 1

applyMethod · 0.45

Calls 2

indexMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected