-
Notifications
You must be signed in to change notification settings - Fork 67
test: construct temporal values from structural inputs #267
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
Conversation
| #include "iceberg/util/temporal_util.h" | ||
|
|
||
| #include <chrono> | ||
| #include <cstdint> |
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.
has already been added by the header
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.
This hasn't been directly added by the temporal_util.h, there are uses of int32_t in this file, so I think include the header is fine?
src/iceberg/util/temporal_util.h
Outdated
| static Result<Literal> ExtractHour(const Literal& literal); | ||
|
|
||
| /// \brief Construct a Calendar date without timezone or time | ||
| static int32_t CreateDate(const TemporalParts& parts); |
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.
Should these functions return a Result<>, returning an error message when the parameters in TemporalParts are invalid?
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 just moved these constructors into the test directory, not user-facing API any more, so I think returning the value directly should be fine.
src/iceberg/util/temporal_util.h
Outdated
|
|
||
| namespace iceberg { | ||
|
|
||
| struct ICEBERG_EXPORT TemporalParts { |
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 was thinking that only adding these structures to the test directory to make it easy for us to create Date, Time and Timestamp values in the test cases. Temporal values are notorious to deal with, especially when it comes to timezone and daylight saving rules. We don't want to expose such APIs externally and maintain it hereafter.
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.
Perhaps we should not reuse a single structure to create different temporal types, which leads to unused fields.
No description provided.