rdblue commented on a change in pull request #25586: [SPARK-28878][SQL] Remove 
extra project for DSv2 reads with columnar batches
URL: https://github.com/apache/spark/pull/25586#discussion_r321527905
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
 ##########
 @@ -140,13 +140,18 @@ object DataSourceV2Strategy extends Strategy with 
PredicateHelper {
            |Output: ${output.mkString(", ")}
          """.stripMargin)
 
-      val plan = BatchScanExec(output, scan)
+      val batchExec = BatchScanExec(output, scan)
 
       val filterCondition = postScanFilters.reduceLeftOption(And)
-      val withFilter = filterCondition.map(FilterExec(_, plan)).getOrElse(plan)
+      val withFilter = filterCondition.map(FilterExec(_, 
batchExec)).getOrElse(batchExec)
 
-      // always add the projection, which will produce unsafe rows required by 
some operators
-      ProjectExec(project, withFilter) :: Nil
+      val withProjection = if (withFilter.output != project || 
!batchExec.supportsColumnar) {
 
 Review comment:
   I'm not as familiar with the streaming side. If we support columnar reads 
there, we probably can.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to