Example of usage of the record_batch class.
Example of usage of the record_batch class.
#include <cassert>
{
auto iota = std::ranges::iota_view{std::size_t(0), std::size_t(data_size)};
iota
| std::views::transform(
[](auto i)
{
return static_cast<std::uint16_t>(i);
}
)
);
auto iota2 = std::ranges::iota_view{std::int32_t(4), 4 + std::int32_t(data_size)};
auto iota3 = std::ranges::iota_view{std::int32_t(2), 2 + std::int32_t(data_size)};
std::vector<sparrow::array> arr_list = {
};
return arr_list;
}
{
const std::vector<std::string> name_list = {"first", "second", "third"};
constexpr std::size_t data_size = 10;
assert(record.
name() ==
"record batch name");
assert(record.
nb_rows() == data_size);
assert(std::ranges::equal(record.
names(), name_list));
assert(std::ranges::equal(record.
columns(), array_list));
return EXIT_SUCCESS;
}
Dynamically typed array encapsulating an Arrow layout.
SPARROW_API const std::optional< name_type > & name() const
Gets the name of the record batch.
SPARROW_API const array & get_column(const name_type &key) const
Gets the column with the specified name.
SPARROW_API name_range names() const
Gets a range view of the column names.
SPARROW_API bool contains_column(const name_type &key) const
Checks if the record batch contains a column with the specified name.
SPARROW_API const name_type & get_column_name(size_type index) const
Gets the name of the column at the specified index.
SPARROW_API size_type nb_rows() const
Gets the number of rows in the record batch.
SPARROW_API size_type nb_columns() const
Gets the number of columns in the record batch.
auto columns() const
Gets a range view of the columns.
primitive_array_impl< T, Ext, T2 > primitive_array
Array of values of whose type has fixed binary size.
std::vector< sparrow::array > make_array_list(const std::size_t data_size)