Github user cloud-fan commented on the pull request:
https://github.com/apache/spark/pull/12067#issuecomment-206755637
generated code snippet in whole stage codegen for
`val ds = Seq(("a", 10)).toDS().groupByKey(_._1).agg(typed.sum(_._2))`:
```
/* 095 */ // evaluate aggregate function
/* 096 */ /*
org.apache.spark.sql.execution.aggregate.TypedSumDouble@25ffdd4a.reduce */
/* 097 */ /*
org.apache.spark.sql.execution.aggregate.TypedSumDouble@25ffdd4a */
/* 098 */ /* expression:
org.apache.spark.sql.execution.aggregate.TypedSumDouble@25ffdd4a */
/* 099 */ Object agg_obj = ((Expression) references[1]).eval(null);
/* 100 */ org.apache.spark.sql.expressions.Aggregator agg_value4 =
(org.apache.spark.sql.expressions.Aggregator) agg_obj;
/* 101 */ /* input[0, double] */
/* 102 */ double agg_value5 = agg_aggBuffer.getDouble(0);
/* 103 */ /* newInstance(class scala.Tuple2) */
/* 104 */ /* input[1, string].toString */
/* 105 */ java.lang.String agg_value7 = inputadapter_isNull ? null :
(java.lang.String) inputadapter_value.toString();
/* 106 */ boolean agg_isNull7 = agg_value7 == null;
/* 107 */
/* 108 */ final scala.Tuple2 agg_value6 = new
scala.Tuple2(agg_value7, inputadapter_value1);
/* 109 */ final boolean agg_isNull6 = false;
/* 110 */ double agg_value3 = false ? -1.0 : (double)
((java.lang.Double)agg_value4.reduce(agg_value5, agg_value6)).doubleValue();
/* 111 */ // update aggregate buffer
/* 112 */ if (!false) {
/* 113 */ agg_aggBuffer.setDouble(0, agg_value3);
/* 114 */ } else {
/* 115 */ agg_aggBuffer.setNullAt(0);
/* 116 */ }
```
---
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]