Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.0.0
Description
if (takeFromEnd) { while (buf.length < n && i < res.length) { val rows = decodeUnsafeRows(res(i)._2) if (n - buf.length >= res(i)._1) { buf.prependAll(rows.toArray[InternalRow]) } else { val dropUntil = res(i)._1 - (n - buf.length) // Same as Iterator.drop but this only takes a long. var j: Long = 0L while (j < dropUntil) { rows.next(); j += 1L} buf.prependAll(rows.toArray[InternalRow]) } i += 1 } } else { while (buf.length < n && i < res.length) { val rows = decodeUnsafeRows(res(i)._2) if (n - buf.length >= res(i)._1) { buf ++= rows.toArray[InternalRow] } else { buf ++= rows.take(n - buf.length).toArray[InternalRow] } i += 1 } }
In the above code, the input parameters of `mutable.Buffer#prependAll` and `mutable.Growable#++=` functions are `IterableOnce`, and the type of rows is `Iterator[InternalRow]`, which inherits from `IterableOnce`, so there is no need to cast to an array of InternalRow anymore.
Attachments
Issue Links
- links to