blob: 2b56b86b7e747cbf8d08fca64028a093ae917edd (
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
|
#pragma once
#include <yql/essentials/parser/pg_wrapper/interface/optimizer.h>
struct Var;
struct RelOptInfo;
struct List;
struct EquivalenceClass;
struct Path;
struct RestrictInfo;
namespace NYql {
class TPgOptimizer: public IOptimizer {
public:
TPgOptimizer(const TInput& input, const std::function<void(const TString&)>& log = {});
~TPgOptimizer();
TOutput JoinSearch() override;
private:
TInput Input;
std::function<void(const TString&)> Log;
std::map<TVarId, Var*> Vars;
std::vector<std::vector<RestrictInfo*>> RestrictInfos;
std::vector<RestrictInfo*> LeftRestriction;
std::vector<RestrictInfo*> RightRestriction;
void MakeLeftOrRightRestrictions(std::vector<RestrictInfo*>& dst, const std::vector<TEq>& src);
void LogNode(const TString& prefix, void* node);
RelOptInfo* JoinSearchInternal();
List* MakeEqClasses();
EquivalenceClass* MakeEqClass(int eqId);
Var* MakeVar(TVarId);
TOutput MakeOutput(Path*);
int MakeOutputJoin(TOutput& output, Path*);
void LogOutput(const TString& prefix, const TOutput& output, int id);
TString PrettyPrintVar(TVarId varId);
};
// export for tests
Var* MakeVar(int relno, int varno);
RelOptInfo* MakeRelOptInfo(const IOptimizer::TRel& r, int relno);
List* MakeRelOptInfoList(const IOptimizer::TInput& input);
} // namespace NYql
|