Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5279#discussion_r27989521
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/LocalTableScan.scala ---
    @@ -32,9 +32,20 @@ case class LocalTableScan(output: Seq[Attribute], rows: 
Seq[Row]) extends LeafNo
     
       override def execute(): RDD[Row] = rdd
     
    -  override def executeCollect(): Array[Row] =
    -    rows.map(ScalaReflection.convertRowToScala(_, schema)).toArray
     
    -  override def executeTake(limit: Int): Array[Row] =
    -    rows.map(ScalaReflection.convertRowToScala(_, 
schema)).take(limit).toArray
    +  override def executeCollect(): Array[Row] = {
    +    val converters = schema.fields.map {
    --- End diff --
    
    Is there a reason this pattern cannot be
    
    ```scala
    val converter = CatalystTypeConverters.createToScalaConverter(schema)
    rows.map(converter).toArray
    ```
    ?
    
    It looks like this pretty efficiently handles this situation in the same 
way that you've extracted it here (even with calling convertRowWithConverters).



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to