leanken commented on a change in pull request #29104:
URL: https://github.com/apache/spark/pull/29104#discussion_r457445110



##########
File path: core/src/main/java/org/apache/spark/unsafe/map/BytesToBytesMap.java
##########
@@ -171,6 +171,29 @@
   private volatile MapIterator destructiveIterator = null;
   private LinkedList<UnsafeSorterSpillWriter> spillWriters = new 
LinkedList<>();
 
+  private boolean inputEmpty = false;
+  private boolean anyNullKeyExists = false;
+
+  public boolean isInputEmpty()

Review comment:
       it's not the same. during building HashedRelation, it will throw away 
row with any column which is null.
   
   ```
   while (input.hasNext) {
         val row = input.next().asInstanceOf[UnsafeRow]
         numFields = row.numFields()
         val key = keyGenerator(row)
         if (!key.anyNull) { // Here
           val loc = binaryMap.lookup(key.getBaseObject, key.getBaseOffset, 
key.getSizeInBytes)
           val success = loc.append(
             key.getBaseObject, key.getBaseOffset, key.getSizeInBytes,
             row.getBaseObject, row.getBaseOffset, row.getSizeInBytes)
           if (!success) {
             binaryMap.free()
             // scalastyle:off throwerror
             throw new SparkOutOfMemoryError("There is not enough memory to 
build hash map")
             // scalastyle:on throwerror
           }
         } else {
           binaryMap.setAnyNullKeyExists(true)
         }
       }
   ```
   
   the isInputEmpty refer to input.isEmpty
   the anyNullKeyExists refer to input.exists(_.anynull)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to