zabetak commented on code in PR #6315:
URL: https://github.com/apache/hive/pull/6315#discussion_r2826439783
##########
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:
We have logs to indicate when a rule applies and when it doesn't so I don't
think we need this debug entry. Moreover, this is a utility method which in
principle could be used in other places so adding a rule specific message can
make the situation a bit confusing. Lastly, for someone not familiar with this
part of the code this debug message may sound alarming while in fact it is a
perfectly fine and legal exit condition for the method.
--
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]