tanclary commented on code in PR #3732:
URL: https://github.com/apache/calcite/pull/3732#discussion_r1566039677
##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -2788,15 +2788,28 @@ public static double log(BigDecimal d0, BigDecimal d1) {
return Math.log(d0.doubleValue()) / Math.log(d1.doubleValue());
}
- /** SQL {@code LOG2(number)} function applied to double values. */
- public static @Nullable Double log2(double number) {
- return (number <= 0) ? null : log(number, 2);
+ /** SQL {@code LOG(number, number2)} function applied to double values.
+ * but return null when number2 is 0. */
+ public static @Nullable Double logMysqlSpark(double number, double number2) {
+ return (number <= 0) ? null : log(number, number2);
}
- /** SQL {@code LOG2(number)} function applied to
- * BigDecimal values. */
- public static @Nullable Double log2(BigDecimal number) {
- return log2(number.doubleValue());
+ /** SQL {@code LOG(number, number2)} function applied to double and
BigDecimal values.
Review Comment:
Does this function only exist because MySQL and Spark handle null behavior
differently? If so, you shouldn't need to add methods here. Just changed the
NullPolicy for that operator.
--
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]