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


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelOptUtil.java:
##########
@@ -1107,7 +1107,15 @@ public static List<RelFieldCollation> 
getNewRelFieldCollations(
     Set<Integer> needed = new HashSet<>();
     for (RelFieldCollation fc : sortCollation.getFieldCollations()) {
       needed.add(fc.getFieldIndex());
-      final RexNode node = 
project.getProjects().get(map.getTarget(fc.getFieldIndex()));
+      int target;
+      try {
+        target = map.getTarget(fc.getFieldIndex());
+      } catch (Mappings.NoElementException e) {
+        // If there is no mapping for this field, we cannot push down the sort
+        LOG.error("Missing target mapping: {}", e.toString());
+        return null;
+      }

Review Comment:
   Thanks for pointing me to this API, I was trying to find something like this!



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