(ZQuery s, TransactionId tId)
| 279 | private boolean inUserTrans = false; |
| 280 | |
| 281 | public Query handleQueryStatement(ZQuery s, TransactionId tId) |
| 282 | throws IOException, |
| 283 | simpledb.ParsingException, Zql.ParseException { |
| 284 | Query query = new Query(tId); |
| 285 | |
| 286 | LogicalPlan lp = parseQueryLogicalPlan(tId, s); |
| 287 | OpIterator physicalPlan = lp.physicalPlan(tId, |
| 288 | TableStats.getStatsMap(), explain); |
| 289 | query.setPhysicalPlan(physicalPlan); |
| 290 | query.setLogicalPlan(lp); |
| 291 | |
| 292 | if (physicalPlan != null) { |
| 293 | Class<?> c; |
| 294 | try { |
| 295 | c = Class.forName("simpledb.optimizer.OperatorCardinality"); |
| 296 | |
| 297 | Class<?> p = Operator.class; |
| 298 | Class<?> h = Map.class; |
| 299 | |
| 300 | java.lang.reflect.Method m = c.getMethod( |
| 301 | "updateOperatorCardinality", p, h, h); |
| 302 | |
| 303 | System.out.println("The query plan is:"); |
| 304 | m.invoke(null, physicalPlan, |
| 305 | lp.getTableAliasToIdMapping(), TableStats.getStatsMap()); |
| 306 | c = Class.forName("simpledb.optimizer.QueryPlanVisualizer"); |
| 307 | m = c.getMethod( |
| 308 | "printQueryPlanTree", OpIterator.class, System.out.getClass()); |
| 309 | m.invoke(c.newInstance(), physicalPlan,System.out); |
| 310 | } catch (ClassNotFoundException | SecurityException ignored) { |
| 311 | } catch (NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { |
| 312 | e.printStackTrace(); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | return query; |
| 317 | } |
| 318 | |
| 319 | public Query handleInsertStatement(ZInsert s, TransactionId tId) |
| 320 | throws DbException, IOException, |
no test coverage detected