}
public PhysicalPlan getPlan(String sql, Pointer<String> textPlan) throws SqlParseException, ValidationException, RelConversionException, IOException{
SqlNode sqlNode = planner.parse(sql);
AbstractSqlHandler handler;
SqlHandlerConfig config = new SqlHandlerConfig(hepPlanner, planner, context);
// TODO: make this use path scanning or something similar.
switch(sqlNode.getKind()){
case EXPLAIN:
handler = new ExplainHandler(config);
break;
case SET_OPTION:
handler = new SetOptionHandler(context);
break;
case OTHER:
if (sqlNode instanceof DrillSqlCall) {
handler = ((DrillSqlCall)sqlNode).getSqlHandler(config);
break;
}
// fallthrough
default:
handler = new DefaultSqlHandler(config, textPlan);
}
return handler.getPlan(sqlNode);
}