Skip to content

Commit

Permalink
apacheGH-43185: [C++] Suggest a cast when Concatenate fails due to of…
Browse files Browse the repository at this point in the history
…fsets overflow (apache#43190)

## Rationale for this change

When arrays using 32-bit offsets into data buffers are concatenated and the data buffers of the results grow beyond 2GB, `Concatenate` returns a bad `Status` with a very simple message:

`"offset overflow while concatenating arrays"`

The contract that `Concatenate` honors is very simple: arrays of input type T lead to output of the same type T, so we can't, for instance, return a `LARGE_STRING` [1] array when the input is `STRING`.

But we can **suggest a cast** to the caller in case an overflow error is detected. Either programatically (by taking an output parameter) or by giving a better error message to users.

[1] `LARGE_STRING` can use 64-bit offsets

### What changes are included in this PR?

 - Suggest casts when concatenation of the values of an FSL fail due to overflow
 - Suggest casts when concatenation of [LARGE_]LIST_VIEW array fails due to overflow
 - Suggest casts when concatenation of [LARGE_]LIST array fails due to overflow
 - Suggest a cast to LARGE_(BINARY|STRING) when offsets overflow

### Are these changes tested?

Yes.
* GitHub Issue: apache#43185

Lead-authored-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
Co-authored-by: Benjamin Kietzman <bengilgit@gmail.com>
Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
  • Loading branch information
felipecrv and bkietz committed Jul 17, 2024
1 parent c66b3f1 commit a137687
Show file tree
Hide file tree
Showing 3 changed files with 316 additions and 65 deletions.
Loading

0 comments on commit a137687

Please sign in to comment.