You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/08/04 04:41:11 UTC

[GitHub] Xpray commented on a change in pull request #6465: [FLINK-10008] [table] Improve the LOG function in Table to support bases less than 1

Xpray 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_r207699770
 
 

 ##########
 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:
   hi @xccui , you're right, there's no need to call ``compareTo``

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services