mkql_function_metadata.cpp 1017 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "mkql_function_metadata.h"
  2. namespace NKikimr {
  3. namespace NMiniKQL {
  4. TKernelFamilyBase::TKernelFamilyBase(const arrow::compute::FunctionOptions* functionOptions)
  5. : TKernelFamily(functionOptions)
  6. {}
  7. const TKernel* TKernelFamilyBase::FindKernel(const NUdf::TDataTypeId* argTypes, size_t argTypesCount, NUdf::TDataTypeId returnType) const {
  8. std::vector<NUdf::TDataTypeId> args(argTypes, argTypes + argTypesCount);
  9. auto it = KernelMap.find({ args, returnType });
  10. if (it == KernelMap.end()) {
  11. return nullptr;
  12. }
  13. return it->second.get();
  14. }
  15. TVector<const TKernel*> TKernelFamilyBase::GetAllKernels() const {
  16. TVector<const TKernel*> ret;
  17. for (const auto& k : KernelMap) {
  18. ret.emplace_back(k.second.get());
  19. }
  20. return ret;
  21. }
  22. void TKernelFamilyBase::Adopt(const std::vector<NUdf::TDataTypeId>& argTypes, NUdf::TDataTypeId returnType, std::unique_ptr<TKernel>&& kernel) {
  23. KernelMap.emplace(std::make_pair(argTypes, returnType), std::move(kernel));
  24. }
  25. }
  26. }