udf_probe.cpp 967 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <yql/essentials/minikql/mkql_function_registry.h>
  2. #include <util/generic/yexception.h>
  3. #include <util/generic/string.h>
  4. using namespace NKikimr;
  5. using namespace NKikimr::NMiniKQL;
  6. void ListModules(const TString& dir) {
  7. TVector<TString> udfPaths;
  8. NMiniKQL::FindUdfsInDir(dir, &udfPaths);
  9. auto funcRegistry = CreateFunctionRegistry(nullptr, IBuiltinFunctionRegistry::TPtr(), false, udfPaths,
  10. NUdf::IRegistrator::TFlags::TypesOnly);
  11. for (auto& m : funcRegistry->GetAllModuleNames()) {
  12. auto path = *funcRegistry->FindUdfPath(m);
  13. Cout << m << '\t' << path << Endl;
  14. }
  15. }
  16. int main(int argc, char **argv) {
  17. try {
  18. if (argc != 2) {
  19. Cerr << "Expected directory path\n";
  20. }
  21. TString dir = argv[1];
  22. Y_UNUSED(NUdf::GetStaticSymbols());
  23. ListModules(dir);
  24. return 0;
  25. } catch (...) {
  26. Cerr << CurrentExceptionMessage() << Endl;
  27. return 1;
  28. }
  29. }