Krisztian Kasa created HIVE-24822:
-------------------------------------

             Summary: Materialized View rebuild loses materializationTime 
property value
                 Key: HIVE-24822
                 URL: https://issues.apache.org/jira/browse/HIVE-24822
             Project: Hive
          Issue Type: Bug
            Reporter: Krisztian Kasa
            Assignee: Krisztian Kasa


Materialized View rebuild like
{code}
alter materialized view mat1 rebuild;
{code}
updates the CreationMetadata of a org.apache.hadoop.hive.ql.metadata.Table 
object  of the materialized view but it does not copy the materializationTime 
property value from the original CreationMetadata object and updates the entry 
in the MaterializedViewCache:
{code}
    } else if (desc.isUpdateCreationMetadata()) {
        // We need to update the status of the creation signature
        Table mvTable = context.getDb().getTable(desc.getName());
        CreationMetadata cm = new 
CreationMetadata(MetaStoreUtils.getDefaultCatalog(context.getConf()),
            mvTable.getDbName(), mvTable.getTableName(),
            ImmutableSet.copyOf(mvTable.getCreationMetadata().getTablesUsed()));
        
cm.setValidTxnList(context.getConf().get(ValidTxnWriteIdList.VALID_TABLES_WRITEIDS_KEY));
        context.getDb().updateCreationMetadata(mvTable.getDbName(), 
mvTable.getTableName(), cm);
        mvTable.setCreationMetadata(cm);
        
HiveMaterializedViewsRegistry.get().createMaterializedView(context.getDb().getConf(),
 mvTable);
      }
{code}
Later when loading Materializetions using 
{code}
Hive.getValidMaterializedViews(List<Table> materializedViewTables ...) 
{code}
the materialization stored in the cache and in the metastore will be not the 
same because of the lost materializationTime.
Cache tried to be refreshed 
{code}
HiveMaterializedViewsRegistry.get().refreshMaterializedView(conf, null, 
materializedViewTable);
{code}
by passing null as oldMaterializedViewTable which leads to NullPointerException 
and CBO failure because the registry expect a non null oldMaterializedViewTable 
value:
It may drops the old MV in Metastore and also tries to update the cache.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to