julianhyde commented on code in PR #3954:
URL: https://github.com/apache/calcite/pull/3954#discussion_r1751120720
##########
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java:
##########
@@ -528,24 +531,94 @@ public class RexImpTable {
public static final MemberExpression BOXED_TRUE_EXPR =
Expressions.field(null, Boolean.class, "TRUE");
- private final ImmutableMap<SqlOperator, RexCallImplementor> map;
+ private final ImmutableMultimap<SqlOperator, OpImplementatorPair> scalarMap;
private final ImmutableMap<SqlAggFunction, Supplier<? extends
AggImplementor>> aggMap;
private final ImmutableMap<SqlAggFunction, Supplier<? extends
WinAggImplementor>> winAggMap;
private final ImmutableMap<SqlMatchFunction, Supplier<? extends
MatchImplementor>> matchMap;
private final ImmutableMap<SqlOperator, Supplier<? extends
TableFunctionCallImplementor>>
tvfImplementorMap;
private RexImpTable(Builder builder) {
- this.map = ImmutableMap.copyOf(builder.map);
+ this.scalarMap = ImmutableMultimap.copyOf(builder.scalarMap.map);
this.aggMap = ImmutableMap.copyOf(builder.aggMap);
this.winAggMap = ImmutableMap.copyOf(builder.winAggMap);
this.matchMap = ImmutableMap.copyOf(builder.matchMap);
this.tvfImplementorMap = ImmutableMap.copyOf(builder.tvfImplementorMap);
}
+ /**
+ * A pairing of an SqlOperator and a RexCallImplementor. OpImplementor pairs
+ * will be values in the scalar operators map. This allows an "==" check on
+ * the SqlOperator to select the correct operator since the hash of operators
+ * may not be unique.
+ */
+ private static class OpImplementatorPair {
Review Comment:
Could you use `Pair<SqlOperator, RexCallImplementor>` instead? I don't think
`hashCode` or `equals` are ever called on the values in a map or
array-list-multimap.
--
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]