You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Tejas Patil (JIRA)" <ji...@apache.org> on 2016/10/23 01:20:58 UTC

[jira] [Updated] (SPARK-18035) Introduce performant and memory efficient APIs to create ArrayBasedMapData

     [ https://issues.apache.org/jira/browse/SPARK-18035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tejas Patil updated SPARK-18035:
--------------------------------
    Summary: Introduce performant and memory efficient APIs to create ArrayBasedMapData  (was: Unwrapping java maps in HiveInspectors allocates unnecessary buffer)

> Introduce performant and memory efficient APIs to create ArrayBasedMapData
> --------------------------------------------------------------------------
>
>                 Key: SPARK-18035
>                 URL: https://issues.apache.org/jira/browse/SPARK-18035
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.0.1
>            Reporter: Tejas Patil
>            Priority: Minor
>
> In HiveInspectors, I saw that converting Java map to Spark's `ArrayBasedMapData` spent quite sometime in buffer copying : https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala#L658
> The reason being `map.toSeq` allocates a new buffer and copies the map entries to it: https://github.com/scala/scala/blob/2.11.x/src/library/scala/collection/MapLike.scala#L323
> This copy is not needed as we get rid of it once we extract the key and value arrays.
> Here is the call trace:
> {noformat}
> org.apache.spark.sql.hive.HiveInspectors$$anonfun$unwrapperFor$41.apply(HiveInspectors.scala:664)
> scala.collection.AbstractMap.toSeq(Map.scala:59)
> scala.collection.MapLike$class.toSeq(MapLike.scala:323)
> scala.collection.AbstractMap.toBuffer(Map.scala:59)
> scala.collection.MapLike$class.toBuffer(MapLike.scala:326)
> scala.collection.AbstractTraversable.copyToBuffer(Traversable.scala:104)
> scala.collection.TraversableOnce$class.copyToBuffer(TraversableOnce.scala:275)
> scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:48)
> scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:104)
> scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:59)
> scala.collection.AbstractIterable.foreach(Iterable.scala:54)
> scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
> scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
> scala.collection.Iterator$class.foreach(Iterator.scala:893)
> scala.collection.generic.Growable$$anonfun$$plus$plus$eq$1.apply(Growable.scala:59)
> scala.collection.generic.Growable$$anonfun$$plus$plus$eq$1.apply(Growable.scala:59)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org