xccui commented on a change in pull request #6465: [FLINK-10008] [table]
Improve the LOG function in Table to support bases less than 1
URL: https://github.com/apache/flink/pull/6465#discussion_r207561906
##########
File path:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/functions/ScalarFunctions.scala
##########
@@ -103,11 +103,13 @@ object ScalarFunctions {
if (x <= 0.0) {
throw new IllegalArgumentException(s"x of 'log(base, x)' must be > 0,
but x = $x")
}
- if (base <= 1.0) {
- throw new IllegalArgumentException(s"base of 'log(base, x)' must be > 1,
but base = $base")
- } else {
- Math.log(x) / Math.log(base)
+ if (base.compareTo(1.0) == 0) {
+ throw new IllegalArgumentException(s"base of 'log(base, x)' can not be
1")
+ }
+ if (base.compareTo(0.0) <= 0) {
Review comment:
Same as above.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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