/** * Initialize the registry for the given database. It will extract the materialized views * that are enabled for rewriting from the metastore for the current user, parse them, * and register them in this cache. * * The loading process runs on the background; the method returns in the moment that the * runnable task is created, thus the views will still not be loaded in the cache when * it returns. */ public void init() { try { // Create a new conf object to bypass metastore authorization, as we need to // retrieve all materialized views from all databases HiveConf conf = new HiveConf(); conf.set(MetastoreConf.ConfVars.FILTER_HOOK.getVarname(), DefaultMetaStoreFilterHookImpl.class.getName()); init(Hive.get(conf)); } catch (HiveException e) { LOG.error("Problem connecting to the metastore when initializing the view registry", e); } }
@Override public void run(HookContext hookContext) throws Exception { SessionState ss = SessionState.get(); if (ss != null && ss.getConf().get(HiveConf.ConfVars.HIVE_SERVER2_MATERIALIZED_VIEWS_REGISTRY_IMPL.varname) .equals("DUMMY")) { HiveMaterializedViewsRegistry.get().init(Hive.get(ss.getConf())); } }
HiveMaterializedViewsRegistry.get().init();
HiveMaterializedViewsRegistry.get().init();
public void init() throws Exception { // Create remote dirs once. if (mr != null) { createRemoteDirs(); } // Create views registry HiveMaterializedViewsRegistry.get().init(); testWarehouse = conf.getVar(HiveConf.ConfVars.METASTOREWAREHOUSE); String execEngine = conf.get("hive.execution.engine"); conf.set("hive.execution.engine", "mr"); SessionState.start(conf); conf.set("hive.execution.engine", execEngine); db = Hive.get(conf); drv = DriverFactory.newDriver(conf); pd = new ParseDriver(); sem = new SemanticAnalyzer(queryState); }
HiveMaterializedViewsRegistry.get().init();
HiveMaterializedViewsRegistry.get().init();