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

    https://github.com/apache/spark/pull/12098#discussion_r58250401
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/ExistingRDD.scala ---
    @@ -318,25 +292,32 @@ private[sql] case class DataSourceScan(
             |   }
             | }""".stripMargin)
     
    -      val value = ctx.freshName("value")
           s"""
              | if ($batch != null) {
              |   $scanBatches();
    -         | } else if ($input.hasNext()) {
    -         |   Object $value = $input.next();
    -         |   if ($value instanceof $columnarBatchClz) {
    -         |     $batch = ($columnarBatchClz)$value;
    +         | } else {
    +         |   long $getBatchStart = System.nanoTime();
    +         |   if ($input.hasNext()) {
    +         |     $batch = ($columnarBatchClz)$input.next();
    +         |     $scanTimeTotalNs += System.nanoTime() - $getBatchStart;
              |     $scanBatches();
    -         |   } else {
    -         |     $scanRows((InternalRow) $value);
              |   }
              | }
            """.stripMargin
         } else {
    +      val row = ctx.freshName("row")
    +      val exprRows =
    +        output.zipWithIndex.map(x => new BoundReference(x._2, 
x._1.dataType, x._1.nullable))
    +      ctx.INPUT_ROW = row
    +      ctx.currentVars = null
    +      val columnsRowInput = exprRows.map(_.gen(ctx))
    +      val inputRow = if (outputUnsafeRows) row else null
           s"""
    -         |if ($input.hasNext()) {
    -         |  $scanRows((InternalRow) $input.next());
    -         |}
    +         | while (!shouldStop() && $input.hasNext()) {
    --- End diff --
    
    I tried a few variants and didn't see a difference. I think only the 
batched scan is fast enough to be sensitive to this.


---
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