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


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelOptUtil.java:
##########
@@ -1107,7 +1107,14 @@ 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 = map.getTargetOpt(fc.getFieldIndex());
+      if (target == -1) {
+        // If there is no mapping for this field, we cannot push down the sort
+        LOG.debug("Missing target mapping for field index: {}. Cannot apply " +
+            "HiveProjectSort[Exchange]TransposeRule", fc.getFieldIndex());

Review Comment:
   Change the following line in data/conf/hive-log4j2.properties and see what 
it gives:
   ```
   logger.CBORuleLogger.level = DEBUG
   ```
   the output is pretty detailed and can become even more verbose by enabling 
the `FULL_PLAN` marker
   ```
   logger.CBORuleLogger.filter.marker.onMatch = ACCEPT
   ```



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