zhenlineo commented on code in PR #40796:
URL: https://github.com/apache/spark/pull/40796#discussion_r1184086351
##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -1867,7 +1928,34 @@ class SparkConnectPlanner(val session: SparkSession) {
output.logicalPlan
}
+ def transformKeyValueGroupedAggregate(rel: proto.Aggregate): LogicalPlan = {
+ val ds = UntypedKeyValueGroupedDataset(
+ rel.getInput,
+ rel.getGroupingExpressionsList,
+ java.util.Collections.emptyList())
+
+ val namedColumns = rel.getAggregateExpressionsList.asScala.toSeq.map(expr
=> {
+ // Use any encoder as a placeholder to perform the
TypedColumn#withInputType transformation
+ val any = ds.vEncoder
+ val newExpr = new TypedColumn(transformExpression(expr), any)
+ .withInputType(ds.vEncoder, ds.dataAttributes)
+ .expr
+ Column(newExpr).named
+ })
+ val keyColumn = logical.UntypedAggUtils.aggKeyColumn(ds.kEncoder,
ds.groupingAttributes)
+ logical.Aggregate(ds.groupingAttributes, keyColumn +: namedColumns,
ds.analyzed)
+ }
+
private def transformAggregate(rel: proto.Aggregate): LogicalPlan = {
+ rel.getGroupType match {
+ case proto.Aggregate.GroupType.GROUP_TYPE_GROUPBYKEY =>
Review Comment:
This is the only way to mark KVGDS#agg from RGDS#agg.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]