Skip to content

Commit 7acf912

Browse files
OmBiradarpitrou
andcommitted
Update KeyValueMetadata::Delete IndexError message
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
1 parent 15fb3bf commit 7acf912

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

cpp/src/arrow/util/key_value_metadata.cc

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,9 @@ Result<std::string> KeyValueMetadata::Get(std::string_view key) const {
101101

102102
Status KeyValueMetadata::Delete(int64_t index) {
103103
if (ARROW_PREDICT_FALSE(index < 0 || std::cmp_greater_equal(index, values_.size()))) {
104-
const size_t n = keys_.size();
105-
if (n == 0LL) {
106-
return Status::IndexError("KeyValueMetadata::Delete: index ", std::to_string(index),
107-
" is out of bounds for metadata "
108-
"of size ",
109-
std::to_string(n), ". Metadata is empty.");
110-
}
111-
return Status::IndexError("KeyValueMetadata::Delete: index ", std::to_string(index),
104+
return Status::IndexError("KeyValueMetadata::Delete: index ", index,
112105
" is out of bounds for metadata "
113-
"of size ",
114-
std::to_string(n), " (valid range: [0, ",
115-
std::to_string(n - 1), "])");
106+
"of size ", keys_.size());
116107
}
117108
keys_.erase(keys_.begin() + index);
118109
values_.erase(values_.begin() + index);

0 commit comments

Comments
 (0)