MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / handleQueryStatement

Method handleQueryStatement

src/java/simpledb/Parser.java:281–317  ·  view source on GitHub ↗
(ZQuery s, TransactionId tId)

Source from the content-addressed store, hash-verified

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,

Callers 1

processNextStatementMethod · 0.95

Calls 6

parseQueryLogicalPlanMethod · 0.95
physicalPlanMethod · 0.95
getStatsMapMethod · 0.95
setPhysicalPlanMethod · 0.95
setLogicalPlanMethod · 0.95

Tested by

no test coverage detected