A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PhysicalOptimizer.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * *
3  * Copyright 2018 Rice University *
4  * *
5  * Licensed under the Apache License, Version 2.0 (the "License"); *
6  * you may not use this file except in compliance with the License. *
7  * You may obtain a copy of the License at *
8  * *
9  * http://www.apache.org/licenses/LICENSE-2.0 *
10  * *
11  * Unless required by applicable law or agreed to in writing, software *
12  * distributed under the License is distributed on an "AS IS" BASIS, *
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14  * See the License for the specific language governing permissions and *
15  * limitations under the License. *
16  * *
17  *****************************************************************************/
18 #ifndef PDB_PHYSICAL_OPTIMIZER_H
19 #define PDB_PHYSICAL_OPTIMIZER_H
20 
21 #include <set>
22 #include "AggregationJobStage.h"
23 #include "AtomicComputationList.h"
25 #include "Computation.h"
26 #include "ComputePlan.h"
27 #include "Configuration.h"
29 #include "LogicalPlan.h"
30 #include "PDBLogger.h"
31 #include "Statistics.h"
32 #include "TupleSetJobStage.h"
34 
35 namespace pdb {
36 
56  public:
57 
63  PhysicalOptimizer(std::vector<AbstractPhysicalNodePtr> &sources, PDBLoggerPtr &logger);
64 
66 
76  bool getNextStagesOptimized(std::vector<pdb::Handle<AbstractJobStage>> &physicalPlanToOutput,
77  std::vector<pdb::Handle<SetIdentifier>> &interGlobalSets,
78  StatisticsPtr &stats,
79  int &jobStageId);
80 
85  bool hasSources();
86 
93 
94 
100 
101  private:
102 
106  static constexpr double SOURCE_PENALIZE_FACTOR = 1000.00;
107 
112  std::map<std::string, AbstractPhysicalNodePtr> sourceNodes;
113 
117  std::set<std::string> penalizedSets;
118 
123 
124 };
125 
126 }
127 
128 
129 #endif //PDB_PHYSICAL_OPTIMIZER_H
bool hasConsumers(Handle< SetIdentifier > &set)
std::shared_ptr< Statistics > StatisticsPtr
Definition: Statistics.h:27
static constexpr double SOURCE_PENALIZE_FACTOR
std::set< std::string > penalizedSets
bool getNextStagesOptimized(std::vector< pdb::Handle< AbstractJobStage >> &physicalPlanToOutput, std::vector< pdb::Handle< SetIdentifier >> &interGlobalSets, StatisticsPtr &stats, int &jobStageId)
std::map< std::string, AbstractPhysicalNodePtr > sourceNodes
std::shared_ptr< AbstractPhysicalNode > AbstractPhysicalNodePtr
std::shared_ptr< PDBLogger > PDBLoggerPtr
Definition: PDBLogger.h:40
PhysicalOptimizer(std::vector< AbstractPhysicalNodePtr > &sources, PDBLoggerPtr &logger)
AbstractPhysicalNodePtr getBestNode(StatisticsPtr &ptr)