aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/core/yql_udf_resolver.cpp
blob: b4d29015cd8a4e9f2e056305cc9b3f5f7fe091bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "yql_udf_resolver.h"

namespace NYql {

TResolveResult LoadRichMetadata(const IUdfResolver& resolver, const TVector<TUserDataBlock>& blocks) {
    TVector<IUdfResolver::TImport> imports;
    imports.reserve(blocks.size());
    std::transform(blocks.begin(), blocks.end(), std::back_inserter(imports), [](auto& b) {
        IUdfResolver::TImport import;
        import.Block = &b;
        // this field is not used later, but allows us to map importResult to import
        import.FileAlias = b.Data;
        return import;
    });

    return resolver.LoadRichMetadata(imports);
}

TResolveResult LoadRichMetadata(const IUdfResolver& resolver, const TVector<TString>& paths) {
    TVector<TUserDataBlock> blocks;
    blocks.reserve(paths.size());
    std::transform(paths.begin(), paths.end(), std::back_inserter(blocks), [](auto& p) {
        TUserDataBlock b;
        b.Type = EUserDataType::PATH;
        b.Data = p;
        b.Usage.Set(EUserDataBlockUsage::Udf);
        return b;
    });

    return LoadRichMetadata(resolver, blocks);
}

}