-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add tests to TestRowBlock #26706
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
Add tests to TestRowBlock #26706
Conversation
List<Object>[] testRows = generateTestRows(fieldTypes, 5); | ||
RowBlock rowBlock = (RowBlock) createBlockBuilderWithValues(fieldTypes, testRows).build(); | ||
|
||
int[] positions = {0, 2, 4}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: these can be inlined into the copyPositions
calls since they're not referenced afterwards.
// Test with nulls | ||
List<Object>[] testRowsWithNulls = alternatingNullValues(generateTestRows(fieldTypes, 3)); | ||
RowBlock rowBlockWithNulls = (RowBlock) createBlockBuilderWithValues(fieldTypes, testRowsWithNulls).build().getRegion(1, testRowsWithNulls.length - 1); | ||
int[] positions2 = {0, 2}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note about inlining these
|
||
// Test empty positions | ||
int[] emptyPositions = {}; | ||
RowBlock emptyBlock = rowBlock.copyPositions(emptyPositions, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: inline as new int[0]
RowBlock regionBlock = largerBlock.getRegion(1, 2); | ||
RowBlock offsetAppendedBlock = regionBlock.copyWithAppendedNull(); | ||
assertThat(offsetAppendedBlock.getPositionCount()).isEqualTo(3); | ||
for (int i = 0; i < 2; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably unnecessary to assert these in a two-iteration loop, just unroll them this into two separate assertions.
9314230
to
4516abb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @SongChujun
Description
This PR add more tests to TestRowBlock
Additional context and related issues
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: