yql_udf_resolver.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. #include "yql_udf_resolver.h"
  2. namespace NYql {
  3. TResolveResult LoadRichMetadata(const IUdfResolver& resolver, const TVector<TUserDataBlock>& blocks) {
  4. TVector<IUdfResolver::TImport> imports;
  5. imports.reserve(blocks.size());
  6. std::transform(blocks.begin(), blocks.end(), std::back_inserter(imports), [](auto& b) {
  7. IUdfResolver::TImport import;
  8. import.Block = &b;
  9. // this field is not used later, but allows us to map importResult to import
  10. import.FileAlias = b.Data;
  11. return import;
  12. });
  13. return resolver.LoadRichMetadata(imports);
  14. }
  15. TResolveResult LoadRichMetadata(const IUdfResolver& resolver, const TVector<TString>& paths) {
  16. TVector<TUserDataBlock> blocks;
  17. blocks.reserve(paths.size());
  18. std::transform(paths.begin(), paths.end(), std::back_inserter(blocks), [](auto& p) {
  19. TUserDataBlock b;
  20. b.Type = EUserDataType::PATH;
  21. b.Data = p;
  22. b.Usage.Set(EUserDataBlockUsage::Udf);
  23. return b;
  24. });
  25. return LoadRichMetadata(resolver, blocks);
  26. }
  27. }