isidentical opened a new pull request, #3445:
URL: https://github.com/apache/arrow-datafusion/pull/3445

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   
   Closes #331.
   
    # Rationale for this change
   <!--
    Why are you proposing this change? If this is already explained clearly in 
the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your 
changes and offer better suggestions for fixes.  
   -->
   Hash repartitioning for aggregates on dictionaries was not available when it 
was initially implemented since dictionaries couldn't be hashed. The real issue 
in #331 (implementing vectorized hashing for dictionaries) is already resolved 
(by @alamb on #812), so as far as I can say we can safely remove this guard in 
the physical plan builder to leverage hash repartitioning on aggregates with 
dicts.
   
   # What changes are included in this PR?
   <!--
   There is no need to duplicate the description in the issue here but it is 
sometimes worth providing a summary of the individual changes in this PR.
   -->
   Changes the physical plan builder to use hash repartitioning on 
dictionary-based aggregates.
   
   # Are there any user-facing changes?
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   This is an optimization, so there shouldn't be any behavioural change but 
the physical plans will change on some scenerios (like the example below).
   
   Previous physical plan for the test `hash_agg_group_by_partitioned_on_dicts`:
   ```
   AggregateExec: mode=Final, gby=[d1@0 as d1], aggr=[SUM(?table?.d2)]
     CoalescePartitionsExec
       AggregateExec: mode=Partial, gby=[d1@0 as d1], aggr=[SUM(?table?.d2)]
         RepartitionExec: partitioning=RoundRobinBatch(4)
           MemoryExec: partitions=1, partition_sizes=[1]
   ```
   
   Current physical plan for it:
   ```
   AggregateExec: mode=FinalPartitioned, gby=[d1@0 as d1], 
aggr=[SUM(?table?.d2)]
     CoalesceBatchesExec: target_batch_size=4096
       RepartitionExec: partitioning=Hash([Column { name: "d1", index: 0 }], 4)
         AggregateExec: mode=Partial, gby=[d1@0 as d1], aggr=[SUM(?table?.d2)]
           RepartitionExec: partitioning=RoundRobinBatch(4)
             MemoryExec: partitions=1, partition_sizes=[1]
   ```
   


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

Reply via email to