Skip to content

Conversation

@mustafasrepo
Copy link
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

row_hash.rs file has large chunks of code inside single function. This makes code hard to read. Also scope of the some variables are larger than necessary, which is limiting.

What changes are included in this PR?

This PR refactors group_aggregate_batch. All code is the same except some sections of the function group_aggregate_batch moved under update_group_state and update_accumulators.
Also get_at_indices function now returns Result<> to remove .unwrap inside it.

Are these changes tested?

Existing tests should work

Are there any user-facing changes?

@github-actions github-actions bot added the core Core DataFusion crate label Apr 10, 2023

let row_converter_size_pre = self.row_converter.size();
for group_values in &group_by_values {
let group_rows = self.row_converter.convert_columns(group_values)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chunk is moved to the function update_group_state

}
let batch_indices = batch_indices.finish();

let row_values = get_at_indices(&row_aggr_input_values, &batch_indices);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chunk is moved to the function update_accumulators

@jackwener jackwener changed the title [Minor]: Refactor row_hash implementation minor: Refactor row_hash implementation Apr 10, 2023
@jackwener
Copy link
Member

Thanks @mustafasrepo

@mustafasrepo mustafasrepo merged commit 52fa228 into apache:main Apr 11, 2023
@mustafasrepo mustafasrepo deleted the feature/refactor_groupby branch April 11, 2023 06:54
korowa pushed a commit to korowa/arrow-datafusion that referenced this pull request Apr 13, 2023
* split large chunks to functions

* Remove double type annotations

---------

Co-authored-by: Mehmet Ozan Kabak <ozankabak@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants