Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12190#discussion_r58643780
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala
 ---
    @@ -321,144 +302,422 @@ private[joins] object UnsafeHashedRelation {
       }
     }
     
    +object LongToUnsafeRowMap {
    +  // the largest prime that below 2^n
    +  val LARGEST_PRIMES = {
    +    // https://primes.utm.edu/lists/2small/0bit.html
    +    val diffs = Seq(
    +      0, 1, 1, 3, 1, 3, 1, 5,
    +      3, 3, 9, 3, 1, 3, 19, 15,
    +      1, 5, 1, 3, 9, 3, 15, 3,
    +      39, 5, 39, 57, 3, 35, 1, 5
    +    )
    +    val primes = new Array[Int](32)
    +    primes(0) = 1
    +    var power2 = 1
    +    (1 until 32).foreach { i =>
    +      power2 *= 2
    +      primes(i) = power2 - diffs(i)
    +    }
    +    primes
    +  }
    +
    +  val DENSE_FACTOR = 0.2
    +}
    +
     /**
    - * An interface for a hashed relation that the key is a Long.
    + * An hash map mapping from key of Long to UnsafeRow.
      */
    -private[joins] trait LongHashedRelation extends HashedRelation {
    -  override def get(key: InternalRow): Iterator[InternalRow] = {
    -    get(key.getLong(0))
    +final class LongToUnsafeRowMap(var mm: TaskMemoryManager, capacity: Int)
    --- End diff --
    
    can you describe the physical data layout in the comments here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to