chunweilei commented on a change in pull request #2282:
URL: https://github.com/apache/calcite/pull/2282#discussion_r533011251
##########
File path: core/src/main/java/org/apache/calcite/rex/RexSimplify.java
##########
@@ -332,6 +339,87 @@ private RexNode simplifyGenericNode(RexCall e) {
return rexBuilder.makeCall(e.getType(), e.getOperator(), operands);
}
+ /**
+ * Try to find a literal with the given value in the input list.
+ */
+ private int findLiteralIndex(List<RexNode> operands, long value) {
+ for (int i = 0; i < operands.size(); i++) {
+ if (operands.get(i).isA(SqlKind.LITERAL)) {
+ Comparable comparable = ((RexLiteral) operands.get(i)).getValue();
+ if (comparable instanceof BigDecimal && ((BigDecimal)
comparable).longValue() == value) {
+ return i;
+ }
Review comment:
Could you mark it that it only supports numeric type?
----------------------------------------------------------------
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]