This is an automated email from the ASF dual-hosted git repository. twalthr pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit bbd2225c8a0b9c2af1bdd89f8f99b86d007802a6 Author: Timo Walther <twal...@apache.org> AuthorDate: Fri Mar 1 10:26:39 2019 +0100 [hotfix][table-api] Uncouple case classes from math expressions --- .../apache/flink/table/api/scala/expressionDsl.scala | 20 ++++++++++++++++++++ .../table/expressions/ScalarFunctionsTest.scala | 20 ++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala index 5e6549d..1100f0f 100644 --- a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala +++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala @@ -1431,4 +1431,24 @@ object nullOf { } } +/** + * Calculates the logarithm of the given value. + */ +object log { + + /** + * Calculates the natural logarithm of the given value. + */ + def apply(value: Expression): Expression = { + Log(null, value) + } + + /** + * Calculates the logarithm of the given value to the given base. + */ + def apply(base: Expression, value: Expression): Expression = { + Log(base, value) + } +} + // scalastyle:on object.name diff --git a/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala b/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala index e5e8dc2..4a32eb8 100644 --- a/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala +++ b/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala @@ -1712,37 +1712,37 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { math.atan2(0.42.toByte, 0.toByte).toString) testAllApis( - Atan2('f26, 'f25), + atan2('f26, 'f25), "atan2(f26, f25)", "ATAN2(f26, f25)", math.atan2(0.toShort, 0.toShort).toString) testAllApis( - Atan2('f27, 'f27), + atan2('f27, 'f27), "atan2(f27, f27)", "ATAN2(f27, f27)", math.atan2(0.toLong, 0.toLong).toString) testAllApis( - Atan2('f28, 'f28), + atan2('f28, 'f28), "atan2(f28, f28)", "ATAN2(f28, f28)", math.atan2(0.45.toFloat, 0.45.toFloat).toString) testAllApis( - Atan2('f29, 'f29), + atan2('f29, 'f29), "atan2(f29, f29)", "ATAN2(f29, f29)", math.atan2(0.46, 0.46).toString) testAllApis( - Atan2('f30, 'f30), + atan2('f30, 'f30), "atan2(f30, f30)", "ATAN2(f30, f30)", math.atan2(1, 1).toString) testAllApis( - Atan2('f31, 'f31), + atan2('f31, 'f31), "atan2(f31, f31)", "ATAN2(f31, f31)", math.atan2(-0.1231231321321321111, -0.1231231321321321111).toString) @@ -1933,8 +1933,8 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { ) testTableApi( - Log('f6), - "Log(f6)", + log('f6), + "log(f6)", "1.5260563034950492" ) @@ -1967,8 +1967,8 @@ class ScalarFunctionsTest extends ScalarTypesTestBase { ) testTableApi( - Log(10, 100), - "Log(10, 100)", + log(10, 100), + "log(10, 100)", "2.0" ) }