|
| timestamp_array (arrow_proxy) |
| Constructs timestamp array from Arrow proxy.
|
|
template<class... Args>
requires (mpl::excludes_copy_and_move_ctor_v<timestamp_array, Args...>) |
constexpr | timestamp_array (Args &&... args) |
| Generic constructor for creating timestamp arrays from various inputs.
|
|
template<input_metadata_container METADATA_RANGE = std::vector<metadata_pair>> |
constexpr | timestamp_array (const date::time_zone *timezone, std::initializer_list< inner_value_type > init, std::optional< std::string_view > name=std::nullopt, std::optional< METADATA_RANGE > metadata=std::nullopt) |
| Constructs timestamp array from initializer list.
|
|
constexpr | timestamp_array (const timestamp_array &rhs) |
| Copy constructor.
|
|
constexpr timestamp_array & | operator= (const timestamp_array &rhs) |
| Copy assignment operator.
|
|
constexpr | timestamp_array (timestamp_array &&rhs) |
| Move constructor.
|
|
constexpr timestamp_array & | operator= (timestamp_array &&rhs) |
| Move assignment operator.
|
|
template<std::ranges::input_range R, input_metadata_container METADATA_RANGE>
requires std::convertible_to<std::ranges::range_value_t<R>, T> |
arrow_proxy | create_proxy (const date::time_zone *timezone, R &&range, bool nullable, std::optional< std::string_view > name, std::optional< METADATA_RANGE > metadata) |
|
constexpr auto | insert_bitmap (const_bitmap_iterator pos, InputIt first, InputIt last) -> bitmap_iterator is_mutable |
|
constexpr auto | insert_bitmap (const_bitmap_iterator pos, InputIt first, InputIt last) -> bitmap_iterator is_mutable |
|
|
| array_bitmap_base_impl (arrow_proxy proxy) |
| Constructs array bitmap base from Arrow proxy.
|
|
constexpr | array_bitmap_base_impl (const array_bitmap_base_impl &) |
| Copy constructor.
|
|
constexpr array_bitmap_base_impl & | operator= (const array_bitmap_base_impl &) |
| Copy assignment operator.
|
|
constexpr | array_bitmap_base_impl (array_bitmap_base_impl &&) noexcept=default |
|
constexpr array_bitmap_base_impl & | operator= (array_bitmap_base_impl &&) noexcept=default |
|
constexpr bitmap_type & | get_bitmap () |
| Gets mutable reference to the validity bitmap.
|
|
constexpr const bitmap_type & | get_bitmap () const |
| Gets const reference to the validity bitmap.
|
|
constexpr void | resize_bitmap (size_type new_length, bool value) |
| Resizes the validity bitmap to accommodate new array length.
|
|
constexpr bitmap_iterator | insert_bitmap (const_bitmap_iterator pos, bool value, size_type count) |
| Inserts validity bits at specified position.
|
|
constexpr bitmap_iterator | insert_bitmap (const_bitmap_iterator pos, InputIt first, InputIt last) is_mutable |
| Inserts range of validity bits at specified position.
|
|
constexpr bitmap_iterator | erase_bitmap (const_bitmap_iterator pos, size_type count) |
| Erases validity bits starting at specified position.
|
|
constexpr void | update () |
| Updates internal bitmap after external modifications to Arrow data.
|
|
constexpr non_owning_dynamic_bitset< uint8_t > | get_non_owning_dynamic_bitset () |
| Gets non-owning view of the bitmap as dynamic bitset.
|
|
constexpr bitmap_type | make_bitmap () |
| Creates bitmap wrapper from current Arrow validity buffer.
|
|
| array_bitmap_base_impl (arrow_proxy proxy) |
| Constructs array bitmap base from Arrow proxy.
|
|
constexpr | array_bitmap_base_impl (const array_bitmap_base_impl &) |
| Copy constructor.
|
|
constexpr | array_bitmap_base_impl (array_bitmap_base_impl &&) noexcept=default |
|
constexpr array_bitmap_base_impl & | operator= (const array_bitmap_base_impl &) |
| Copy assignment operator.
|
|
constexpr array_bitmap_base_impl & | operator= (array_bitmap_base_impl &&) noexcept=default |
|
constexpr bitmap_type & | get_bitmap () |
| Gets mutable reference to the validity bitmap.
|
|
constexpr const bitmap_type & | get_bitmap () const |
| Gets const reference to the validity bitmap.
|
|
constexpr void | resize_bitmap (size_type new_length, bool value) |
| Resizes the validity bitmap to accommodate new array length.
|
|
constexpr bitmap_iterator | insert_bitmap (const_bitmap_iterator pos, bool value, size_type count) |
| Inserts validity bits at specified position.
|
|
constexpr bitmap_iterator | insert_bitmap (const_bitmap_iterator pos, InputIt first, InputIt last) is_mutable |
| Inserts range of validity bits at specified position.
|
|
constexpr bitmap_iterator | erase_bitmap (const_bitmap_iterator pos, size_type count) |
| Erases validity bits starting at specified position.
|
|
constexpr void | update () |
| Updates internal bitmap after external modifications to Arrow data.
|
|
constexpr non_owning_dynamic_bitset< uint8_t > | get_non_owning_dynamic_bitset () |
| Gets non-owning view of the bitmap as dynamic bitset.
|
|
constexpr bitmap_type | make_bitmap () |
| Creates bitmap wrapper from current Arrow validity buffer.
|
|
template<timestamp_type T>
class sparrow::timestamp_array< T >
Array implementation for storing timestamp values with timezone information.
The timestamp_array provides efficient storage for datetime values with precise duration types and timezone awareness. It stores timestamps as duration values since the Unix epoch while maintaining timezone information for proper interpretation and conversion.
Key features:
- Timezone-aware timestamp storage
- Support for multiple precision levels (seconds to nanoseconds)
- Efficient columnar memory layout
- Arrow format compatibility
- Nullable timestamp support via validity bitmap
- Mutable operations (insert, erase, resize)
The array internally stores:
- A validity bitmap for null/non-null timestamp tracking
- A contiguous buffer of duration values since Unix epoch
- Timezone pointer for proper timestamp interpretation
Supported timestamp types:
- Template Parameters
-
T | The timestamp type with specific duration precision |
- Precondition
- T must satisfy the timestamp_type concept
-
T must be one of the supported timestamp duration types
- Postcondition
- Maintains Arrow temporal format compatibility
-
All stored timestamps reference the same timezone
-
Thread-safe for read operations, requires external synchronization for writes
const auto* ny_tz = date::locate_zone("America/New_York");
std::vector<timestamp_second> timestamps = {
timestamp_second{ny_tz, std::chrono::sys_seconds{std::chrono::seconds{1609459200}}},
timestamp_second{ny_tz, std::chrono::sys_seconds{std::chrono::seconds{1609545600}}}
};
auto first = arr[0];
if(first.has_value()) {
auto ts = first.value();
}
timestamp_array< timestamp_second > timestamp_seconds_array
Type aliases for timestamp arrays with common durations.
timestamp< std::chrono::seconds > timestamp_second
Type aliases for common timestamp durations.
- Examples
- timestamp_example.cpp.
Definition at line 197 of file timestamp_array.hpp.
template<timestamp_type T>
Generic constructor for creating timestamp arrays from various inputs.
Creates a timestamp array from different input combinations including timezone, values, validity information, and metadata. Arguments are forwarded to compatible create_proxy() functions.
The first argument must always be a const date::time_zone* pointer. Subsequent arguments can include:
- Range of timestamp values
- Validity bitmap or boolean range
- Individual count and fill value
- Array name and metadata
- Template Parameters
-
Args | Parameter pack for constructor arguments |
- Parameters
-
args | Constructor arguments starting with timezone |
- Precondition
- First argument must be valid date::time_zone pointer
-
Remaining arguments must match one of the create_proxy() signatures
-
Args must exclude copy and move constructor signatures
- Postcondition
- Array is created with specified timezone and data
-
All timestamps reference the provided timezone
const auto* utc = date::locate_zone("UTC");
std::vector<timestamp_second> values = {...};
std::vector<bool> validity = {...};
Definition at line 294 of file timestamp_array.hpp.