diff --git a/include/sparrow/data_traits.hpp b/include/sparrow/data_traits.hpp index 2920d5d6..2328ce06 100644 --- a/include/sparrow/data_traits.hpp +++ b/include/sparrow/data_traits.hpp @@ -18,6 +18,8 @@ #include "fixed_size_layout.hpp" #include "variable_size_binary_layout.hpp" +using time_point = std::chrono::zoned_time; + namespace sparrow { @@ -125,6 +127,12 @@ namespace sparrow using default_layout = variable_size_binary_layout, std::span>; // FIXME: this is incorrect, change when we have the right types }; + template <> + struct arrow_traits : common_native_types_traits + { + static constexpr data_type type_id = data_type::TIMESTAMP; + }; + namespace predicate { @@ -147,4 +155,4 @@ namespace sparrow } constexpr has_arrow_traits; } -} \ No newline at end of file +} diff --git a/include/sparrow/data_type.hpp b/include/sparrow/data_type.hpp index ce811886..72544ac9 100644 --- a/include/sparrow/data_type.hpp +++ b/include/sparrow/data_type.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "sparrow/mp_utils.hpp" @@ -82,14 +83,15 @@ namespace sparrow BINARY, // Fixed-size binary. Each value occupies the same number of bytes FIXED_SIZE_BINARY, + // Number of nanoseconds since the UNIX epoch with an optional timezone. + // See: https://arrow.apache.org/docs/python/timestamps.html#timestamps + TIMESTAMP, }; /// C++ types value representation types matching Arrow types. // NOTE: this needs to be in sync-order with `data_type` using all_base_types_t = mpl::typelist< - std::nullopt_t // REVIEW: not sure about if we need to have this one? for representing NA? is this - // the right type? - , + std::nullopt_t, bool, std::uint8_t, std::int8_t, @@ -103,7 +105,8 @@ namespace sparrow float32_t, float64_t, std::string, - std::vector + std::vector, + std::chrono::time_point // TODO: add missing fundamental types here >;