[ 
https://issues.apache.org/jira/browse/HIVE-24841?focusedWorklogId=562316&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-562316
 ]

ASF GitHub Bot logged work on HIVE-24841:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Mar/21 11:48
            Start Date: 08/Mar/21 11:48
    Worklog Time Spent: 10m 
      Work Description: kgyrtkirk commented on a change in pull request #2035:
URL: https://github.com/apache/hive/pull/2035#discussion_r589364183



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/optimizer/ParallelEdgeFixer.java
##########
@@ -256,9 +257,20 @@ private static String extractColumnName(ExprNodeDesc expr) 
throws SemanticExcept
   public static Optional<Set<String>> colMappingInverseKeys(ReduceSinkOperator 
rs) {
     Map<String, String> ret = new HashMap<String, String>();
     Map<String, ExprNodeDesc> exprMap = rs.getColumnExprMap();
+    Set<String> neededColumns = new HashSet<String>();
     try {
       for (Entry<String, ExprNodeDesc> e : exprMap.entrySet()) {
-        ret.put(extractColumnName(e.getValue()), e.getKey());
+        String columnName = extractColumnName(e.getValue());
+        if (rs.getSchema().getColumnInfo(e.getKey()) == null) {
+          // ignore incorrectly mapped columns (if there's any) - but require 
its input to be present
+          neededColumns.add(columnName);
+        } else {
+          ret.put(columnName, e.getKey());
+        }
+      }
+      neededColumns.removeAll(ret.keySet());
+      if (!neededColumns.isEmpty()) {
+        throw new SemanticException("There is no way to compute: " + 
neededColumns);

Review comment:
       I've not logged these exceptions because a lot of them may happen during 
optimization - especially during swo tries uncover new possibilities.
   
   Its already a challenging to make sense out from only looking at the swo 
logs.
   
   But some logging will still happen around 
[here](https://github.com/apache/hive/blob/fb25765b831cc9269d104b5825050a7cbee0d8b6/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SharedWorkOptimizer.java#L1852)
  why the optimization may not kick in.
   
   




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

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 562316)
    Time Spent: 0.5h  (was: 20m)

> Parallel edge fixer may run into NPE when RS is missing a duplicate column 
> from the output schema
> -------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-24841
>                 URL: https://issues.apache.org/jira/browse/HIVE-24841
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> This may mean that the RS has an incorrect schema - but that will be 
> investigated separately



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to