Github user mgaido91 commented on a diff in the pull request:
https://github.com/apache/spark/pull/19811#discussion_r156932214
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/ColumnarBatchScan.scala
---
@@ -68,30 +68,26 @@ private[sql] trait ColumnarBatchScan extends
CodegenSupport {
*/
// TODO: return ColumnarBatch.Rows instead
override protected def doProduce(ctx: CodegenContext): String = {
- val input = ctx.freshName("input")
// PhysicalRDD always just has one input
- ctx.addMutableState("scala.collection.Iterator", input, s"$input =
inputs[0];")
+ val input = ctx.addMutableState("scala.collection.Iterator", "input",
+ v => s"$v = inputs[0];", forceInline = true)
// metrics
val numOutputRows = metricTerm(ctx, "numOutputRows")
val scanTimeMetric = metricTerm(ctx, "scanTime")
- val scanTimeTotalNs = ctx.freshName("scanTime")
- ctx.addMutableState(ctx.JAVA_LONG, scanTimeTotalNs, s"$scanTimeTotalNs
= 0;")
+ val scanTimeTotalNs = ctx.addMutableState(ctx.JAVA_LONG, "scanTime")
val columnarBatchClz = classOf[ColumnarBatch].getName
- val batch = ctx.freshName("batch")
- ctx.addMutableState(columnarBatchClz, batch, s"$batch = null;")
+ val batch = ctx.addMutableState(columnarBatchClz, "batch")
- val idx = ctx.freshName("batchIdx")
- ctx.addMutableState(ctx.JAVA_INT, idx, s"$idx = 0;")
- val colVars = output.indices.map(i => ctx.freshName("colInstance" + i))
+ val idx = ctx.addMutableState(ctx.JAVA_INT, "batchIdx")
--- End diff --
ditto
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]