46 template <
class T,
class OT>
87 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext = empty_extension>
88 class variable_size_binary_array_impl;
90 namespace copy_tracker
96 return "variable_size_binary_array";
100 template <layout_offset OT,
typename Ext = empty_extension>
107 template <layout_offset OT,
typename Ext = empty_extension>
233 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
289 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
297 sizeof(std::ranges::range_value_t<T>) ==
sizeof(std::uint8_t),
298 "Only sequences of types with the same size as uint8_t are supported"
404 template <
class... ARGS>
407 :
self_type(create_proxy(std::forward<ARGS>(args)...))
411 using base_type::get_arrow_proxy;
412 using base_type::size;
461 template <std::ranges::range SIZES_RANGE>
494 std::optional<std::string_view> name = std::nullopt,
495 std::optional<METADATA_RANGE> metadata = std::nullopt
517 std::ranges::input_range R,
521 std::ranges::input_range<std::ranges::range_value_t<R>>
527 std::optional<std::string_view> name = std::nullopt,
528 std::optional<METADATA_RANGE> metadata = std::nullopt
548 template <std::ranges::input_range R, input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
550 std::ranges::input_range<std::ranges::range_value_t<R>>
551 && mpl::char_like<std::ranges::range_value_t<std::ranges::range_value_t<R>>>
553 [[nodiscard]]
static arrow_proxy create_proxy(
556 std::optional<std::string_view> name = std::nullopt,
557 std::optional<METADATA_RANGE> metadata = std::nullopt
574 template <std::ranges::input_range R, input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
575 requires std::is_same_v<std::ranges::range_value_t<R>, nullable<T>>
576 [[nodiscard]]
static arrow_proxy create_proxy(
578 std::optional<std::string_view> name = std::nullopt,
579 std::optional<METADATA_RANGE> metadata = std::nullopt
599 template <mpl::
char_like C, input_metadata_container METADATA_RANGE = std::vector<metadata_pair>>
600 [[nodiscard]]
static arrow_proxy create_proxy_impl(
601 u8_buffer<C>&& data_buffer,
603 std::optional<validity_bitmap>&&,
604 std::optional<std::string_view> name = std::nullopt,
605 std::optional<METADATA_RANGE> metadata = std::nullopt
608 static constexpr size_t OFFSET_BUFFER_INDEX = 1;
609 static constexpr size_t DATA_BUFFER_INDEX = 2;
662 [[nodiscard]]
constexpr value_iterator value_begin();
671 [[nodiscard]]
constexpr value_iterator value_end();
749 template <std::ranges::sized_range U>
750 requires mpl::convertible_ranges<U, T>
751 constexpr void resize_values(size_type new_length, U
value);
762 constexpr void resize_offsets(size_type new_length,
offset_type offset_value);
779 template <std::ranges::sized_range U>
780 requires mpl::convertible_ranges<U, T>
813 template <mpl::iterator_of_type<T> InputIt>
836 template <mpl::iterator_of_type<OT> InputIt>
892 template <std::ranges::sized_range U>
893 requires mpl::convertible_ranges<U, T>
894 constexpr void assign(U&& rhs, size_type index);
896 [[nodiscard]]
constexpr std::ptrdiff_t data_buffer_distance(
offset_type byte_offset)
const;
920 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
924 const auto type = this->get_arrow_proxy().data_type();
932 && std::same_as<OT, int64_t>) )
936 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
945 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
954 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
955 template <std::ranges::range SIZES_RANGE>
960 std::forward<SIZES_RANGE>(sizes)
964 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
965 template <mpl::
char_like C, val
idity_bitmap_input VB, input_metadata_container METADATA_RANGE>
966 arrow_proxy variable_size_binary_array_impl<T, CR, OT, Ext>::create_proxy(
968 offset_buffer_type&& offsets,
970 std::optional<std::string_view> name,
971 std::optional<METADATA_RANGE> metadata
974 const auto size = offsets.size() - 1;
989 std::vector<buffer<std::uint8_t>> arr_buffs;
990 arr_buffs.reserve(3);
991 arr_buffs.emplace_back(std::move(vbitmap).extract_storage());
992 arr_buffs.emplace_back(std::move(offsets).extract_storage());
993 arr_buffs.emplace_back(std::move(data_buffer).extract_storage());
996 static_cast<std::int64_t
>(size),
997 static_cast<int64_t
>(null_count),
999 std::move(arr_buffs),
1005 return arrow_proxy{std::move(arr), std::move(schema)};
1008 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1009 template <std::ranges::input_range R, val
idity_bitmap_input VB, input_metadata_container METADATA_RANGE>
1011 std::ranges::input_range<std::ranges::range_value_t<R>> &&
1015 arrow_proxy variable_size_binary_array_impl<T, CR, OT, Ext>::create_proxy(
1017 VB&& validity_input,
1018 std::optional<std::string_view> name,
1019 std::optional<METADATA_RANGE> metadata
1022 using values_inner_value_type = std::ranges::range_value_t<std::ranges::range_value_t<R>>;
1024 auto size_range = values
1025 | std::views::transform(
1028 return std::ranges::size(v);
1031 auto offset_buffer = offset_from_sizes(size_range);
1033 return create_proxy(
1034 std::move(data_buffer),
1035 std::move(offset_buffer),
1036 std::forward<VB>(validity_input),
1037 std::forward<std::optional<std::string_view>>(name),
1038 std::forward<std::optional<METADATA_RANGE>>(metadata)
1042 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1043 template <std::ranges::input_range R, input_metadata_container METADATA_RANGE>
1044 requires std::is_same_v<std::ranges::range_value_t<R>,
nullable<T>>
1045 arrow_proxy variable_size_binary_array_impl<T, CR, OT, Ext>::create_proxy(
1047 std::optional<std::string_view> name,
1048 std::optional<METADATA_RANGE> metadata
1052 const auto values = range | std::views::transform(
nullable_get);
1053 const auto is_non_null = range
1054 | std::views::transform(
1057 return v.has_value();
1060 return self_type::create_proxy(values, is_non_null, std::move(name), std::move(metadata));
1063 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1065 std::ranges::input_range R,
1068 std::ranges::input_range<std::ranges::range_value_t<R>> &&
1073 [[nodiscard]]
arrow_proxy variable_size_binary_array_impl<T, CR, OT, Ext>::create_proxy(
1076 std::optional<std::string_view> name,
1077 std::optional<METADATA_RANGE> metadata
1080 using values_inner_value_type = std::ranges::range_value_t<std::ranges::range_value_t<R>>;
1081 const size_t size = std::ranges::size(values);
1083 auto size_range = values
1084 | std::views::transform(
1087 return std::ranges::size(v);
1090 auto offset_buffer = offset_from_sizes(size_range);
1091 return create_proxy_impl(
1092 std::move(data_buffer),
1093 std::move(offset_buffer),
1101 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1102 template <mpl::
char_like C, input_metadata_container METADATA_RANGE>
1103 [[nodiscard]]
arrow_proxy variable_size_binary_array_impl<T, CR, OT, Ext>::create_proxy_impl(
1105 offset_buffer_type&& list_offsets,
1106 std::optional<validity_bitmap>&& bitmap,
1107 std::optional<std::string_view> name,
1108 std::optional<METADATA_RANGE> metadata
1111 const auto size = list_offsets.size() - 1;
1112 const auto null_count = bitmap.has_value() ? bitmap->null_count() : 0;
1114 const std::optional<std::unordered_set<sparrow::ArrowFlag>>
1115 flags = bitmap.has_value()
1122 std::move(metadata),
1130 std::vector<buffer<std::uint8_t>> arr_buffs;
1131 arr_buffs.reserve(3);
1132 arr_buffs.emplace_back(
1133 bitmap.has_value() ? std::move(*bitmap).extract_storage()
1136 arr_buffs.emplace_back(std::move(list_offsets).extract_storage());
1137 arr_buffs.emplace_back(std::move(data_buffer).extract_storage());
1140 static_cast<std::int64_t
>(size),
1141 static_cast<int64_t
>(null_count),
1143 std::move(arr_buffs),
1149 arrow_proxy proxy{std::move(arr), std::move(schema)};
1154 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1155 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::data(size_type i) -> data_iterator
1159 return proxy.buffers()[DATA_BUFFER_INDEX].template data<data_value_type>() + i;
1162 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1163 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::data(size_type i)
const
1164 -> const_data_iterator
1166 const arrow_proxy& proxy = this->get_arrow_proxy();
1168 return proxy.buffers()[DATA_BUFFER_INDEX].template data<const data_value_type>() + i;
1171 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1172 template <std::ranges::sized_range U>
1174 constexpr void variable_size_binary_array_impl<T, CR, OT, Ext>::assign(U&& rhs, size_type index)
1177 const auto offset_beg = *offset(index);
1178 const auto offset_end = *offset(index + 1);
1179 const auto initial_value_length = offset_end - offset_beg;
1180 const auto new_value_length =
static_cast<OT
>(std::ranges::size(rhs));
1181 const OT shift_byte_count = new_value_length - initial_value_length;
1182 auto& data_buffer = this->get_arrow_proxy().get_array_private_data()->buffers()[DATA_BUFFER_INDEX];
1183 if (shift_byte_count != 0)
1186 if (shift_byte_count > 0)
1188 const offset_type last_offset = *offset(
size());
1189 check_offset_overflow(last_offset, shift_byte_count);
1192 const auto shift_val_abs =
static_cast<size_t>(std::abs(shift_byte_count));
1193 const auto new_data_buffer_size = shift_byte_count < 0 ? data_buffer.size() - shift_val_abs
1194 : data_buffer.size() + shift_val_abs;
1196 if (shift_byte_count > 0)
1198 data_buffer.resize(new_data_buffer_size);
1199 auto* data_begin = data_buffer.template data<data_value_type>();
1200 auto* data_end = data_begin +
static_cast<std::ptrdiff_t
>(data_buffer.size());
1203 data_begin + data_buffer_distance(offset_end),
1204 data_end - data_buffer_distance(shift_byte_count),
1210 auto* data_begin = data_buffer.template data<data_value_type>();
1211 auto* data_end = data_begin +
static_cast<std::ptrdiff_t
>(data_buffer.size());
1213 data_begin + data_buffer_distance(offset_end),
1215 data_begin + data_buffer_distance(offset_end + shift_byte_count)
1217 data_buffer.resize(new_data_buffer_size);
1223 [shift_byte_count](
auto& offset)
1225 offset += shift_byte_count;
1229 auto tmp = std::views::transform(
1233 return static_cast<data_value_type
>(val);
1236 auto* data_begin = data_buffer.template data<data_value_type>();
1238 std::copy(std::ranges::begin(tmp), std::ranges::end(tmp), data_begin + data_buffer_distance(offset_beg));
1241 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1243 variable_size_binary_array_impl<T, CR, OT, Ext>::data_buffer_distance(offset_type byte_offset)
const
1246 using promoted_type = std::common_type_t<offset_type, std::ptrdiff_t>;
1248 static_cast<promoted_type
>(byte_offset)
1249 >=
static_cast<promoted_type
>(std::numeric_limits<std::ptrdiff_t>::min())
1252 static_cast<promoted_type
>(byte_offset)
1253 <=
static_cast<promoted_type
>(std::numeric_limits<std::ptrdiff_t>::max())
1255 return static_cast<std::ptrdiff_t
>(byte_offset);
1258 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1259 constexpr void variable_size_binary_array_impl<T, CR, OT, Ext>::check_offset_overflow(
1260 offset_type current_offset,
1261 offset_type size_to_add
1264 constexpr offset_type max_offset = std::numeric_limits<offset_type>::max();
1265 if (current_offset > max_offset - size_to_add)
1267 throw std::overflow_error(
"Offset overflow: adding elements would exceed maximum offset value");
1271 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1272 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::offset(size_type i) -> offset_iterator
1275 return get_arrow_proxy().buffers()[OFFSET_BUFFER_INDEX].template data<OT>()
1276 +
static_cast<size_type
>(this->get_arrow_proxy().offset()) + i;
1279 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1280 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::offset(size_type i)
const
1281 -> const_offset_iterator
1284 return this->get_arrow_proxy().buffers()[OFFSET_BUFFER_INDEX].template data<OT>()
1285 +
static_cast<size_type
>(this->get_arrow_proxy().offset()) + i;
1288 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1289 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::offsets_begin() -> offset_iterator
1294 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1295 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::offsets_cbegin() const
1296 -> const_offset_iterator
1301 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1302 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::offsets_end() -> offset_iterator
1304 return offset(
size() + 1);
1307 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1308 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::offsets_cend() const
1309 -> const_offset_iterator
1311 return offset(
size() + 1);
1314 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1321 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1326 const OT offset_begin = *offset(i);
1328 const OT offset_end = *offset(i + 1);
1335 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1336 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::value_begin() -> value_iterator
1338 return value_iterator{
this, 0};
1341 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1342 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::value_end() -> value_iterator
1347 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1348 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::value_cbegin() const -> const_value_iterator
1350 return const_value_iterator{
this, 0};
1353 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1354 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::value_cend() const -> const_value_iterator
1359 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1360 template <std::ranges::sized_range U>
1362 constexpr void variable_size_binary_array_impl<T, CR, OT, Ext>::resize_values(size_type new_length, U value)
1364 const size_t new_size = new_length +
static_cast<size_t>(this->get_arrow_proxy().offset());
1365 auto& buffers = this->get_arrow_proxy().get_array_private_data()->buffers();
1366 if (new_length <
size())
1368 const auto offset_begin =
static_cast<size_t>(*offset(new_length));
1369 auto& data_buffer = buffers[DATA_BUFFER_INDEX];
1370 data_buffer.resize(offset_begin);
1371 auto& offset_buffer = buffers[OFFSET_BUFFER_INDEX];
1373 offset_buffer_adaptor.resize(new_size + 1);
1375 else if (new_length >
size())
1377 insert_value(value_cend(), value, new_length -
size());
1381 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1382 template <std::ranges::sized_range U>
1388 const auto idx =
static_cast<size_t>(std::distance(value_cbegin(), pos));
1389 const OT offset_begin = *offset(idx);
1390 auto casted_value = std::ranges::views::transform(
1394 return static_cast<std::uint8_t
>(val);
1397 const auto my_repeat_view =
repeat_view{casted_value, count};
1398 const auto joined_repeated_value_range = std::ranges::views::join(my_repeat_view);
1399 auto& data_buffer = this->get_arrow_proxy().get_array_private_data()->buffers()[DATA_BUFFER_INDEX];
1400 const auto* data_begin = data_buffer.template data<std::uint8_t>();
1401 using data_buffer_type = std::remove_reference_t<
decltype(data_buffer)>;
1402 const auto pos_to_insert =
typename data_buffer_type::const_iterator(
1403 data_begin + data_buffer_distance(offset_begin)
1405 data_buffer.insert(pos_to_insert, joined_repeated_value_range.begin(), joined_repeated_value_range.end());
1406 insert_offset(offsets_cbegin() + idx + 1,
static_cast<offset_type>(
value.size()), count);
1410 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1411 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::insert_offset(
1412 const_offset_iterator pos,
1413 offset_type value_size,
1415 ) -> offset_iterator
1417 auto& offset_buffer = get_arrow_proxy().get_array_private_data()->buffers()[OFFSET_BUFFER_INDEX];
1418 const auto idx =
static_cast<size_t>(std::distance(offsets_cbegin(), pos));
1420 const offset_type cumulative_size = value_size *
static_cast<offset_type
>(count);
1423 if (!offset_buffer_adaptor.empty())
1425 const offset_type last_offset = offset_buffer_adaptor.back();
1426 check_offset_overflow(last_offset, cumulative_size);
1432 offset_buffer_adaptor.end(),
1433 [cumulative_size](
auto& offset)
1435 offset += cumulative_size;
1438 offset_buffer_adaptor.insert(
sparrow::next(offset_buffer_adaptor.cbegin(), idx + 1), count, 0);
1440 for (
size_t i = idx + 1; i < idx + 1 + count; ++i)
1442 offset_buffer_adaptor[i] = offset_buffer_adaptor[i - 1] + value_size;
1444 return offsets_begin() + idx;
1447 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1448 template <mpl::iterator_of_type<T> InputIt>
1449 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::insert_values(
1455 auto& data_buffer = get_arrow_proxy().get_array_private_data()->buffers()[DATA_BUFFER_INDEX];
1457 auto values = std::ranges::subrange(first, last);
1458 const size_t cumulative_sizes = std::accumulate(
1462 [](
size_t acc,
const T&
value)
1464 return acc + value.size();
1467 data_buffer_adaptor.resize(data_buffer_adaptor.size() + cumulative_sizes);
1468 const auto idx =
static_cast<size_t>(std::distance(value_cbegin(), pos));
1469 const OT offset_begin = *offset(idx);
1470 auto* data_begin = data_buffer_adaptor.data();
1471 auto* data_end = data_begin +
static_cast<std::ptrdiff_t
>(data_buffer_adaptor.size());
1472 auto* insert_pos = data_begin + data_buffer_distance(offset_begin);
1475 std::move_backward(insert_pos, data_end -
static_cast<std::ptrdiff_t
>(cumulative_sizes), data_end);
1477 for (
const T&
value : values)
1479 std::copy(
value.begin(),
value.end(), insert_pos);
1480 std::advance(insert_pos,
static_cast<std::ptrdiff_t
>(
value.size()));
1483 const auto sizes_of_each_value = std::ranges::views::transform(
1490 insert_offsets(offset(idx + 1), sizes_of_each_value.begin(), sizes_of_each_value.end());
1494 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1495 template <mpl::iterator_of_type<OT> InputIt>
1496 constexpr auto variable_size_binary_array_impl<T, CR, OT, Ext>::insert_offsets(
1498 InputIt first_sizes,
1505 auto& offset_buffer = get_arrow_proxy().get_array_private_data()->buffers()[OFFSET_BUFFER_INDEX];
1507 const auto idx = std::distance(offsets_cbegin(), pos);
1510# pragma GCC diagnostic push
1511# pragma GCC diagnostic ignored "-Wnull-dereference"
1513 const OT cumulative_sizes = std::reduce(first_sizes, last_sizes, OT(0));
1515# pragma GCC diagnostic pop
1519 if (!offset_buffer_adaptor.empty())
1521 const offset_type last_offset = offset_buffer_adaptor.back();
1522 check_offset_overflow(last_offset, cumulative_sizes);
1525 const auto sizes_count = std::distance(first_sizes, last_sizes);
1526 offset_buffer_adaptor.resize(offset_buffer_adaptor.size() +
static_cast<size_t>(sizes_count));
1529 offset_buffer_adaptor.begin() + idx,
1530 offset_buffer_adaptor.end() - sizes_count,
1531 offset_buffer_adaptor.end()
1535 offset_buffer_adaptor.begin() + idx + sizes_count,
1536 offset_buffer_adaptor.end(),
1537 [cumulative_sizes](
auto& offset)
1539 offset += cumulative_sizes;
1543 InputIt it = first_sizes;
1544 for (
size_t i =
static_cast<size_t>(idx + 1); i < static_cast<size_t>(idx + sizes_count + 1); ++i)
1548# pragma GCC diagnostic push
1549# pragma GCC diagnostic ignored "-Wnull-dereference"
1551 offset_buffer_adaptor[i] = offset_buffer_adaptor[i - 1] + *it;
1553# pragma GCC diagnostic pop
1557 return offset(
static_cast<size_t>(idx));
1560 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1562 variable_size_binary_array_impl<T, CR, OT, Ext>::erase_values(const_value_iterator pos, size_type count)
1567 const size_t index =
static_cast<size_t>(std::distance(value_cbegin(), pos));
1572 auto& data_buffer = get_arrow_proxy().get_array_private_data()->buffers()[DATA_BUFFER_INDEX];
1573 const auto offset_begin = *offset(index);
1574 const auto offset_end = *offset(index + count);
1575 const size_t difference =
static_cast<size_t>(offset_end - offset_begin);
1576 auto* data_begin = data_buffer.template data<data_value_type>();
1577 auto* data_end = data_begin +
static_cast<std::ptrdiff_t
>(data_buffer.size());
1580 data_begin + data_buffer_distance(offset_end),
1582 data_begin + data_buffer_distance(offset_begin)
1584 data_buffer.resize(data_buffer.size() - difference);
1586 erase_offsets(offset(index), count);
1590 template <std::ranges::sized_range T,
class CR, layout_offset OT,
typename Ext>
1592 variable_size_binary_array_impl<T, CR, OT, Ext>::erase_offsets(const_offset_iterator pos, size_type count)
1597 const size_t index =
static_cast<size_t>(std::distance(offsets_cbegin(), pos));
1600 return offset(index);
1602 auto& offset_buffer = get_arrow_proxy().get_array_private_data()->buffers()[OFFSET_BUFFER_INDEX];
1604 const OT offset_start_value = *offset(index);
1605 const OT offset_end_value = *offset(index + count);
1606 const OT difference = offset_end_value - offset_start_value;
1609 sparrow::next(offset_buffer_adaptor.begin(), index + count + 1),
1610 offset_buffer_adaptor.end(),
1613 offset_buffer_adaptor.resize(offset_buffer_adaptor.size() - count);
1617 offset_buffer_adaptor.end(),
1618 [difference](OT& offset)
1620 offset -= difference;
1623 return offset(index);
typename base_type::const_bitmap_range const_bitmap_range
typename base_type::iterator_tag iterator_tag
constexpr array_bitmap_base_impl & operator=(const array_bitmap_base_impl &)
std::conditional_t< is_mutable, mutable_array_base< D >, array_crtp_base< D > > base_type
typename base_type::bitmap_const_reference bitmap_const_reference
typename base_type::bitmap_type bitmap_type
typename base_type::difference_type difference_type
Object that owns a piece of contiguous memory.
bitset_iterator< self_type, true > const_iterator
bitset_iterator< self_type, false > iterator
constexpr size_type null_count() const noexcept
Returns the number of bits set to false (null/invalid).
typename storage_type::default_allocator default_allocator
A view that repeats a value a given number of times.
This buffer class is used as storage buffer for all sparrow arrays.
A variable-size binary array.
variable_size_binary_array_impl(variable_size_binary_array_impl &&rhs) noexcept=default
Move constructor.
typename inner_types::offset_iterator offset_iterator
variable_size_binary_array_impl(const variable_size_binary_array_impl &rhs)
Copy constructor.
typename base_type::difference_type difference_type
typename inner_types::data_iterator data_iterator
u8_buffer< char > char_buffer_type
static constexpr auto offset_from_sizes(SIZES_RANGE &&sizes) -> offset_buffer_type
Creates offset buffer from a range of sizes.
typename base_type::iterator_tag iterator_tag
u8_buffer< std::uint8_t > uint8_buffer_type
constexpr inner_reference value(size_type i)
Gets mutable reference to element at specified index.
typename base_type::bitmap_reference bitmap_reference
nullable< inner_reference, bitmap_reference > reference
typename inner_types::data_value_type data_value_type
mutable_array_bitmap_base< self_type > base_type
variable_size_binary_array_impl< T, arrow_traits< std::string >::const_reference, OT, Ext > self_type
array_inner_types< self_type > inner_types
typename inner_types::inner_value_type inner_value_type
typename inner_types::const_data_iterator const_data_iterator
nullable< inner_const_reference, bitmap_const_reference > const_reference
typename base_type::bitmap_const_reference bitmap_const_reference
nullable< inner_value_type > value_type
typename inner_types::value_iterator value_iterator
variable_size_binary_array_impl(ARGS &&... args)
Generic constructor for creating array from various inputs.
constexpr inner_const_reference value(size_type i) const
Gets const reference to element at specified index.
variable_size_binary_array_impl & operator=(variable_size_binary_array_impl &&rhs) noexcept=default
Move assignment operator.
variable_size_binary_array_impl & operator=(const variable_size_binary_array_impl &rhs)
Copy assignment operator.
typename base_type::bitmap_type bitmap_type
variable_size_binary_array_impl(arrow_proxy)
Constructs array from Arrow proxy.
u8_buffer< std::byte > byte_buffer_type
typename inner_types::inner_const_reference inner_const_reference
typename inner_types::inner_reference inner_reference
typename base_type::size_type size_type
typename base_type::const_bitmap_range const_bitmap_range
typename inner_types::const_offset_iterator const_offset_iterator
typename inner_types::offset_type offset_type
typename inner_types::const_value_iterator const_value_iterator
u8_buffer< std::remove_const_t< offset_type > > offset_buffer_type
Iterator over the data values of a variable size binary layout.
Concept for iterator types.
Concept for character-like types.
Concept for convertible range types.
#define SPARROW_CONSTEXPR_GCC_11
#define SPARROW_ASSERT_TRUE(expr__)
SPARROW_API void increase(const std::string &key)
constexpr sparrow::u8_buffer< OFFSET_TYPE > offset_buffer_from_sizes(SIZES_RANGE &&sizes)
constexpr std::size_t size(typelist< T... >={})
Gets the count of types contained in a typelist.
constexpr bool excludes_copy_and_move_ctor_v
Convenience variable template for excludes_copy_and_move_ctor.
constexpr bool is_type_instance_of_v
Variable template for convenient access to is_type_instance_of.
binary_array_impl< std::int64_t > big_binary_array
Type alias for variable-size binary arrays with 64-bit offsets.
array_bitmap_base_impl< D, true > mutable_array_bitmap_base
Convenient alias for arrays with mutable validity bitmaps.
ArrowSchema make_arrow_schema(F format, N name, std::optional< M > metadata, std::optional< std::unordered_set< ArrowFlag > > flags, ArrowSchema **children, const CHILDREN_OWNERSHIP &children_ownership, ArrowSchema *dictionary, bool dictionary_ownership)
Creates an ArrowSchema owned by a unique_ptr and holding the provided data.
constexpr bool is_big_string_array_v
Checks whether T is a big_string_array type.
constexpr bool is_string_array_v
Checks whether T is a string_array type.
variable_size_binary_array_impl< arrow_traits< std::vector< byte_t > >::value_type, arrow_traits< std::vector< byte_t > >::const_reference, OT, Ext > binary_array_impl
constexpr InputIt next(InputIt it, Distance n)
string_array_impl< std::int64_t > big_string_array
Type alias for variable-size string arrays with 64-bit offsets.
string_array_impl< std::int32_t > string_array
Type alias for variable-size string arrays with 32-bit offsets.
constexpr bool is_big_binary_array_v
Checks whether T is a big_binary_array type.
constexpr nullable_get_fn nullable_get
ArrowArray make_arrow_array(int64_t length, int64_t null_count, int64_t offset, B buffers, ArrowArray **children, const CHILDREN_OWNERSHIP &children_ownership, ArrowArray *dictionary, bool dictionary_ownership)
Creates an ArrowArray.
dynamic_bitset< std::uint8_t > validity_bitmap
Type alias for a validity bitmap using 8-bit storage blocks.
variable_size_binary_array_impl< arrow_traits< std::string >::value_type, arrow_traits< std::string >::const_reference, OT, Ext > string_array_impl
constexpr bool is_binary_array_v
Checks whether T is a binary_array type.
binary_array_impl< std::int32_t > binary_array
Type alias for variable-size binary arrays with 32-bit offsets.
auto make_buffer_adaptor(FromBufferRef &buf)
validity_bitmap ensure_validity_bitmap(std::size_t size, R &&validity_input)
Ensures a validity bitmap of the specified size from various input types.
repeat_view(T &, size_t) -> repeat_view< T & >
data_type
Runtime identifier of arrow data types, usually associated with raw bytes with the associated value.
Extensions to the C++ standard library.
data_iterator value_iterator
bitmap_type::iterator bitmap_iterator
inner_value_type value_type
array_inner_types< variable_size_binary_array_impl< T, CR, OT > >::iterator_tag iterator_tag
inner_reference reference
array_inner_types< variable_size_binary_array_impl< T, CR, OT > >::iterator_tag iterator_tag
inner_value_type value_type
const_bitmap_iterator bitmap_iterator
inner_const_reference reference
const_data_iterator value_iterator
const OT * const_offset_iterator
variable_size_binary_array_impl< T, CR, OT, Ext > array_type
const data_value_type * const_data_iterator
bitmap_type::const_iterator const_bitmap_iterator
data_value_type * data_iterator
variable_size_binary_value_iterator< array_type, iterator_types > value_iterator
std::random_access_iterator_tag iterator_tag
variable_size_binary_value_iterator< array_type, const_iterator_types > const_value_iterator
variable_size_binary_reference< array_type > inner_reference
typename T::value_type data_value_type
Base class for array_inner_types specializations.
Traits class that must be specialized by array implementations.
Provides compile-time information about Arrow data types.
static constexpr sparrow::data_type get() noexcept
static constexpr sparrow::data_type get() noexcept
static constexpr sparrow::data_type get() noexcept
static constexpr sparrow::data_type get() noexcept
Metafunction for retrieving the data_type of a typed array.