HyukjinKwon commented on issue #26087: [SPARK-29427][SQL] Create 
KeyValueGroupedDataset from existing columns in DataFrame
URL: https://github.com/apache/spark/pull/26087#issuecomment-552861324
 
 
   @hagerf, I would link stackoverflow, JIRA, dev or user mailing lists to show 
this is requested multiple times.
   
   Current API sounds to me like new API to optimize one case to reuse existing 
columns to get rid of extra shuffle. Workaround seems easy anyway:
   
   ```scala
       val colNames: Seq[String] = col1 +: cols
       val keyAttrs = colNames.map(colName => resolve(colName).toAttribute)
       val keySchema = StructType.fromAttributes(keyAttrs)
       val keyEncoder = RowEncoder(keySchema)
       new KeyValueGroupedDataset(
         keyEncoder,
         encoder,
         queryExecution,
         logicalPlan.output,
         keyAttrs)
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to