-
Notifications
You must be signed in to change notification settings - Fork 3.9k
ARROW-6738: [Java] Fix problems with current union comparison logic #5544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4d8b570
[ARROW-6738][Java] Fix problems with current union comparison logic
liyafan82 5b2225e
[ARROW-6738][Java] Fix the bug with decimal vector
liyafan82 bab7402
[ARROW-6738][Java] Compare fields for all vectors except union vectors
liyafan82 c515393
[ARROW-6738][Java] Rule out the change for union type comparison
liyafan82 c008289
[ARROW-6738][Java] Resolve test failure after rebasing
liyafan82 d6ef3d2
[ARROW-6738][Java] Refine test case
liyafan82 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -282,6 +282,57 @@ public void testUnionVectorRangeEquals() { | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Test comparing two union vectors. | ||
| * The two vectors are different in total, but have a range with equal values. | ||
| */ | ||
| @Test | ||
| public void testUnionVectorSubRangeEquals() { | ||
| try (final UnionVector vector1 = new UnionVector("union", allocator, null, null); | ||
| final UnionVector vector2 = new UnionVector("union", allocator, null, null);) { | ||
|
|
||
| final NullableUInt4Holder uInt4Holder = new NullableUInt4Holder(); | ||
| uInt4Holder.value = 10; | ||
| uInt4Holder.isSet = 1; | ||
|
|
||
| final NullableIntHolder intHolder = new NullableIntHolder(); | ||
liyafan82 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| intHolder.value = 20; | ||
| intHolder.isSet = 1; | ||
|
|
||
| vector1.setType(0, Types.MinorType.UINT4); | ||
| vector1.setSafe(0, uInt4Holder); | ||
|
|
||
| vector1.setType(1, Types.MinorType.INT); | ||
| vector1.setSafe(1, intHolder); | ||
|
|
||
| vector1.setType(2, Types.MinorType.INT); | ||
| vector1.setSafe(2, intHolder); | ||
|
|
||
| vector1.setType(3, Types.MinorType.INT); | ||
| vector1.setSafe(3, intHolder); | ||
|
|
||
| vector1.setValueCount(4); | ||
|
|
||
| vector2.setType(0, Types.MinorType.UINT4); | ||
| vector2.setSafe(0, uInt4Holder); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry if I'm missing it but these vectors do look identifical?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right. I have revised the test case so the two vectors are different. |
||
|
|
||
| vector2.setType(1, Types.MinorType.INT); | ||
| vector2.setSafe(1, intHolder); | ||
|
|
||
| vector2.setType(2, Types.MinorType.INT); | ||
| vector2.setSafe(2, intHolder); | ||
|
|
||
| vector2.setType(3, Types.MinorType.UINT4); | ||
| vector2.setSafe(3, uInt4Holder); | ||
|
|
||
| vector2.setValueCount(4); | ||
|
|
||
| RangeEqualsVisitor visitor = new RangeEqualsVisitor(vector1, vector2); | ||
| assertFalse(visitor.rangeEquals(new Range(0, 0, 4))); | ||
| assertTrue(visitor.rangeEquals(new Range(1, 1, 2))); | ||
| } | ||
| } | ||
|
|
||
| @Ignore | ||
| @Test | ||
| public void testEqualsWithOutTypeCheck() { | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.