aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tools/udf_probe/udf_probe.cpp
blob: 7f7e7d28a8cd85bed23bd3285f4b2f7f5706718b (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
34
35
#include <yql/essentials/minikql/mkql_function_registry.h>

#include <util/generic/yexception.h>
#include <util/generic/string.h>

using namespace NKikimr;
using namespace NKikimr::NMiniKQL;

void ListModules(const TString& dir) {
    TVector<TString> udfPaths;
    NMiniKQL::FindUdfsInDir(dir, &udfPaths);
    auto funcRegistry = CreateFunctionRegistry(nullptr, IBuiltinFunctionRegistry::TPtr(), false, udfPaths,
        NUdf::IRegistrator::TFlags::TypesOnly);

    for (auto& m : funcRegistry->GetAllModuleNames()) {
        auto path = *funcRegistry->FindUdfPath(m);
        Cout << m << '\t' << path << Endl;
    }
}

int main(int argc, char **argv) {
    try {
        if (argc != 2) {
            Cerr << "Expected directory path\n";
        }

        TString dir = argv[1];
        Y_UNUSED(NUdf::GetStaticSymbols());
        ListModules(dir);
        return 0;
    } catch (...) {
        Cerr << CurrentExceptionMessage() << Endl;
        return 1;
    }
}