Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/18732#discussion_r143640650
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/python/ArrowEvalPythonExec.scala
---
@@ -44,14 +73,18 @@ case class ArrowEvalPythonExec(udfs: Seq[PythonUDF],
output: Seq[Attribute], chi
val schemaOut =
StructType.fromAttributes(output.drop(child.output.length).zipWithIndex
.map { case (attr, i) => attr.withName(s"_$i") })
+ val batchSize = conf.arrowMaxRecordsPerBatch
+ // DO NOT use iter.grouped(). See BatchIterator.
+ val batchIter = if (batchSize > 0) new BatchIterator(iter, batchSize)
else Iterator(iter)
+
val columnarBatchIter = new ArrowPythonRunner(
- funcs, conf.arrowMaxRecordsPerBatch, bufferSize, reuseWorker,
+ funcs, bufferSize, reuseWorker,
PythonEvalType.SQL_PANDAS_UDF, argOffsets, schema)
- .compute(iter, context.partitionId(), context)
+ .compute(batchIter, context.partitionId(), context)
new Iterator[InternalRow] {
- var currentIter = if (columnarBatchIter.hasNext) {
+ private var currentIter = if (columnarBatchIter.hasNext) {
--- End diff --
does it need to be var?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]