Github user maropu commented on a diff in the pull request: https://github.com/apache/spark/pull/19869#discussion_r154561232 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/HashAggregateExec.scala --- @@ -621,34 +622,30 @@ case class HashAggregateExec( val iterTerm = ctx.freshName("mapIter") ctx.addMutableState(classOf[KVIterator[UnsafeRow, UnsafeRow]].getName, iterTerm) - def generateGenerateCode(): String = { - if (isFastHashMapEnabled) { - if (isVectorizedHashMapEnabled) { - s""" - | ${fastHashMapGenerator.asInstanceOf[VectorizedHashMapGenerator].generate()} - """.stripMargin - } else { - s""" - | ${fastHashMapGenerator.asInstanceOf[RowBasedHashMapGenerator].generate()} - """.stripMargin - } - } else "" + if (isFastHashMapEnabled) { + val generatedMap = if (isVectorizedHashMapEnabled) { + fastHashMapGenerator.asInstanceOf[VectorizedHashMapGenerator].generate() + } else { + fastHashMapGenerator.asInstanceOf[RowBasedHashMapGenerator].generate() + } + ctx.addInnerClass(generatedMap) } - ctx.addInnerClass(generateGenerateCode()) val doAgg = ctx.freshName("doAggregateWithKeys") val peakMemory = metricTerm(ctx, "peakMemory") val spillSize = metricTerm(ctx, "spillSize") val avgHashProbe = metricTerm(ctx, "avgHashProbe") + val finishFashHashMap = if (isFastHashMapEnabled) { --- End diff -- nit: can we merge this branch with the the branch above (line 625) for hashmap stuffs?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org