test(amber): add unit test coverage for DataFrame equality and inMemSize#4784
Merged
Yicong-Huang merged 3 commits intoMay 3, 2026
Merged
Conversation
Add DataPayloadSpec covering DataFrame.inMemSize aggregation across contained tuples and the custom equals contract: empty equality, non-DataFrame rejection, length mismatch, element-wise equality, order sensitivity, and element-mismatch rejection. Closes apache#4783 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds ScalaTest unit coverage for DataFrame’s custom equals and inMemSize behavior in Amber’s messaging payloads, addressing the gap reported in #4783.
Changes:
- Introduces
DataPayloadSpeccoveringDataFrame.inMemSizefor empty vs non-empty frames. - Adds
DataFrame.equalstests for type mismatch/null, length mismatch, element-wise equality, order sensitivity, and differing elements.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4784 +/- ##
============================================
- Coverage 42.84% 42.35% -0.49%
Complexity 2027 2027
============================================
Files 957 957
Lines 34077 34094 +17
Branches 3753 3753
============================================
- Hits 14600 14442 -158
- Misses 18693 18870 +177
+ Partials 784 782 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Use the schema's Attribute (`schema.getAttribute("v")`) when adding
fields in the `tuple` helper so it stays consistent with the schema
under test, rather than constructing a fresh Attribute.
- Split the empty-frame equality test into a true reflexivity case
(`df == df`) and a separate case for two distinct empty frames, so
the wording matches what is asserted.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Yicong-Huang
approved these changes
May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Add
DataPayloadSpeccovering the customequalsandinMemSizeofDataFrame:inMemSize: zero for an empty frame; sum of contained tuple sizes otherwiseequalsis reflexive on a single empty-frame instance (df == df)equalsreturns true for two distinct empty-frame instancesequalsrejects non-DataFramevalues andnullequalsrejects frames whose lengths differequalstreats element-wise equal frames as equalequalsrespects element orderequalsrejects frames whose elements differAny related issues, documentation, discussions?
Closes #4783
How was this PR tested?
sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.common.ambermessage.DataPayloadSpec"— 9/9 tests pass.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)