[replay #7532] fix(workflow-operator): MAX aggregation checks the wrong empty-group sentinel - #7
[replay #7532] fix(workflow-operator): MAX aggregation checks the wrong empty-group sentinel#7sshiv012 wants to merge 1 commit into
Conversation
…sentinel Change maxAgg's finaliser in AggregationOperation to test the minValue sentinel it initialises with (it tested maxValue, copied from minAgg), and add regression tests for the empty, all-null, and type-maximum cases across INTEGER, LONG, DOUBLE, and TIMESTAMP.
📝 WalkthroughWalkthrough
ChangesMAX aggregation correction
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/aggregate/AggregationOperation.scala`:
- Line 240: In the aggregation logic around the partial result handling, stop
using AttributeTypeUtils.minValue(attributeType) as the empty-group sentinel.
Track a separate “value observed” state alongside the aggregate, preserve and
merge that state through local and worker-to-final aggregation, and return null
only when no non-null value was observed. Add tests covering groups whose values
all equal the type minimum.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 918ed3e1-bc24-4c9e-9c6b-0dd0e68faee3
📒 Files selected for processing (3)
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/aggregate/AggregationOperation.scalacommon/workflow-operator/src/test/scala/org/apache/texera/amber/operator/aggregate/AggregateOpSpec.scalacommon/workflow-operator/src/test/scala/org/apache/texera/amber/operator/aggregate/AggregationOperationSpec.scala
| if (AttributeTypeUtils.compare(partial1, partial2, attributeType) > 0) partial1 | ||
| else partial2, | ||
| partial => if (partial == AttributeTypeUtils.maxValue(attributeType)) null else partial | ||
| partial => if (partial == AttributeTypeUtils.minValue(attributeType)) null else partial |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Do not use minValue as the empty-group marker.
A non-empty group whose maximum equals AttributeTypeUtils.minValue(attributeType) returns null. For example, MAX(Int.MinValue) keeps the initialized partial because the comparison is not greater than zero. Line 240 then treats that valid result as empty.
Store whether a non-null value was observed separately from the aggregate value. Preserve that state during merge. Add local and worker-to-final tests where every value equals the type minimum.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/aggregate/AggregationOperation.scala`
at line 240, In the aggregation logic around the partial result handling, stop
using AttributeTypeUtils.minValue(attributeType) as the empty-group sentinel.
Track a separate “value observed” state alongside the aggregate, preserve and
merge that state through local and worker-to-final aggregation, and return null
only when no non-null value was observed. Add tests covering groups whose values
all equal the type minimum.
Replay of apache#7532 for CodeRabbit evaluation.
merge-base
5e41efae2650headc879f75824d7stratumscalaSynthetic evaluation PR. Do not merge.
maxAggto detect empty groups with the correct minimum-value sentinel.MAXvalues across supported types.