Login  Register

[GitHub] [carbondata] akashrn5 commented on a change in pull request #4060: [CARBONDATA-4093] Added logs for MV and method to verify if mv is in Sync during query

Posted by GitBox on Dec 21, 2020; 5:41am
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-Indhumathi27-opened-a-new-pull-request-4060-CARBONDATA-4093-Added-logs-for-MV-and-y-tp104977p104990.html


akashrn5 commented on a change in pull request #4060:
URL: https://github.com/apache/carbondata/pull/4060#discussion_r546518847



##########
File path: core/src/main/java/org/apache/carbondata/core/view/MVProvider.java
##########
@@ -364,18 +366,37 @@ private static boolean isViewCanBeEnabled(MVSchema schema)
     }
     List<RelationIdentifier> relatedTables = schema.getRelatedTables();
     for (RelationIdentifier relatedTable : relatedTables) {
+      SegmentStatusManager.ValidAndInvalidSegmentsInfo validAndInvalidSegmentsInfo =
+          SegmentStatusManager.getValidAndInvalidSegmentsInfo(relatedTable);
       List<String> relatedTableSegmentList =
-          SegmentStatusManager.getValidSegmentList(relatedTable);
+          SegmentStatusManager.getValidSegmentList(validAndInvalidSegmentsInfo);
       if (!relatedTableSegmentList.isEmpty()) {
         if (viewSegmentMap.isEmpty()) {
           isViewCanBeEnabled = false;
         } else {
-          isViewCanBeEnabled = viewSegmentMap.get(
-              relatedTable.getDatabaseName() + CarbonCommonConstants.POINT +
-                  relatedTable.getTableName()).containsAll(relatedTableSegmentList);
+          String tableUniqueName =
+              relatedTable.getDatabaseName() + CarbonCommonConstants.POINT + relatedTable
+                  .getTableName();
+          isViewCanBeEnabled =
+              viewSegmentMap.get(tableUniqueName).containsAll(relatedTableSegmentList);
+          if (!isViewCanBeEnabled) {
+            // in case if main table is compacted and mv table mapping is not updated,
+            // check from merged Load Mapping
+            Map<String, List<String>> mergedLoadMapping =
+                validAndInvalidSegmentsInfo.getMergedLoadMapping();
+            List<String> mergedLoadsList = new ArrayList<>();

Review comment:
       dont create this list, just use stream and map function and do .tolist




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[hidden email]