[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16643239#comment-16643239 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on issue #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#issuecomment-428169701 Yes I know, I will get back to them later this week. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16643151#comment-16643151 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on issue #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#issuecomment-428155727 @pnowojski Thank you very much. I still have two hyperbolic functions ready. They are sinh(PR #6730 ) and tanh(PR #6736 ). If you have time, you can do a final confirmation. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16643116#comment-16643116 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on issue #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#issuecomment-428148803 Thanks for the contribution @yanghua, merged. I was waiting with the merge to give time for the discussion. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16643114#comment-16643114 ] ASF GitHub Bot commented on FLINK-10340: pnowojski closed pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/docs/dev/table/functions.md b/docs/dev/table/functions.md index 99a21b1f5eb..f888d790deb 100644 --- a/docs/dev/table/functions.md +++ b/docs/dev/table/functions.md @@ -1274,6 +1274,18 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of NUMERIC. +Return value type is DOUBLE. + + + {% highlight text %} @@ -1709,6 +1721,18 @@ atan2(NUMERIC1, NUMERIC2) + + +{% highlight java %} +NUMERIC.cosh() +{% endhighlight %} + + +Returns the hyperbolic cosine of NUMERIC. +Return value type is DOUBLE. + + + {% highlight java %} @@ -2145,6 +2169,18 @@ atan2(NUMERIC1, NUMERIC2) + + +{% highlight scala %} +NUMERIC.cosh() +{% endhighlight %} + + +Returns the hyperbolic cosine of NUMERIC. +Return value type is DOUBLE. + + + {% highlight scala %} diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala index 9a39bf504c6..e638051a2bd 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala @@ -337,6 +337,11 @@ trait ImplicitExpressionOperations { */ def power(other: Expression) = Power(expr, other) + /** +* Calculates the hyperbolic cosine of a given value. +*/ + def cosh() = Cosh(expr) + /** * Calculates the square root of a given value. */ diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/BuiltInMethods.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/BuiltInMethods.scala index f15da166725..34be86e0400 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/BuiltInMethods.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/BuiltInMethods.scala @@ -84,6 +84,9 @@ object BuiltInMethods { val ATAN = Types.lookupMethod(classOf[Math], "atan", classOf[Double]) val ATAN_DEC = Types.lookupMethod(classOf[SqlFunctions], "atan", classOf[JBigDecimal]) + val COSH = Types.lookupMethod(classOf[Math], "cosh", classOf[Double]) + val COSH_DEC = Types.lookupMethod(classOf[ScalarFunctions], "cosh", classOf[JBigDecimal]) + val ATAN2_DOUBLE_DOUBLE = Types.lookupMethod( classOf[Math], "atan2", diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/FunctionGenerator.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/FunctionGenerator.scala index bd05f9bd71e..58c476a36e0 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/FunctionGenerator.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/FunctionGenerator.scala @@ -211,6 +211,18 @@ object FunctionGenerator { DOUBLE_TYPE_INFO, BuiltInMethods.LOG2) + addSqlFunctionMethod( +COSH, +Seq(DOUBLE_TYPE_INFO), +DOUBLE_TYPE_INFO, +BuiltInMethods.COSH) + + addSqlFunctionMethod( +COSH, +Seq(BIG_DEC_TYPE_INFO), +DOUBLE_TYPE_INFO, +BuiltInMethods.COSH_DEC) + addSqlFunctionMethod( LN, Seq(DOUBLE_TYPE_INFO), diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/mathExpressions.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/mathExpressions.scala index 2f54ec2055b..6067130cd99 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/mathExpressions.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/mathExpressions.scala @@ -104,6 +104,20 @@ case class Log2(child: Expression) extends UnaryExpression with InputTypeSpec { override def toString: String = s"log2($child)" } +case class
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16642090#comment-16642090 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on issue #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#issuecomment-427896213 It's strange. It seems the Travis is in progress. But in detail page, it shows green. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16640005#comment-16640005 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on issue #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#issuecomment-427417452 @pnowojski and @xccui Does this PR look good to you? 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16637141#comment-16637141 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r222377224 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of NUMERIC. Return value type is DOUBLE. Review comment: I have updated this PR based on your suggestions. Thanks. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16636181#comment-16636181 ] ASF GitHub Bot commented on FLINK-10340: xccui commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r222127427 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of NUMERIC. Return value type is DOUBLE. Review comment: Hi @yanghua, please reformat the doc as usual. Besides, maybe we can move the return type description to a new line for now, like > Returns the hyperbolic cosine of \NUMERIC\. > The return type is \DOUBLE\. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16636174#comment-16636174 ] ASF GitHub Bot commented on FLINK-10340: xccui commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r222125558 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: Hi @pnowojski, yes, it's necessary to mark the data types of the functions' inputs/output, but maybe not inline with the description. I think it's better to assign separate columns for that. Anyway, incrementally adding the return types is not bad to me and we need to go over the whole function list at a time in the future. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16633740#comment-16633740 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221537661 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: @xccui if you think using `` is better I'm fine with that, I don't mind one way or the other. However I don't understand: > before reaching a consensus about the format and the internal implementation, I suggest to keep the current doc style, i.e., without mentioning the return type, for now. We are already following a convention that for all of the math functions we are dropping precision and returning `double`. What's the point of not documenting it? If you could guarantee me that we will document those return types lets say within a month, I would be fine with postponing it. However I don't believe something like that would happen, so I prefer to incrementally start adding this return type information right now. Later if someone will want, we can reformat the page. I do not see any downside to such incremental approach until that moment. > why still indicating the return type for each numeric function explicitly? How about adding a single note for that? since some of them can be implemented precisely (`abs`, `min`, `max`, `ceil`, ...), others can be for some variants (`power(DECIMAL, INT)`). We can state this general rule that functions returning `DOUBLE` are approximations, but we still need specific information for every function, whether it returns approximated (`DOUBLE`) or precise (`DECIMAL`) result. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16632834#comment-16632834 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221417800 ## File path: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala ## @@ -1093,6 +1093,47 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { math.sqrt(2.2).toString) } + @Test + def testCosh(): Unit = { +testAllApis( + 0.cosh(), + "0.cosh()", + "COSH(0)", + math.cosh(0).toString +) + +testAllApis( + -1.cosh(), + "-1.cosh()", + "COSH(-1)", + math.cosh(-1).toString Review comment: Please check the last test method, the data type of f22 is BigDecimal, so it has been tested. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16632833#comment-16632833 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221417745 ## File path: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/mathExpressions.scala ## @@ -104,6 +104,21 @@ case class Log2(child: Expression) extends UnaryExpression with InputTypeSpec { override def toString: String = s"log2($child)" } +case class Cosh(child: Expression) extends UnaryExpression with InputTypeSpec { Review comment: agree, It is not necessary to inherit it and will remove it. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16632832#comment-16632832 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221417664 ## File path: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala ## @@ -1093,6 +1093,47 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { math.sqrt(2.2).toString) } + @Test + def testCosh(): Unit = { +testAllApis( + 0.cosh(), + "0.cosh()", + "COSH(0)", + math.cosh(0).toString Review comment: ASAIK, Most of the trigonometric test cases of the `ScalarFunctionsTest` class use `toString` to reflect how the expected result value is derived. This is just test code and does not affect and bring performance issues to Flink. I think from the point of view of code readability, there is no problem with this writing. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16632805#comment-16632805 ] ASF GitHub Bot commented on FLINK-10340: xccui commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221416887 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: Besides, now that > the (most?) popular convention in SQL is to return DOUBLE if the result is not precise why still indicating the return type for each numeric function explicitly? How about adding a single note for that? 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16632803#comment-16632803 ] ASF GitHub Bot commented on FLINK-10340: xccui commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221416735 ## File path: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala ## @@ -1093,6 +1093,47 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { math.sqrt(2.2).toString) } + @Test + def testCosh(): Unit = { +testAllApis( + 0.cosh(), + "0.cosh()", + "COSH(0)", + math.cosh(0).toString +) + +testAllApis( + -1.cosh(), + "-1.cosh()", + "COSH(-1)", + math.cosh(-1).toString Review comment: Now that you add the function for `BigDecimal` type, it's better to test it here. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16632801#comment-16632801 ] ASF GitHub Bot commented on FLINK-10340: xccui commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221416690 ## File path: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/mathExpressions.scala ## @@ -104,6 +104,21 @@ case class Log2(child: Expression) extends UnaryExpression with InputTypeSpec { override def toString: String = s"log2($child)" } +case class Cosh(child: Expression) extends UnaryExpression with InputTypeSpec { Review comment: Why do we need to extend `InputTypeSpec` here? 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16632800#comment-16632800 ] ASF GitHub Bot commented on FLINK-10340: xccui commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221416652 ## File path: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala ## @@ -1093,6 +1093,47 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { math.sqrt(2.2).toString) } + @Test + def testCosh(): Unit = { +testAllApis( + 0.cosh(), + "0.cosh()", + "COSH(0)", + math.cosh(0).toString Review comment: Use constant `String` here to get rid of extra calculation. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16632799#comment-16632799 ] ASF GitHub Bot commented on FLINK-10340: xccui commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221416622 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: 1. I still suggest to use the tag `` for attribute references like all the other functions do. The tag `` has different styles in different code environments (e.g., lines enclosed with `{% highlight XXX %}`). 2. The SQL doc convention was sourced from Calcite (https://calcite.apache.org/docs/reference.html#operators-and-functions) and when I reworked this page, the convention was reserved. 3. I also agree that the return type is important to users. However, before reaching a consensus about the format and the internal implementation, I suggest to keep the current doc style, i.e., without mentioning the return type, for now. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16632019#comment-16632019 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221296090 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: @pnowojski changed, `` works fine. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16631789#comment-16631789 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221240777 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: You can use `NUMERIC` to achieve the same result. It is already widely used in this same file. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16631765#comment-16631765 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221233831 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: @pnowojski It can not be parsed accurately, it shows : ``` Returns the hyperbolic cosine of `NUMERIC`. Return value type is `DOUBLE`. ``` 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16631641#comment-16631641 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221201513 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: 1. in that case I would suggest DOUBLE and NUMERIC. @yanghua could you make sure that the doc page renders correctly (`./build_docs.sh -i` script in `docs` directory allows you to run the docs locally). 2. https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql.html#data-types here the types are in capital letter, however I don't mind either way. 3. Unfortunately this is either hard, or impossible: a) some functions can not be implemented returning accurate `DECIMAL`, like most of the math functions (`cos`, `sqrt`, `log`, `ln`, ). b) some function require extra time and effort. Like specialised version of `power(DECIMAL, INT)` could return precise `DECIMAL`, while `power(INT, DECIMAL)` can not. I think the (most?) popular convention in SQL is to return `DOUBLE` if the result is not precise, to avoid silent precision losses. But correct `DECIMAL` handling is generally speaking bigger topic to sort out in Flink in the future. For example I do not like that we provide functions like `DOUBLE COS(DECIMAL)`, because this also gives an opportunity to semi silent precision losses. However regardless of that, letting user know whether the function returns precise or approximate result is must have (vide non obvious case of `POWER(2.5, 2)`). Also letting user know what's the return type of the function is also important. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16631324#comment-16631324 ] ASF GitHub Bot commented on FLINK-10340: xccui commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221136490 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: 1. This page is not a pure markdown doc. We cannot use backquote here. 2. Conventionally, we use small letters for SQL attributes and capital letters for Java/Scala attributes. 3. I don't think the return type should be marked like that. In most cases, it should be identical to the inputs' types (e.g., if the input is a `bigdecimal`, we should also return a `begdecimal` instead of a fixed `double`). 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16631322#comment-16631322 ] ASF GitHub Bot commented on FLINK-10340: xccui commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r221136490 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: 1. This page is not a pure markdown doc. We cannot use backquote here. 2. Conventionally, we use small letters for SQL attributes and capital letters for Java/Scala attributes. 3. I don't think the return type should be marked like that. In most cases, it should be identical with the input's types. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16630340#comment-16630340 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r220904972 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: Changed~ 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16630294#comment-16630294 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r220900367 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: Can you make consistent with for example with this: https://ci.apache.org/projects/flink/flink-docs-master/dev/table/tableApi.html#data-types So capital letters mono space `DOUBLE` and `NUMERIC`? (using ` character in md.) 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16630291#comment-16630291 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r220900367 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: aren't the `DOUBLE` and `NUMERIC` more consistent? For example with this: https://ci.apache.org/projects/flink/flink-docs-master/dev/table/tableApi.html#data-types 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16630282#comment-16630282 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r220897401 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: @pnowojski updated `double` and `DOUBLE` with `double`. It's OK? 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16630272#comment-16630272 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r220892667 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Return value type is DOUBLE. Review comment: Could you make type references consistent `TYPE_NAME? You are using any combination of small case, capital case, with or without italic :) 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16629942#comment-16629942 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on issue #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#issuecomment-425007484 @pnowojski I have updated the PR. Please review again, thanks. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16629808#comment-16629808 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r220806323 ## File path: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala ## @@ -996,6 +996,47 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { math.sqrt(2.2).toString) } + @Test + def testCosh(): Unit = { +testAllApis( + 0.cosh(), + "0.cosh()", + "COSH(0)", + math.cosh(0).toString +) + +testAllApis( + -1.cosh(), + "-1.cosh()", + "COSH(-1)", + math.cosh(-1).toString +) + +testAllApis( + 'f6.cosh(), + "f6.cosh", + "COSH(f6)", + math.cosh(4.6D).toString) + +testAllApis( + 'f7.cosh(), + "f7.cosh", + "COSH(f7)", + math.cosh(3).toString) + +testAllApis( + 'f4.cosh(), + "f4.cosh", + "COSH(f4)", + math.cosh(44L).toString) + +testAllApis( + 'f22.cast(Types.DOUBLE).cosh(), Review comment: Here is a reference to `power` outdated test cases. Has been removed. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16628754#comment-16628754 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r22018 ## File path: docs/dev/table/functions.md ## @@ -1274,6 +1274,17 @@ ATAN2(numeric1, numeric2) + + +{% highlight text %} +COSH(numeric) +{% endhighlight %} + + +Returns the hyperbolic cosine of numeric. Review comment: This documentation is desperately missing information about returned types. As it is now, user has no idea that for example all `POWER` invocations, even `POWER(2, 5)` yields **SILENTLY** inaccurate results. Same applies to `COSH(2)`, however in the case of `COSH` this is more or less expected. I have filled the ticket regarding the already existing functions https://issues.apache.org/jira/browse/FLINK-10438, but could you add such information here for `COSH`? 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16628755#comment-16628755 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r220539663 ## File path: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala ## @@ -996,6 +996,47 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { math.sqrt(2.2).toString) } + @Test + def testCosh(): Unit = { +testAllApis( + 0.cosh(), + "0.cosh()", + "COSH(0)", + math.cosh(0).toString +) + +testAllApis( + -1.cosh(), + "-1.cosh()", + "COSH(-1)", + math.cosh(-1).toString +) + +testAllApis( + 'f6.cosh(), + "f6.cosh", + "COSH(f6)", + math.cosh(4.6D).toString) + +testAllApis( + 'f7.cosh(), + "f7.cosh", + "COSH(f7)", + math.cosh(3).toString) + +testAllApis( + 'f4.cosh(), + "f4.cosh", + "COSH(f4)", + math.cosh(44L).toString) + +testAllApis( + 'f22.cast(Types.DOUBLE).cosh(), Review comment: Why are you casting to double here? If so, what's the point of providing `COSH_DEC`? 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16628756#comment-16628756 ] ASF GitHub Bot commented on FLINK-10340: pnowojski commented on a change in pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#discussion_r220536634 ## File path: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala ## @@ -996,6 +996,47 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { math.sqrt(2.2).toString) } + @Test + def testCosh(): Unit = { +testAllApis( + 0.cosh(), + "0.cosh()", + "COSH(0)", + math.cosh(0).toString +) + +testAllApis( + -1.cosh(), + "-1.cosh()", + "COSH(-1)", + math.cosh(-1).toString +) + +testAllApis( + 'f6.cosh(), + "f6.cosh", + "COSH(f6)", + math.cosh(4.6D).toString) + +testAllApis( + 'f7.cosh(), + "f7.cosh", + "COSH(f7)", + math.cosh(3).toString) + +testAllApis( + 'f4.cosh(), Review comment: nit: move `f4` case before `f6` (so that they are tested in order)? 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16616215#comment-16616215 ] ASF GitHub Bot commented on FLINK-10340: yanghua commented on issue #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700#issuecomment-421539082 @xccui When you have time, can you take a look at this PR? thanks. 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10340) Add Cosh math function supported in Table API and SQL
[ https://issues.apache.org/jira/browse/FLINK-10340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16615604#comment-16615604 ] ASF GitHub Bot commented on FLINK-10340: yanghua opened a new pull request #6700: [FLINK-10340][table] Add Cosh math function supported in Table API and SQL URL: https://github.com/apache/flink/pull/6700 ## What is the purpose of the change *This pull request adds Cosh math function supported in Table API and SQL* ## Brief change log - *Add Cosh math function supported in Table API and SQL* ## Verifying this change This change is already covered by existing tests, such as *ScalarFunctionsTest#testCosh*. ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): (yes / **no**) - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**) - The serializers: (yes / **no** / don't know) - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know) - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / **no** / don't know) - The S3 file system connector: (yes / **no** / don't know) ## Documentation - Does this pull request introduce a new feature? (yes / **no**) - If yes, how is the feature documented? (not applicable / **docs** / JavaDocs / not documented) 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: us...@infra.apache.org > Add Cosh math function supported in Table API and SQL > - > > Key: FLINK-10340 > URL: https://issues.apache.org/jira/browse/FLINK-10340 > Project: Flink > Issue Type: Sub-task > Components: Table API SQL >Affects Versions: 1.6.0 >Reporter: Sergey Tsvetkov >Assignee: vinoyang >Priority: Minor > Labels: pull-request-available > > Implement udf of cosh, just like in oracle > [https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions031.htm#SQLRF00623] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)