You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by GitBox <gi...@apache.org> on 2022/04/06 14:09:31 UTC

[GitHub] [carbondata] ShreelekhyaG commented on a diff in pull request #4257: [WIP] Incremental‌ ‌Dataload‌ ‌of Average aggregate in ‌MV‌‌

ShreelekhyaG commented on code in PR #4257:
URL: https://github.com/apache/carbondata/pull/4257#discussion_r843998373


##########
integration/spark/src/main/scala/org/apache/spark/sql/execution/command/view/CarbonCreateMVCommand.scala:
##########
@@ -143,9 +143,22 @@ case class CarbonCreateMVCommand(
       tableIdentifier: TableIdentifier,
       viewManager: MVManagerInSpark,
       viewCatalog: MVCatalogInSpark): MVSchema = {
-    val logicalPlan = MVHelper.dropDummyFunction(
+    var logicalPlan = MVHelper.dropDummyFunction(
       MVQueryParser.getQueryPlan(queryString, session))
-      // check if mv with same query already exists
+    val relatedTables = getRelatedTables(logicalPlan)
+    val viewRefreshMode = if (checkIsQueryNeedFullRefresh(logicalPlan) ||
+                              checkIsHasNonCarbonTable(relatedTables)) {
+      MVProperty.REFRESH_MODE_FULL
+    } else {
+      MVProperty.REFRESH_MODE_INCREMENTAL
+    }
+    val modifiedQueryString = MVQueryParser.checkForAvgAndModifySql(queryString)
+    if (viewRefreshMode.equalsIgnoreCase(MVProperty.REFRESH_MODE_INCREMENTAL)) {
+      // Check if average aggregate is used and derive logical plan from modified query string.
+      logicalPlan = MVHelper.dropDummyFunction(

Review Comment:
   added if check to see if query contains AVG function.



-- 
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: dev-unsubscribe@carbondata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org