summaryrefslogtreecommitdiffstats
path: root/yql/essentials/core/extract_predicate/extract_predicate_impl.h
blob: 8f9af1b70bf473fdc7149d010ebda7b56f7b6e92 (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 <utility>

#include "extract_predicate.h"

namespace NYql::NDetail {

class TPredicateRangeExtractor: public IPredicateRangeExtractor {
public:
    explicit TPredicateRangeExtractor(TPredicateExtractorSettings settings = {})
        : Settings_(std::move(settings))
    {
    }

    bool Prepare(const TExprNode::TPtr& filterLambdaNode, const TTypeAnnotationNode& rowType,
                 THashSet<TString>& possibleIndexKeys, TExprContext& ctx, TTypeAnnotationContext& typesCtx) final;

    TExprNode::TPtr GetPreparedRange() const {
        return Range_;
    }

    TBuildResult BuildComputeNode(const TVector<TString>& indexKeys, TExprContext& ctx, TTypeAnnotationContext& typesCtx) const final;

private:
    const TPredicateExtractorSettings Settings_;
    TExprNode::TPtr FilterLambda_;
    const TStructExprType* RowType_ = nullptr;
    TExprNode::TPtr Range_;
};

} // namespace NYql::NDetail