blob: 158194b792ef18307d80d8c958de9184259ce2df (
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/essentials/public/udf/udf_helpers.h>
#include <yql/essentials/public/udf/udf_value_builder.h>
#include <util/string/cast.h>
#include <util/generic/string.h>
using namespace NKikimr;
using namespace NUdf;
namespace {
SIMPLE_UDF(TConcat, char*(char*, char*)) {
return valueBuilder->ConcatStrings(args[0], args[1]);
}
SIMPLE_UDF(TRepeat, char*(char*, ui64)) {
TString orig(args[0].AsStringRef());
ui64 times = args[1].Get<ui64>();
TString res = "";
for (ui64 i = 0; i < times; i++) {
res += orig;
}
return valueBuilder->NewString(res);
}
SIMPLE_MODULE(TTestImportUdfModule,
TConcat,
TRepeat
)
} // namespace
REGISTER_MODULES(TTestImportUdfModule)
|