soumyakanti3578 commented on code in PR #4478:
URL: https://github.com/apache/hive/pull/4478#discussion_r1278204777


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java:
##########
@@ -2631,6 +2631,21 @@ private RelNode genJoinRelNode(RelNode leftRel, String 
leftTableAlias, RelNode r
               unparseTranslator.addIdentifierTranslation((ASTNode) child);
             }
             namedColumns.add(columnName);
+
+            // if leftTableAlias is null, set it to the last tableAlias that 
contains the
+            // column columnName
+            if (leftTableAlias == null) {
+              Map<String, Map<String, ColumnInfo>> leftRslvMap = 
leftRR.getRslvMap();
+              for (String tableAlias: leftRR.getTableNames()) {
+                if (!leftRslvMap.containsKey(tableAlias)) {
+                  continue;
+                }
+                if (leftRslvMap.get(tableAlias).containsKey(columnName)) {
+                  leftTableAlias = tableAlias;

Review Comment:
   Queries and results look valid with this patch.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to