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

    https://github.com/apache/spark/pull/14464#discussion_r73231143
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala
 ---
    @@ -459,8 +459,8 @@ private[execution] final class LongToUnsafeRowMap(val 
mm: TaskMemoryManager, cap
        */
       def getValue(key: Long, resultRow: UnsafeRow): UnsafeRow = {
         if (isDense) {
    -      val idx = (key - minKey).toInt
    -      if (idx >= 0 && key <= maxKey && array(idx) > 0) {
    +      val idx = (key - minKey).toInt  // could overflow
    +      if (key >= minKey && key <= maxKey && array(idx) > 0) {
    --- End diff --
    
    I think having both key >= minKey and key <= maxKey could make sure that 
there is no overflow, then we can safely use `(key - minKey).toInt`


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to