You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by cloud-fan <gi...@git.apache.org> on 2018/08/13 11:21:36 UTC

[GitHub] spark pull request #21912: [SPARK-24962][SQL] Refactor CodeGenerator.createU...

Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21912#discussion_r209573448
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala ---
    @@ -735,70 +735,100 @@ class CodegenContext {
       }
     
       /**
    -   * Generates code creating a [[UnsafeArrayData]].
    +   * Generates code creating a [[UnsafeArrayData]] or [[GenericArrayData]] based on
    +   * given parameters.
        *
        * @param arrayName name of the array to create
    +   * @param elementType data type of the elements in source array
        * @param numElements code representing the number of elements the array should contain
    -   * @param elementType data type of the elements in the array
        * @param additionalErrorMessage string to include in the error message
    +   * @param elementSize optional value which shows the size of an element of the allocated
    +   *                    [[UnsafeArrayData]] or [[GenericArrayData]]
    +   *
    +   * @return code representing the allocation of [[ArrayData]]
    +   *         code representing a setter of an assignment for the generated array
        */
    -  def createUnsafeArray(
    +  def createArrayData(
           arrayName: String,
    -      numElements: String,
           elementType: DataType,
    -      additionalErrorMessage: String): String = {
    -    val arraySize = freshName("size")
    -    val arrayBytes = freshName("arrayBytes")
    +      numElements: String,
    +      additionalErrorMessage: String,
    +      elementSize: Option[Int] = None): (String, String) = {
    --- End diff --
    
    why do we need both `elementType` and `elementSize`.


---

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