kasakrisz commented on code in PR #6322:
URL: https://github.com/apache/hive/pull/6322#discussion_r2822151789
##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMaterializedViewsRegistry.java:
##########
@@ -168,44 +171,60 @@ private Loader(Hive db) {
@Override
public void run() {
- PerfLogger perfLogger = SessionState.getPerfLogger();
- try {
- DriverUtils.setUpAndStartSessionState(db.getConf());
- perfLogger.perfLogBegin(CLASS_NAME,
PerfLogger.MATERIALIZED_VIEWS_REGISTRY_REFRESH);
- if (initialized.get()) {
- for (Table mvTable : db.getAllMaterializedViewObjectsForRewriting())
{
- RelOptMaterialization existingMV = getRewritingMaterializedView(
- mvTable.getDbName(), mvTable.getTableName(), ALL);
- if (existingMV != null) {
- // We replace if the existing MV is not newer
- Table existingMVTable =
HiveMaterializedViewUtils.extractTable(existingMV);
- if (existingMVTable.getCreateTime() < mvTable.getCreateTime() ||
- (existingMVTable.getCreateTime() == mvTable.getCreateTime()
&&
- existingMVTable.getMVMetadata().getMaterializationTime()
<= mvTable.getMVMetadata().getMaterializationTime())) {
- refreshMaterializedView(db.getConf(), existingMVTable,
mvTable);
- }
- } else {
- // Simply replace if it still does not exist
- refreshMaterializedView(db.getConf(), null, mvTable);
+ DriverUtils.setUpAndStartSessionState(db.getConf());
+ refresh(db);
+ }
+ }
+
+ public void refresh(Hive db) {
+ PerfLogger perfLogger = SessionState.getPerfLogger();
+ perfLogger.perfLogBegin(CLASS_NAME,
PerfLogger.MATERIALIZED_VIEWS_REGISTRY_REFRESH);
+ try {
+ if (initialized.get()) {
+ Set<TableName> remaining = getRewritingMaterializedViews().stream()
+ .map(materialization -> new TableName(
+ "hive", materialization.qualifiedTableName.get(0),
materialization.qualifiedTableName.get(1)))
Review Comment:
I refactored this part to extract the `Table` object represents the MV from
the wrapped TableScan of the MV. So `Table.getFullTableName` is used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]