Skip to content

Commit a9e0956

Browse files
committed
dqrun: add --exclude-linked-udfs option
Same as kqprun option added by ydb-platform#3150
1 parent df3b16b commit a9e0956

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

ydb/library/yql/tools/dqrun/dqrun.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <ydb/library/yql/providers/yt/lib/config_clusters/config_clusters.h>
1414
#include <ydb/library/yql/providers/dq/local_gateway/yql_dq_gateway_local.h>
1515

16+
#include <ydb/library/yql/public/udf/udf_static_registry.h>
17+
1618
#include <ydb/library/yql/utils/log/proto/logger_config.pb.h>
1719
#include <ydb/library/yql/core/url_preprocessing/url_preprocessing.h>
1820
#include <ydb/library/yql/utils/actor_system/manager.h>
@@ -465,6 +467,7 @@ int RunMain(int argc, const char* argv[])
465467
TString fileStorageCfg;
466468
TVector<TString> udfsPaths;
467469
TString udfsDir;
470+
bool excludeLinkedUdfs = false;
468471
TMaybe<TString> dqHost;
469472
TMaybe<int> dqPort;
470473
int threads = 16;
@@ -548,6 +551,11 @@ int RunMain(int argc, const char* argv[])
548551
opts.AddLongOption("udfs-dir", "Load all shared libraries with UDFs found"
549552
" in given directory")
550553
.StoreResult(&udfsDir);
554+
opts.AddLongOption("exclude-linked-udfs", "Exclude linked udfs when same udf passed from -u or --udfs-dir")
555+
.Optional()
556+
.NoArgument()
557+
.DefaultValue(excludeLinkedUdfs)
558+
.SetFlag(&excludeLinkedUdfs);
551559
opts.AddLongOption("validate", "validate expression")
552560
.Optional()
553561
.NoArgument()
@@ -797,7 +805,16 @@ int RunMain(int argc, const char* argv[])
797805

798806
NMiniKQL::FindUdfsInDir(udfsDir, &udfsPaths);
799807
auto funcRegistry = NMiniKQL::CreateFunctionRegistry(&NYql::NBacktrace::KikimrBackTrace, NMiniKQL::CreateBuiltinRegistry(), false, udfsPaths)->Clone();
800-
NKikimr::NMiniKQL::FillStaticModules(*funcRegistry);
808+
if (excludeLinkedUdfs) {
809+
for (const auto& wrapper : NYql::NUdf::GetStaticUdfModuleWrapperList()) {
810+
auto [name, ptr] = wrapper();
811+
if (!funcRegistry->IsLoadedUdfModule(name)) {
812+
funcRegistry->AddModule(TString(NKikimr::NMiniKQL::StaticModulePrefix) + name, name, std::move(ptr));
813+
}
814+
}
815+
} else {
816+
NKikimr::NMiniKQL::FillStaticModules(*funcRegistry);
817+
}
801818

802819
TGatewaysConfig gatewaysConfig;
803820
ReadGatewaysConfig(gatewaysCfgFile, &gatewaysConfig, sqlFlags);

0 commit comments

Comments
 (0)