Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/11435#discussion_r55067283
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/ExistingRDD.scala ---
@@ -149,14 +154,64 @@ private[sql] case class PhysicalRDD(
ctx.INPUT_ROW = row
ctx.currentVars = null
val columns = exprs.map(_.gen(ctx))
+
+ // The input RDD can either return (all) ColumnarBatches or
InternalRows. We determine this
+ // by looking at the first value of the RDD and then calling the
function which will process
+ // the remaining. It is faster to return batches.
+ // TODO: The abstractions between this class and SqlNewHadoopRDD makes
it difficult to know
+ // here which path to use. Fix this.
+
+
+ val scanBatches = ctx.freshName("processBatches")
+ ctx.addNewFunction(scanBatches,
+ s"""
+ | private void $scanBatches() throws java.io.IOException {
+ | while (true) {
+ | int numRows = $batch.numRows();
+ | if ($idx == 0) $numOutputRows.add(numRows);
+ |
+ | while ($idx < numRows) {
+ | InternalRow $row = $batch.getRow($idx++);
+ | ${columns.map(_.code).mkString("\n").trim}
--- End diff --
We could generate code to use the ColumnBatch object, not InternalRow, not
sure how the difference will be.
---
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]