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

    https://github.com/apache/spark/pull/15573#discussion_r84394627
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/ArrayBasedMapData.scala
 ---
    @@ -35,6 +39,23 @@ object ArrayBasedMapData {
         ArrayBasedMapData(array.map(_._1), array.map(_._2))
       }
     
    +  def apply(map: JMap[_, _],
    +            keyUnwrapper: (Any) => Any,
    +            valueUnwrapper: (Any) => Any): ArrayBasedMapData = {
    +    val keys: Array[Any] = new Array[Any](map.size())
    +    val values: Array[Any] = new Array[Any](map.size())
    +
    +    var i: Int = 0
    +    map.asScala.foreach(
    --- End diff --
    
    I'd write this using a while loop since you care about performance. It is 
pretty weird to have an `i += 1` in the body of foreach.



---
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