blob: b0a1679d1e9cfcd1a3b580e790fb129b745241b9 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#pragma once
#include <yql/essentials/public/udf/udf_helpers.h>
#include <library/cpp/uri/uri.h>
#define FIELD_MAP(XX) \
XX(Scheme) \
XX(User) \
XX(Pass) \
XX(Host) \
XX(Port) \
XX(Path) \
XX(Query) \
XX(Frag)
#define FIELD_INDEXES(name) ui32 name;
namespace NUrlUdf {
using namespace NUri;
using namespace NKikimr;
using namespace NUdf;
struct TUrlParseIndexes {
ui32 ParseError;
FIELD_MAP(FIELD_INDEXES)
};
class TParse: public TBoxedValue {
public:
TParse(const TUrlParseIndexes& UrlParseIndexes)
: UrlParseIndexes(UrlParseIndexes)
, ParseFlags(TUri::FeaturesRecommended)
{
}
static const TStringRef& Name() {
static auto nameRef = TStringRef("Parse");
return nameRef;
}
private:
TUnboxedValue Run(
const IValueBuilder* valueBuilder,
const TUnboxedValuePod* args) const override;
public:
static bool DeclareSignature(
const TStringRef& name,
TType* userType,
IFunctionTypeInfoBuilder& builder,
bool typesOnly);
private:
const TUrlParseIndexes UrlParseIndexes;
const NUri::TParseFlags ParseFlags;
static constexpr ui32 FieldsCount = sizeof(TUrlParseIndexes) / sizeof(ui32);
};
}
|