[ 
https://issues.apache.org/jira/browse/FLINK-10008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16569052#comment-16569052
 ] 

ASF GitHub Bot commented on FLINK-10008:
----------------------------------------

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:
[email protected]


> Improve the LOG function in Table to support bases less than 1
> --------------------------------------------------------------
>
>                 Key: FLINK-10008
>                 URL: https://issues.apache.org/jira/browse/FLINK-10008
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API &amp; SQL
>            Reporter: Xingcan Cui
>            Assignee: Ruidong Li
>            Priority: Major
>              Labels: pull-request-available
>
> Currently, the {{LOG}} function in SQL/Table API restricts the base to be 
> greater than 1. We should extend it to support bases less than 1 (e.g., 
> {{LOG(0.1, 0.01)}} should return 2.0).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to