You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "zddr (via GitHub)" <gi...@apache.org> on 2023/06/02 01:30:51 UTC

[GitHub] [doris] zddr opened a new pull request, #20355: [fix](mtmv)create mv support star

zddr opened a new pull request, #20355:
URL: https://github.com/apache/doris/pull/20355

   ## Proposed changes
   
   Issue Number: close #20353 
   
   support create mv support star
   
   adds error prompt for unsupported expr 
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #20355: [fix](mtmv)create mv support star

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #20355:
URL: https://github.com/apache/doris/pull/20355#issuecomment-1573191546

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #20355: [fix](mtmv)create mv support star

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20355:
URL: https://github.com/apache/doris/pull/20355#issuecomment-1576220556

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #20355: [fix](mtmv)create mv support star

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #20355:
URL: https://github.com/apache/doris/pull/20355#issuecomment-1576099512

   > Hi @zddr , this pr should add some tests. Please refer to `MultiTableMaterializedViewTest`.
   
   done


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #20355: [fix](mtmv)create mv support star

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #20355:
URL: https://github.com/apache/doris/pull/20355#issuecomment-1576099044

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #20355: [fix](mtmv)create mv support star

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #20355:
URL: https://github.com/apache/doris/pull/20355#issuecomment-1573233527

   run p0


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] adonis0147 commented on a diff in pull request #20355: [fix](mtmv)create mv support star

Posted by "adonis0147 (via GitHub)" <gi...@apache.org>.
adonis0147 commented on code in PR #20355:
URL: https://github.com/apache/doris/pull/20355#discussion_r1213872279


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMultiTableMaterializedViewStmt.java:
##########
@@ -117,11 +119,40 @@ private void analyzeSelectClause(SelectStmt selectStmt) throws AnalysisException
             tables.put(table.getName(), table);
             tables.put(tableRef.getAlias(), table);
         }
-        columnDefs = generateColumnDefinitions(selectStmt.getSelectList());
+        for (SelectListItem item : selectStmt.getSelectList().getItems()) {
+            if (item.isStar()) {
+                continue;
+            }
+            Expr itemExpr = item.getExpr();
+            String alias = item.getAlias();
+            if (itemExpr instanceof SlotRef) {
+                continue;
+            } else if (itemExpr instanceof FunctionCallExpr && ((FunctionCallExpr) itemExpr).isAggregateFunction()) {
+                FunctionCallExpr functionCallExpr = (FunctionCallExpr) itemExpr;
+                String functionName = functionCallExpr.getFnName().getFunction();
+                MVColumnPattern mvColumnPattern = CreateMaterializedViewStmt.FN_NAME_TO_PATTERN
+                        .get(functionName.toLowerCase());
+                if (mvColumnPattern == null) {
+                    throw new AnalysisException(
+                            "Materialized view does not support this function:" + functionCallExpr.toSqlImpl());
+                }
+                if (!mvColumnPattern.match(functionCallExpr)) {
+                    throw new AnalysisException(
+                            "The function " + functionName + " must match pattern:" + mvColumnPattern);
+                }
+                if (StringUtils.isEmpty(alias)) {
+                    throw new AnalysisException("Function expr: " + functionName + " must have a alias name for MTMV.");
+                }
+            } else {
+                throw new AnalysisException(
+                        "Materialized view does not support this expr:" + itemExpr.toSqlImpl());

Review Comment:
   The function `analyzeSelectClause` is too large. Please try to use some small functions to organize the implementation.



-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] adonis0147 commented on pull request #20355: [fix](mtmv)create mv support star

Posted by "adonis0147 (via GitHub)" <gi...@apache.org>.
adonis0147 commented on PR #20355:
URL: https://github.com/apache/doris/pull/20355#issuecomment-1573238480

   Hi @zddr , this pr should add some tests. Please refer to `MultiTableMaterializedViewTest`.


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #20355: [fix](mtmv)create mv support star

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20355:
URL: https://github.com/apache/doris/pull/20355#issuecomment-1576220667

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] adonis0147 merged pull request #20355: [fix](MTMV) Support star expressions in select list

Posted by "adonis0147 (via GitHub)" <gi...@apache.org>.
adonis0147 merged PR #20355:
URL: https://github.com/apache/doris/pull/20355


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org