aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/mkql_type_helper.h
blob: 87832b6e09f8b30a8d77a785f37086b3374be41f (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
#pragma once

#include <yql/essentials/minikql/mkql_node_builder.h>

namespace NKikimr::NMiniKQL {

inline bool IsSingularType(const TType* type) {
    return type->IsNull() ||
           type->IsVoid() ||
           type->IsEmptyDict() ||
           type->IsEmptyList();
}

inline bool NeedWrapWithExternalOptional(TType* type) {
    bool isOptional;
    auto unpacked = UnpackOptional(type, isOptional);
    if (!isOptional) {
        return false;
    } else if (unpacked->IsOptional()) {
        return true;
    } else if (unpacked->IsPg() || IsSingularType(unpacked)) {
        return true;
    }
    return false;
}

} // namespace NKikimr::NMiniKQL