You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2023/10/31 08:53:41 UTC

[PR] [SPARK-45737][SQL] Remove unnecessary `.toArray[InternalRow]` in `SparkPlan#executeTake` [spark]

LuciferYang opened a new pull request, #43599:
URL: https://github.com/apache/spark/pull/43599

   ### What changes were proposed in this pull request?
   https://github.com/apache/spark/blob/8dd3ec87e26969df6fe08f5fddc3f8d6efc2420d/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkPlan.scala#L535-L559
   
   In the above code, the input parameters of `mutable.Buffer#prependAll` and `mutable.Growable#++=` functions are `IterableOnce`
   
   - `mutable.Buffer#prependAll`
   
   ```scala
     def prependAll(elems: IterableOnce[A]): this.type = { insertAll(0, elems); this }
   ```
   
   - `mutable.Growable#++=`
   
   ```
     @`inline` final def ++= (xs: IterableOnce[A]): this.type = addAll(xs)
   ```
   
   and the type of `rows` is `Iterator[InternalRow]`, which inherits from `IterableOnce`
   
   ```
   val rows = decodeUnsafeRows(res(i)._2)
   private def decodeUnsafeRows(bytes: ChunkedByteBuffer): Iterator[InternalRow]
   ```
   
   So there is no need to cast to an `Array` of `InternalRow` anymore.
   
   ### Why are the changes needed?
   Remove unnecessary `.toArray[InternalRow]`
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   Pass GitHub Actions
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] [SPARK-45737][SQL] Remove unnecessary `.toArray[InternalRow]` in `SparkPlan#executeTake` [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #43599: [SPARK-45737][SQL] Remove unnecessary `.toArray[InternalRow]` in `SparkPlan#executeTake`
URL: https://github.com/apache/spark/pull/43599


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] [SPARK-45737][SQL] Remove unnecessary `.toArray[InternalRow]` in `SparkPlan#executeTake` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #43599:
URL: https://github.com/apache/spark/pull/43599#issuecomment-1787508333

   Thanks @dongjoon-hyun 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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