Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-45737][SQL] Remove unnecessary
.toArray[InternalRow]
in `Spa…
…rkPlan#executeTake` ### 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 Closes #43599 from LuciferYang/sparkplan. Authored-by: yangjie01 <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
- Loading branch information