You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by pt...@apache.org on 2023/09/11 17:05:55 UTC

[spark] branch branch-3.5 updated: [SPARK-45109][SQL][CONNECT][FOLLOWUP] Fix log function in Connect

This is an automated email from the ASF dual-hosted git repository.

ptoth pushed a commit to branch branch-3.5
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.5 by this push:
     new ecf507fd976 [SPARK-45109][SQL][CONNECT][FOLLOWUP] Fix log function in Connect
ecf507fd976 is described below

commit ecf507fd976752eb466ccba4a7ed005c1542a22d
Author: Peter Toth <pe...@gmail.com>
AuthorDate: Mon Sep 11 19:04:41 2023 +0200

    [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 <pe...@gmail.com>
    Signed-off-by: Peter Toth <pe...@gmail.com>
    (cherry picked from commit 6c3d9f5d89dfc974a5f799b73325aebf10f3cf16)
    Signed-off-by: Peter Toth <pe...@gmail.com>
---
 .../src/main/scala/org/apache/spark/sql/functions.scala |   2 +-
 .../query-tests/explain-results/function_log.explain    |   2 +-
 .../resources/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 16e787f825a..8f55954a63f 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 d3c3743b1ef..66b782ac817 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 <empty>, [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 1b2d0ed0b14..ababbc52d08 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 548fb480dd2..ecb87a1fc41 100644
Binary files a/connector/connect/common/src/test/resources/query-tests/queries/function_log.proto.bin and b/connector/connect/common/src/test/resources/query-tests/queries/function_log.proto.bin differ


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org