rubenada commented on a change in pull request #1157: [CALCITE-2969] Improve
design of join-like relational expressions
URL: https://github.com/apache/calcite/pull/1157#discussion_r280464634
##########
File path:
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoinRule.java
##########
@@ -71,26 +71,25 @@
EnumerableRules.LOGGER.debug(e.toString());
return null;
}
+ } else {
+ RelNode newRel;
+ try {
+ newRel = EnumerableHashJoin.create(
+ left,
+ right,
+ info.getEquiCondition(left, right, cluster.getRexBuilder()),
+ join.getVariablesSet(),
+ join.getJoinType());
+ } catch (InvalidRelException e) {
+ EnumerableRules.LOGGER.debug(e.toString());
+ return null;
+ }
+ if (!info.isEqui()) {
Review comment:
I know this is not directly related to the purpose of this PR, but I wonder
if this would be a good opportunity to replace the EnumerableFilter by an
EnumerableCalc. The thing with EnumerableFilter is that it has no
implementation (its `implement` method throws an
`UnsupportedOperationException` and it has a comment that mentions that
"EnumerableCalc is always better"). So here we are creating an EnumerableFilter
which, in the best-case scenario, will require an extra rule to be converted to
an EnumerableCalc (in the worst-case scenario, if the conversion does not
happen for whatever reason, an UnsupportedOperationException will be thrown).
Maybe we could avoid this issue by creating directly the EnumerableCalc at this
point, i.e. something like:
```
if (!info.isEqui())
{
final RexProgramBuilder programBuilder = new RexProgramBuilder(
newRel.getRowType(),
cluster.getRexBuilder());
programBuilder.addIdentity();
programBuilder.addCondition(info.getRemaining(cluster.getRexBuilder()));
newRel = EnumerableCalc.create(newRel, programBuilder.getProgram());
}
```
----------------------------------------------------------------
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]
With regards,
Apache Git Services