Execute function.
| 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: |