You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/07/12 19:55:33 UTC

[GitHub] [incubator-doris] xy720 commented on a change in pull request #6184: [Bug-Fix] Fix bug that show view report "Unresolved table reference" error

xy720 commented on a change in pull request #6184:
URL: https://github.com/apache/incubator-doris/pull/6184#discussion_r667949468



##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/ShowViewStmt.java
##########
@@ -114,20 +114,20 @@ public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
             View view = (View) table;
             List<TableRef> tblRefs = Lists.newArrayList();
             // get table refs instead of get tables because it don't need to check table's validity
-            getTableRefs(view, tblRefs);
+            getTableRefs(analyzer, view, tblRefs);
             for (TableRef tblRef : tblRefs) {
-                tblRef.analyze(analyzer);
+                tblRef.getName().analyze(analyzer);

Review comment:
       Because we only need TableName to compare. Besides, there are many unnecessary processes in analyze() in TableRef.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
##########
@@ -324,17 +324,22 @@ public void getTables(Analyzer analyzer, Map<Long, Table> tableMap, Set<String>
     }
 
     @Override
-    public void getTableRefs(List<TableRef> tblRefs, Set<String> parentViewNameSet) {
-        getWithClauseTableRefs(tblRefs, parentViewNameSet);
+    public void getTableRefs(Analyzer analyzer, List<TableRef> tblRefs, Set<String> parentViewNameSet) {
+        getWithClauseTableRefs(analyzer, tblRefs, parentViewNameSet);
         for (TableRef tblRef : fromClause_) {
-            if (tblRef instanceof InlineViewRef) {
-                QueryStmt inlineStmt = ((InlineViewRef) tblRef).getViewStmt();
-                inlineStmt.getTableRefs(tblRefs, parentViewNameSet);
-            } else {
-                if (isViewTableRef(tblRef.getName().toString(), parentViewNameSet)) {
-                    continue;
+            try {
+                tblRef = analyzer.resolveTableRef(tblRef);

Review comment:
       Ok




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