-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support for timestamps Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * Test both macOS 13 and macOS 14 Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> Co-authored-by: Klaim <Klaim@users.noreply.github.com> * Only install howardhinnant_date on macOS Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> Co-authored-by: Johan Mabille <johan.mabille@gmail.com> * Explicitly specify the Duration template type parameter Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * Include <version> Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * Use HowardHinnant/date everywhere for now Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * Specialization of `make_test_array_data` Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * wip: Adapt tests for sparrow::timestamp Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * Explicitly list integer values for `data_type`'s enumerands See: https://github.com/apache/arrow/blob/b2e8c33c86c819b167a1cbca834da3c9047a9350/cpp/src/arrow/type_fwd.h#L310 Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * wip: Adapt tests for sparrow::timestamp Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * Also link against date::date-tz Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * Adapt tests for timestamps Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * Add flag on date polyfill and <chrono> with mingw * Remove duplicated guard Co-authored-by: Alexis Placet <alexis.placet@quantstack.net> Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * Define a constant for Unix Time Co-authored-by: Alexis Placet <alexis.placet@quantstack.net> Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * Use LLVM/Clang 17 This version or a newer on is expected by the Visual Studio2022. See: https://github.com/xtensor-stack/sparrow/actions/runs/9381890699/job/25832125441?pr=70 Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> --------- Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> Co-authored-by: Klaim <Klaim@users.noreply.github.com> Co-authored-by: Johan Mabille <johan.mabille@gmail.com> Co-authored-by: Sylvain Corlay <sylvain.corlay@gmail.com>
- Loading branch information
1 parent
4131341
commit 3fa5e86
Showing
12 changed files
with
388 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "array_data_creation.hpp" | ||
|
||
#include <chrono> | ||
#include <stdexcept> | ||
#include <vector> | ||
|
||
#if defined(SPARROW_USE_DATE_POLYFILL) | ||
#include <date/date.h> | ||
#include <date/tz.h> | ||
#else | ||
namespace date = std::chrono; | ||
#endif | ||
|
||
namespace sparrow::test | ||
{ | ||
using sys_time = std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>; | ||
|
||
template <> | ||
sparrow::array_data | ||
make_test_array_data<sparrow::timestamp>(std::size_t n, std::size_t offset, const std::vector<std::size_t>& false_bitmap) | ||
{ | ||
sparrow::array_data ad; | ||
ad.type = sparrow::data_descriptor(sparrow::arrow_traits<sparrow::timestamp>::type_id); | ||
ad.bitmap = sparrow::dynamic_bitset<uint8_t>(n, true); | ||
for (const auto i : false_bitmap) | ||
{ | ||
if (i >= n) | ||
{ | ||
throw std::invalid_argument("Index out of range"); | ||
} | ||
ad.bitmap.set(i, false); | ||
} | ||
const std::size_t buffer_size = (n * sizeof(sparrow::timestamp)) / sizeof(uint8_t); | ||
sparrow::buffer<uint8_t> b(buffer_size); | ||
|
||
for (uint8_t i = 0; i < n; ++i) | ||
{ | ||
b.data<sparrow::timestamp>()[i] = sparrow::timestamp(date::sys_days(date::year(1970)/date::January/date::day(1)) + date::days(i)); | ||
} | ||
|
||
ad.buffers.push_back(b); | ||
ad.length = static_cast<std::int64_t>(n); | ||
ad.offset = static_cast<std::int64_t>(offset); | ||
ad.child_data.emplace_back(); | ||
return ad; | ||
} | ||
} // namespace sparrow::test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.