@Override public Table getTable(String name) { // first check existing tables. if (tables.alreadyContainsKey(name)) return tables.get(name); // then check known views. // String path = knownViews.get(name); // then look for files that start with this name and end in .drill. List<DotDrillFile> files; try { files = DotDrillUtil.getDotDrills(fs, new Path(config.getLocation()), name, DotDrillType.VIEW); for (DotDrillFile f : files) { switch (f.getType()) { case VIEW: return new DrillViewTable(schemaPath, getView(f)); } } } catch (Exception e) { logger.warn("Failure while trying to load .drill file.", e); } return tables.get(name); }
private View getView(DotDrillFile f) throws Exception { assert f.getType() == DotDrillType.VIEW; return f.getView(drillConfig); }