()
| 115 | } |
| 116 | |
| 117 | public Map<Operator, DataBag> getExamples() throws IOException, InterruptedException { |
| 118 | if (pigContext.getProperties().getProperty("pig.usenewlogicalplan", "true").equals("false")) |
| 119 | throw new ExecException("ILLUSTRATE must use the new logical plan!"); |
| 120 | pigContext.inIllustrator = true; |
| 121 | physPlan = compilePlan(plan); |
| 122 | physPlanReseter = new PhysicalPlanResetter(physPlan); |
| 123 | List<Operator> loads = newPlan.getSources(); |
| 124 | List<PhysicalOperator> pRoots = physPlan.getRoots(); |
| 125 | if (loads.size() != pRoots.size()) |
| 126 | throw new ExecException("Logical and Physical plans have different number of roots"); |
| 127 | logToPhyMap = execEngine.getLogToPhyMap(); |
| 128 | forEachInnerLogToPhyMap = execEngine.getForEachInnerLogToPhyMap(plan); |
| 129 | poLoadToLogMap = new HashMap<PhysicalOperator, Operator>(); |
| 130 | logToDataMap = new HashMap<Operator, DataBag>(); |
| 131 | poToLogMap = new HashMap<PhysicalOperator, Operator>(); |
| 132 | |
| 133 | // set up foreach inner data map |
| 134 | forEachInnerLogToDataMap = new HashMap<LOForEach, Map<LogicalRelationalOperator, DataBag>>(); |
| 135 | for (Map.Entry<LOForEach, Map<LogicalRelationalOperator, PhysicalOperator>> entry : forEachInnerLogToPhyMap.entrySet()) { |
| 136 | Map<LogicalRelationalOperator, DataBag> innerMap = new HashMap<LogicalRelationalOperator, DataBag>(); |
| 137 | forEachInnerLogToDataMap.put(entry.getKey(), innerMap); |
| 138 | } |
| 139 | |
| 140 | for (Operator load : loads) |
| 141 | { |
| 142 | poLoadToLogMap.put(logToPhyMap.get(load), load); |
| 143 | } |
| 144 | |
| 145 | boolean hasLimit = false; |
| 146 | for (Operator lo : logToPhyMap.keySet()) { |
| 147 | poToLogMap.put(logToPhyMap.get(lo), lo); |
| 148 | if (!hasLimit && lo instanceof LOLimit) |
| 149 | hasLimit = true; |
| 150 | } |
| 151 | |
| 152 | try { |
| 153 | readBaseData(loads); |
| 154 | } catch (ExecException e) { |
| 155 | log.error("Error reading data. " + e.getMessage()); |
| 156 | throw e; |
| 157 | } catch (FrontendException e) { |
| 158 | log.error("Error reading data. " + e.getMessage()); |
| 159 | throw new RuntimeException(e); |
| 160 | } |
| 161 | |
| 162 | Map<Operator, DataBag> derivedData = null; |
| 163 | |
| 164 | // create derived data and trim base data |
| 165 | LineageTrimmingVisitor trimmer = new LineageTrimmingVisitor(newPlan, |
| 166 | baseData, this, logToPhyMap, physPlan, pigContext); |
| 167 | trimmer.visit(); |
| 168 | baseData = trimmer.getBaseData(); |
| 169 | // System.out.println( |
| 170 | // "Obtained the first level derived and trimmed data"); |
| 171 | // create new derived data from trimmed basedata |
| 172 | derivedData = getData(physPlan); |
| 173 | |
| 174 | // System.out.println( |
no test coverage detected