commit 9335f893e10e10e11f742ade35af0fe264e8ebe1 Author: Thejas Nair Date: Sun May 31 11:37:19 2015 -0700 parent view check should not stop at first non view query block diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java index c8ae235..cb0b680 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/PlanUtils.java @@ -983,7 +983,11 @@ public static ReadEntity getParentViewInfo(String alias_id, currentAlias = currentAlias.replace(SemanticAnalyzer.SUBQUERY_TAG_1, "") .replace(SemanticAnalyzer.SUBQUERY_TAG_2, ""); ReadEntity input = viewAliasToInput.get(currentAlias); - if (input == null) { + if (input == null && currentInput != null) { + // To handle the case of - select * from (select * from V1) A; + // the currentInput != null check above is needed. + // the alias list that case would be A:V1:T. Lookup on A would return null, + // we need to go further to find the view inside it. return currentInput; } currentInput = input;