spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiszk <...@git.apache.org>
Subject [GitHub] spark pull request #13909: [SPARK-16213][SQL] Reduce runtime overhead of a p...
Date Tue, 06 Dec 2016 09:32:31 GMT
Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13909#discussion_r91039840
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala
---
    @@ -132,50 +153,80 @@ case class CreateMap(children: Seq[Expression]) extends Expression
{
         new ArrayBasedMapData(new GenericArrayData(keyArray), new GenericArrayData(valueArray))
       }
     
    +  private def getAccessors(ctx: CodegenContext, dt: DataType, array: String,
    +      isPrimitive : Boolean, size: Int): (String, String, String) = {
    +    if (!isPrimitive) {
    +      val arrayClass = classOf[GenericArrayData].getName
    +      ctx.addMutableState("Object[]", array, s"this.$array = null;")
    +      (s"new $arrayClass($array)",
    +        s"$array = new Object[${size}];", s"this.$array = null;")
    +    } else {
    +      val unsafeArrayClass = classOf[UnsafeArrayData].getName
    +      val javaDataType = ctx.javaType(dt)
    +      ctx.addMutableState(s"${javaDataType}[]", array,
    +        s"this.$array = new ${javaDataType}[${size}];")
    +      (s"$unsafeArrayClass.fromPrimitiveArray($array)", "", "")
    --- End diff --
    
    I left the conventional approach for non-primitive cases. Now, I tried to allocate an
object only once for non-primitive cases, too.


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

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


Mime
View raw message