summaryrefslogtreecommitdiffstats
path: root/yql/essentials/core/yql_window_frame_settings_pg.h
blob: dc7025a1208cc06c2bbdc7d9f0ee4d17fe8d929d (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
#pragma once

#include <yql/essentials/core/yql_expr_type_annotation_pg.h>
#include <yql/essentials/core/yql_node_transform.h>
#include <yql/essentials/parser/pg_wrapper/interface/compare.h>
#include <yql/essentials/parser/pg_wrapper/interface/sign.h>

#include <compare>
#include <expected>

namespace NYql {

struct TInRangeCasts {
    TMaybe<TNodeTransform> ColumnCast;
    TMaybe<TNodeTransform> OffsetCast;
    ui32 ProcId;
};

std::expected<TInRangeCasts, TString> LookupInRangeCasts(
    const TTypeAnnotationNode* columnType,
    const TTypeAnnotationNode* offsetType,
    TPositionHandle pos,
    TExprContext& ctx);

std::expected<std::strong_ordering, TString> PgSign(const TExprNode::TPtr& value);

std::expected<bool, TString> PgCompareWithCasts(
    const TExprNode::TPtr& lhs,
    const TExprNode::TPtr& rhs,
    NKikimr::NMiniKQL::EPgCompareType cmpType);

} // namespace NYql