Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/15082
  
    After thinking more about it, it seems not a problem and we don't need to 
fix it. Currently `MutableProjection` is used in 3 places:
    
    1. hash based aggregate. It's fine because hash aggregate only supports 
primitive type buffer, so it doesn't have the copy problem.
    2. sort based aggregate. It's also fine because we always apply a safe 
projection to the input row before process it. I have a PR to fix the comment 
of it: https://github.com/apache/spark/pull/15095
    3. window execution. It's also fine because its input rows are come from 
`RowBuffer`, not unsafe rows produced by unsafe projection.
    
    This PR tried to fix `MutableProjection` so that we can remove the safe 
projection in sort based aggregate, but I was wrong because `MutableProjection` 
is not the only way to update the aggregation buffer, `ImperativeAggregate` can 
also update the buffer via the `update` and `merge` API, and it's not a good 
idea to fix all `ImperativeAggregate` to do copy correctly while updating the 
aggregate buffer(and it's not future proof, we may add more 
`ImperativeAggragate` implementations and miss this requirement).


---
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]

Reply via email to