You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "okumin (via GitHub)" <gi...@apache.org> on 2023/05/27 02:10:21 UTC

[GitHub] [hive] okumin commented on a diff in pull request #4363: HIVE-24606: Multi-stage materialized CTEs can lose intermediate data

okumin commented on code in PR #4363:
URL: https://github.com/apache/hive/pull/4363#discussion_r1207584190


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -1440,47 +1443,78 @@ public String toString() {
     }
   }
 
-  private List<Task<?>> toRealRootTasks(List<CTEClause> execution) {
-    List<Task<?>> cteRoots = new ArrayList<>();
-    List<Task<?>> cteLeafs = new ArrayList<>();
-    List<Task<?>> curTopRoots = null;

Review Comment:
   This looks like the root cause. In [the case I put in the ticket](https://issues.apache.org/jira/browse/HIVE-24606), there are the following dependencies.
   
   - `<root> -> a1`
   - `<root> -> x`
   - `<root> -> a2`
   - `a2 -> a1`
   
   But the old implementation tries to traverse CTEs in order of `a1` -> `x` -> `a2` -> `<root>`, following the appearance of AST.
   As a result, when it visits `a2`, the information of `a1` has gone and it fails to link `a2` with `a1`.



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org