You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2020/07/08 08:51:24 UTC

[spark] branch branch-3.0 updated: [SPARK-32214][SQL] The type conversion function generated in makeFromJava for "other" type uses a wrong variable

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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 0939730  [SPARK-32214][SQL] The type conversion function generated in makeFromJava for "other"  type uses a wrong variable
0939730 is described below

commit 0939730c555c1b931b22a614fcc46ab344f0676f
Author: Kousuke Saruta <sa...@oss.nttdata.com>
AuthorDate: Wed Jul 8 17:46:25 2020 +0900

    [SPARK-32214][SQL] The type conversion function generated in makeFromJava for "other"  type uses a wrong variable
    
    ### What changes were proposed in this pull request?
    
    This PR fixes an inconsistency in `EvaluatePython.makeFromJava`, which creates a type conversion function for some Java/Scala types.
    
    `other` is a type but it should actually pass `obj`:
    
    ```scala
    case other => (obj: Any) => nullSafeConvert(other)(PartialFunction.empty)
    ```
    
    This does not change the output because it always returns `null` for unsupported datatypes.
    
    ### Why are the changes needed?
    
    To make the codes coherent, and consistent.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    No behaviour change.
    
    Closes #29029 from sarutak/fix-makeFromJava.
    
    Authored-by: Kousuke Saruta <sa...@oss.nttdata.com>
    Signed-off-by: HyukjinKwon <gu...@apache.org>
    (cherry picked from commit 371b35d2e0ab08ebd853147c6673de3adfad0553)
    Signed-off-by: HyukjinKwon <gu...@apache.org>
---
 .../scala/org/apache/spark/sql/execution/python/EvaluatePython.scala    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/python/EvaluatePython.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/python/EvaluatePython.scala
index 520afad..7fe3263 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/python/EvaluatePython.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/python/EvaluatePython.scala
@@ -198,7 +198,7 @@ object EvaluatePython {
 
     case udt: UserDefinedType[_] => makeFromJava(udt.sqlType)
 
-    case other => (obj: Any) => nullSafeConvert(other)(PartialFunction.empty)
+    case other => (obj: Any) => nullSafeConvert(obj)(PartialFunction.empty)
   }
 
   private def nullSafeConvert(input: Any)(f: PartialFunction[Any, Any]): Any = {


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