kasakrisz commented on a change in pull request #2268:
URL: https://github.com/apache/hive/pull/2268#discussion_r635190684
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
##########
@@ -3475,15 +3475,22 @@ private RelNode genFilterLogicalPlan(QB qb, RelNode
srcRel, ImmutableMap<String,
return null;
}
- RowResolver inputRR = relToHiveRR.get(srcRel);
+ RowResolver inputRR = relToHiveRR.get(selPair.left);
RexNode constraintUDF = RexNodeTypeCheck.genConstraintsExpr(
conf, cluster.getRexBuilder(), getTargetTable(qb, dest),
updating(dest), inputRR);
if (constraintUDF == null) {
return null;
}
- RelNode constraintRel = genFilterRelNode(constraintUDF, srcRel,
outerNameToPosMap, outerRR);
- return new Pair<>(constraintRel, inputRR);
+ RelNode constraintRel = genFilterRelNode(constraintUDF, selPair.left,
outerNameToPosMap, outerRR);
+
+ List<RexNode> originalInputRefs = toRexNodeList(selPair.left);
+ List<RexNode> selectedRefs = Lists.newArrayList();
+ for (int index = 0; index < selPair.right.getColumnInfos().size();
index++) {
+ selectedRefs.add(originalInputRefs.get(index));
+ }
Review comment:
The Project may contains columns which are not in the top Project and
not present in the row schema. However these columns may referenced in
constraint filter expressions or sort and order by keys.
I found that at the end of Project generation all columns coming from the
input RowResolver of the Project are added to the output RowResolver:
https://github.com/apache/hive/blob/d0d3f0aa50fa7b50ec74cae0dda0b93271799313/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java#L4738
Since these are added to the end of the list the selected ones should be a
prefix of the full list.
--
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]