kgyrtkirk commented on a change in pull request #2268:
URL: https://github.com/apache/hive/pull/2268#discussion_r635129376
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
##########
@@ -5031,7 +5038,7 @@ private RelNode genLogicalPlan(QB qb, boolean outerMostQB,
// Build Rel for Constraint checks
Pair<RelNode, RowResolver> constraintPair =
- genConstraintFilterLogicalPlan(qb, srcRel, outerNameToPosMap,
outerRR);
+ genConstraintFilterLogicalPlan(qb, selPair, outerNameToPosMap,
outerRR);
Review comment:
will this work okay when `selectRel == null`?
previous code was passing `srcRel` which is optionally the previous `srcRel`
##########
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:
I'm not sure about this; this block could be replaced with something
like
```
selectedRefs.addAll(originalInputRefs.sublist(selPair.right.getColumnInfos().size()))
```
which looks odd to me because it would mean that the `selected` ones may
only be a prefix of the original ones - is that true in every case?
shouldn't this code be checking the `ref` of the `RexInputRefs`
--
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]