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 81c08194ebd8..7083950a2a8c 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 @@ -1115,16 +1115,10 @@ 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 && 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; + if (input != null) { + currentInput = input; } - currentInput = input; } - return currentInput; }