Repository navigation
GH-35450: [C++] Return error when RecordBatch::ToStructArray called with mismatched column lengths - #36654
Merged
pitrou merged 1 commit intoAug 10, 2023
Conversation
wgtmac
reviewed
Jul 13, 2023
|
|
||
| Status ValidateBatch(const RecordBatch& batch, bool full_validation) { | ||
| for (int i = 0; i < batch.num_columns(); ++i) { | ||
| RETURN_NOT_OK(ValidateColumnLength(batch, i)); |
Member
There was a problem hiding this comment.
nit: passing array created in line 304 to ValidateColumnLength to avoid creating shared_ptr twice.
pitrou
approved these changes
Aug 10, 2023
|
After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit 9b77edd. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this pull request
Nov 13, 2023
…called with mismatched column lengths (apache#36654) ### Rationale for this change If a `RecordBatch` is created with column lengths that don't match the provided `num_rows` (technically invalid), then there are some circumstances where `ToStructArray` will successfully return an array whose length doesn't match `num_rows`. Instead, we should return an error. ### What changes are included in this PR? * Add a small validation check to `ToStructArray` before constructing the output array * Add a test ### Are these changes tested? Yes (tests are included) ### Are there any user-facing changes? No * Closes: apache#35450 Authored-by: benibus <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
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.
Rationale for this change
If a
RecordBatchis created with column lengths that don't match the providednum_rows(technically invalid), then there are some circumstances whereToStructArraywill successfully return an array whose length doesn't matchnum_rows. Instead, we should return an error.What changes are included in this PR?
ToStructArraybefore constructing the output arrayAre these changes tested?
Yes (tests are included)
Are there any user-facing changes?
No