danny0405 commented on a change in pull request #1448: [CALCITE-3332] Query
failed with AssertionError: cannot cast null as class java.math.BigDecima
URL: https://github.com/apache/calcite/pull/1448#discussion_r323073403
##########
File path:
core/src/main/java/org/apache/calcite/sql/fun/SqlMonotonicBinaryOperator.java
##########
@@ -100,21 +101,19 @@ public SqlMonotonicBinaryOperator(
return mono1;
}
assert getName().equals("*");
- if (!call.isOperandNull(0, true)) {
- BigDecimal value = call.getOperandLiteralValue(0, BigDecimal.class);
- switch (value == null ? 1 : value.signum()) {
- case -1:
- // negative constant * mono1 --> reverse mono1
- return mono1.reverse();
-
- case 0:
- // 0 * mono1 --> constant (zero)
- return SqlMonotonicity.CONSTANT;
-
- default:
- // positive constant * mono1 --> mono1
- return mono1;
- }
Review comment:
Add a comment to note that operand0 and operand1 will never be null when
code goes here.
----------------------------------------------------------------
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