You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "2010YOUY01 (via GitHub)" <gi...@apache.org> on 2024/08/23 07:40:03 UTC
[PR] minor: Add comments for `GroupedHashAggregateStream` struct [datafusion]
2010YOUY01 opened a new pull request, #12127:
URL: https://github.com/apache/datafusion/pull/12127
## 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.
-->
NA
## 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.
-->
`GroupedHashAggregateStream` now has tens of fields due to the complexity of aggregation logic
This PR intends to categorize those fields into different groups and add comments for each group, to improve readability
## What changes are included in this PR?
reordering struct fields and adding comments
<!--
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.
-->
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] minor: Add comments for `GroupedHashAggregateStream` struct [datafusion]
Posted by "2010YOUY01 (via GitHub)" <gi...@apache.org>.
2010YOUY01 commented on code in PR #12127:
URL: https://github.com/apache/datafusion/pull/12127#discussion_r1729673683
##########
datafusion/physical-plan/src/aggregates/row_hash.rs:
##########
@@ -76,35 +76,43 @@ use super::AggregateExec;
/// This encapsulates the spilling state
struct SpillState {
- /// If data has previously been spilled, the locations of the
- /// spill files (in Arrow IPC format)
- spills: Vec<RefCountedTempFile>,
-
+ /* ======================================================================== */
+ // PROPERTIES:
+ // These fields are initialized at the start and remain constant throughout
+ // the execution.
+ /* ======================================================================== */
/// Sorting expression for spilling batches
spill_expr: Vec<PhysicalSortExpr>,
/// Schema for spilling batches
spill_schema: SchemaRef,
- /// true when streaming merge is in progress
- is_stream_merging: bool,
-
/// aggregate_arguments for merging spilled data
merging_aggregate_arguments: Vec<Vec<Arc<dyn PhysicalExpr>>>,
/// GROUP BY expressions for merging spilled data
merging_group_by: PhysicalGroupBy,
+
+ /* ======================================================================== */
Review Comment:
I can't find datafusion style guide, so I'm assuming the practice is following the existing style
I searched the code base and found comment separator `// ========`, I'll update to keep consistent with this format
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] minor: Add comments for `GroupedHashAggregateStream` struct [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #12127:
URL: https://github.com/apache/datafusion/pull/12127
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] minor: Add comments for `GroupedHashAggregateStream` struct [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #12127:
URL: https://github.com/apache/datafusion/pull/12127#discussion_r1729181100
##########
datafusion/physical-plan/src/aggregates/row_hash.rs:
##########
@@ -76,35 +76,43 @@ use super::AggregateExec;
/// This encapsulates the spilling state
struct SpillState {
- /// If data has previously been spilled, the locations of the
- /// spill files (in Arrow IPC format)
- spills: Vec<RefCountedTempFile>,
-
+ /* ======================================================================== */
+ // PROPERTIES:
+ // These fields are initialized at the start and remain constant throughout
+ // the execution.
+ /* ======================================================================== */
/// Sorting expression for spilling batches
spill_expr: Vec<PhysicalSortExpr>,
/// Schema for spilling batches
spill_schema: SchemaRef,
- /// true when streaming merge is in progress
- is_stream_merging: bool,
-
/// aggregate_arguments for merging spilled data
merging_aggregate_arguments: Vec<Vec<Arc<dyn PhysicalExpr>>>,
/// GROUP BY expressions for merging spilled data
merging_group_by: PhysicalGroupBy,
+
+ /* ======================================================================== */
Review Comment:
I dont remember we use this kind of format. I would probably stick to a single format across the project. Or we fill the format can be improved lets do it everywhere and add the notes to the contributing guide
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] minor: Add comments for `GroupedHashAggregateStream` struct [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #12127:
URL: https://github.com/apache/datafusion/pull/12127#issuecomment-2308269131
Thanks again @2010YOUY01 and @comphead
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] minor: Add comments for `GroupedHashAggregateStream` struct [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #12127:
URL: https://github.com/apache/datafusion/pull/12127#discussion_r1729181100
##########
datafusion/physical-plan/src/aggregates/row_hash.rs:
##########
@@ -76,35 +76,43 @@ use super::AggregateExec;
/// This encapsulates the spilling state
struct SpillState {
- /// If data has previously been spilled, the locations of the
- /// spill files (in Arrow IPC format)
- spills: Vec<RefCountedTempFile>,
-
+ /* ======================================================================== */
+ // PROPERTIES:
+ // These fields are initialized at the start and remain constant throughout
+ // the execution.
+ /* ======================================================================== */
/// Sorting expression for spilling batches
spill_expr: Vec<PhysicalSortExpr>,
/// Schema for spilling batches
spill_schema: SchemaRef,
- /// true when streaming merge is in progress
- is_stream_merging: bool,
-
/// aggregate_arguments for merging spilled data
merging_aggregate_arguments: Vec<Vec<Arc<dyn PhysicalExpr>>>,
/// GROUP BY expressions for merging spilled data
merging_group_by: PhysicalGroupBy,
+
+ /* ======================================================================== */
Review Comment:
I dont remember we use this kind of format. I would probably stick to a single format across the project. Or if we feel the format can be improved lets do it everywhere and add the notes to the contributing guide
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org