-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for timestamps #70
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f85ba70
Support for timestamps
jjerphan 423082e
Test both macOS 13 and macOS 14
jjerphan 425d68b
Only install howardhinnant_date on macOS
jjerphan 1e37716
Merge branch 'main' into timestamps
jjerphan 5715cfd
Explicitly specify the Duration template type parameter
jjerphan 05adbcc
Include <version>
jjerphan 62a5da0
Use HowardHinnant/date everywhere for now
jjerphan 3154eac
Merge branch 'main' into timestamps
jjerphan b906a45
Specialization of `make_test_array_data`
jjerphan 7accf0a
wip: Adapt tests for sparrow::timestamp
jjerphan 2f961ef
Explicitly list integer values for `data_type`'s enumerands
jjerphan 0721e0c
wip: Adapt tests for sparrow::timestamp
jjerphan e13ae41
Also link against date::date-tz
jjerphan 411eb4c
Adapt tests for timestamps
jjerphan 5e883bb
Add flag on date polyfill and <chrono> with mingw
SylvainCorlay a85ecaa
Remove duplicated guard
jjerphan a554e0f
Define a constant for Unix Time
jjerphan 6a37966
Use LLVM/Clang 17
jjerphan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is one type missing before that one, see compare with the order of the enum,
BINARY
matchesstd::vector<byte_t>
but we dont have something forFIXED_SIZE_BINARY
. Not sure which type is missing though. @JohanMabille any idea what it would match?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
FIXED_SIZE_BINARY
is meant to be used for a fixed size binary type which is not a primitive type, in which case we could use astruct
as a type to testFIXED_SIZE_BINARY
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the values from Arrow implementation, not sure which type this value should match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, must we work on supporting
DATE32
andDATE64
which come beforeTIMESTAMP
?Edit: I guess we could support
TIMESTAMP
first if we were to have explicit integer identifiers for those types as introduced inarrow-cpp
with apache/arrow#37149 as proposed by 2f961efThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The support for DATE32 and DATE64 can be added later. Explicit integer identifiers would be required later for backward compatibility, but it doe snot matter for now, nor the enum "stability".