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

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


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 7338ab3  [SPARK-35791][SQL] Release on-going map properly for 
NULL-aware ANTI join
7338ab3 is described below

commit 7338ab31a4a71d7e01f2005ad3a5e8984c1d5db0
Author: Cheng Su <[email protected]>
AuthorDate: Thu Jun 17 13:57:35 2021 +0800

    [SPARK-35791][SQL] Release on-going map properly for NULL-aware ANTI join
    
    ### What changes were proposed in this pull request?
    
    NULL-aware ANTI join (https://issues.apache.org/jira/browse/SPARK-32290) 
detects NULL join keys during building the map for `HashedRelation`, and will 
immediately return `HashedRelationWithAllNullKeys` without taking care of the 
map built already. Before returning `HashedRelationWithAllNullKeys`, the map 
needs to be freed properly to save memory and keep memory accounting correctly.
    
    ### Why are the changes needed?
    
    Save memory and keep memory accounting correctly for the join query.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Existing unit tests introduced in 
https://github.com/apache/spark/pull/29104 .
    
    Closes #32939 from c21/free-null-aware.
    
    Authored-by: Cheng Su <[email protected]>
    Signed-off-by: Wenchen Fan <[email protected]>
    (cherry picked from commit e0d81d9b712310dd1d70988299b6fba4777945a1)
    Signed-off-by: Wenchen Fan <[email protected]>
---
 .../scala/org/apache/spark/sql/execution/joins/HashedRelation.scala     | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala
 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala
index a91cc07..fec7662 100644
--- 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala
+++ 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala
@@ -480,6 +480,7 @@ private[joins] object UnsafeHashedRelation {
           // scalastyle:on throwerror
         }
       } else if (isNullAware) {
+        binaryMap.free()
         return HashedRelationWithAllNullKeys
       }
     }
@@ -1064,6 +1065,7 @@ private[joins] object LongHashedRelation {
         val key = rowKey.getLong(0)
         map.append(key, unsafeRow)
       } else if (isNullAware) {
+        map.free()
         return HashedRelationWithAllNullKeys
       }
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to