spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davies <...@git.apache.org>
Subject [GitHub] spark pull request: [Spark-14138][SQL] Fix generated SpecificColum...
Date Wed, 30 Mar 2016 20:33:17 GMT
Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11984#discussion_r57958641
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/columnar/GenerateColumnAccessor.scala
---
    @@ -88,16 +92,21 @@ object GenerateColumnAccessor extends CodeGenerator[Seq[DataType],
ColumnarItera
             case array: ArrayType => classOf[ArrayColumnAccessor].getName
             case t: MapType => classOf[MapColumnAccessor].getName
           }
    -      ctx.addMutableState(accessorCls, accessorName, s"$accessorName = null;")
    -
    -      val createCode = dt match {
    -        case t if ctx.isPrimitiveType(dt) =>
    -          s"$accessorName = new $accessorCls(ByteBuffer.wrap(buffers[$index]).order(nativeOrder));"
    -        case NullType | StringType | BinaryType =>
    -          s"$accessorName = new $accessorCls(ByteBuffer.wrap(buffers[$index]).order(nativeOrder));"
    -        case other =>
    -          s"""$accessorName = new $accessorCls(ByteBuffer.wrap(buffers[$index]).order(nativeOrder),
    -             (${dt.getClass.getName}) columnTypes[$index]);"""
    +      ctx.addMutableState(accessorCls, accessorName, "")
    +
    +      val createCode = {
    +        val shortCls = accessorCls.substring(accessorCls.lastIndexOf(".") + 1)
    +        dt match {
    +          case t if ctx.isPrimitiveType(dt) =>
    +            s"$accessorName = get${accessorClasses.getOrElseUpdate(accessorCls, shortCls)}($index);"
    --- End diff --
    
    This may change the number of bytes per columns, you need to redo the calculation and
test it.


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