@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())); } }
/** * Adds a newly created materialized view to the cache. * * @param materializedViewTable the materialized view */ public RelOptMaterialization createMaterializedView(HiveConf conf, Table materializedViewTable) { final boolean cache = !conf.get(HiveConf.ConfVars.HIVE_SERVER2_MATERIALIZED_VIEWS_REGISTRY_IMPL.varname) .equals("DUMMY"); return addMaterializedView(conf, materializedViewTable, OpType.CREATE, cache); }
/** * Removes the materialized view from the cache. * * @param materializedViewTable the materialized view to remove */ public void dropMaterializedView(Table materializedViewTable) { dropMaterializedView(materializedViewTable.getDbName(), materializedViewTable.getTableName()); }
HiveMaterializedViewsRegistry.get().getRewritingMaterializedViews(dbName); if (cachedViews.isEmpty()) {
HiveMaterializedViewsRegistry.get().dropMaterializedView(tbl);
HiveMaterializedViewsRegistry.get().getRewritingMaterializedView( dbName, materializedViewTable.getTableName()); if (materialization != null) { if (HiveMaterializedViewsRegistry.get().isInitialized()) { " was not in the cache"); materialization = HiveMaterializedViewsRegistry.get().createMaterializedView( conf, materializedViewTable); if (materialization != null) {
Hive db = Hive.get(conf); Table mvTable = db.getTable(getWork().getViewName()); HiveMaterializedViewsRegistry.get().createMaterializedView(db.getConf(), mvTable); } else if (getWork().isDisableRewrite()) { HiveMaterializedViewsRegistry.get().dropMaterializedView(names[0], names[1]); } else if (getWork().isUpdateCreationMetadata()) {
HiveMaterializedViewsRegistry.get().addMaterializedView(tbl);
/** * 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); } }
if (obtainTableType(viewTable) == TableType.DRUID) {
HiveMaterializedViewsRegistry.get().dropMaterializedView(tbl);
if (obtainTableType(viewTable) == TableType.DRUID) {
@Override public void run() { for (Table table : tables) { if (table.isMaterializedView()) { addMaterializedView(table); } } } }
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); }