From 6c3d9f5d89dfc974a5f799b73325aebf10f3cf16 Mon Sep 17 00:00:00 2001 From: Peter Toth Date: Mon, 11 Sep 2023 19:04:41 +0200 Subject: [PATCH] [SPARK-45109][SQL][CONNECT][FOLLOWUP] Fix log function in Connect ### What changes were proposed in this pull request? This is a follow-up PR to https://github.com/apache/spark/pull/42863, the 1 argument `log` function should also point to `ln`. ### Why are the changes needed? Bugfix. ### Does this PR introduce _any_ user-facing change? No, these Spark Connect functions haven't been released. ### How was this patch tested? Exsiting UTs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #42869 from peter-toth/SPARK-45109-fix-log. Authored-by: Peter Toth Signed-off-by: Peter Toth --- .../scala/org/apache/spark/sql/functions.scala | 2 +- .../explain-results/function_log.explain | 2 +- .../query-tests/queries/function_log.json | 2 +- .../query-tests/queries/function_log.proto.bin | Bin 172 -> 171 bytes 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/functions.scala b/connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/functions.scala index ab71cb801863b..b2102d4ba5544 100644 --- a/connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/functions.scala +++ b/connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/functions.scala @@ -2632,7 +2632,7 @@ object functions { * @group math_funcs * @since 3.4.0 */ - def log(e: Column): Column = Column.fn("log", e) + def log(e: Column): Column = ln(e) /** * Computes the natural logarithm of the given column. diff --git a/connector/connect/common/src/test/resources/query-tests/explain-results/function_log.explain b/connector/connect/common/src/test/resources/query-tests/explain-results/function_log.explain index d3c3743b1ef40..66b782ac8170d 100644 --- a/connector/connect/common/src/test/resources/query-tests/explain-results/function_log.explain +++ b/connector/connect/common/src/test/resources/query-tests/explain-results/function_log.explain @@ -1,2 +1,2 @@ -Project [LOG(E(), b#0) AS LOG(E(), b)#0] +Project [ln(b#0) AS ln(b)#0] +- LocalRelation , [id#0L, a#0, b#0, d#0, e#0, f#0, g#0] diff --git a/connector/connect/common/src/test/resources/query-tests/queries/function_log.json b/connector/connect/common/src/test/resources/query-tests/queries/function_log.json index 1b2d0ed0b1447..ababbc52d088d 100644 --- a/connector/connect/common/src/test/resources/query-tests/queries/function_log.json +++ b/connector/connect/common/src/test/resources/query-tests/queries/function_log.json @@ -13,7 +13,7 @@ }, "expressions": [{ "unresolvedFunction": { - "functionName": "log", + "functionName": "ln", "arguments": [{ "unresolvedAttribute": { "unparsedIdentifier": "b" diff --git a/connector/connect/common/src/test/resources/query-tests/queries/function_log.proto.bin b/connector/connect/common/src/test/resources/query-tests/queries/function_log.proto.bin index 548fb480dd27e65e18dd064ce7d7bfeb5215e293..ecb87a1fc410205cf387950c7e60b407d310d50e 100644 GIT binary patch delta 29 kcmZ3(xSElTi%Eb{YRN>l>3qCW++0jKc|xp0%v_8~09V}wC;$Ke delta 30 lcmZ3@xQ3C9i%Eb{YUxC_>HK_BJY38<`RPKeLd;x@NdRB=1(g5*