File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
sql/core/src/main/scala/org/apache/spark/sql/execution Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -204,7 +204,12 @@ case class TakeOrderedAndProject(
204204 projectOutput.getOrElse(child.output)
205205 }
206206
207- override def outputsUnsafeRows : Boolean = true
207+ override def outputsUnsafeRows : Boolean = if (projectList.isDefined) {
208+ true
209+ } else {
210+ child.outputsUnsafeRows
211+ }
212+
208213 override def canProcessUnsafeRows : Boolean = true
209214 override def canProcessSafeRows : Boolean = true
210215
@@ -216,19 +221,13 @@ case class TakeOrderedAndProject(
216221
217222 // TODO: remove @transient after figure out how to clean closure at InsertIntoHiveTable.
218223 @ transient private val projection = projectList.map(UnsafeProjection .create(_, child.output))
219- @ transient private lazy val unsafeProjection =
220- UnsafeProjection .create(child.output.map(_.dataType).toArray)
221224
222225 private def collectData (): Array [InternalRow ] = {
223226 val data = child.execute().map(_.copy()).takeOrdered(limit)(ord)
224227 if (projection.isDefined) {
225228 projection.map(p => data.map(p(_).copy().asInstanceOf [InternalRow ])).get
226229 } else {
227- if (child.outputsUnsafeRows) {
228- data
229- } else {
230- data.map(unsafeProjection(_).copy().asInstanceOf [InternalRow ])
231- }
230+ data
232231 }
233232 }
234233
You can’t perform that action at this time.
0 commit comments