Skip to content

Conversation

@zhjwpku
Copy link
Collaborator

@zhjwpku zhjwpku commented Oct 20, 2025

No description provided.

#include "iceberg/util/temporal_util.h"

#include <chrono>
#include <cstdint>
Copy link
Contributor

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

Copy link
Collaborator Author

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?

static Result<Literal> ExtractHour(const Literal& literal);

/// \brief Construct a Calendar date without timezone or time
static int32_t CreateDate(const TemporalParts& parts);
Copy link
Contributor

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?

Copy link
Collaborator Author

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.


namespace iceberg {

struct ICEBERG_EXPORT TemporalParts {
Copy link
Member

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.

Copy link
Member

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.

@wgtmac wgtmac changed the title feat: construct temporal values from structural inputs test: construct temporal values from structural inputs Oct 21, 2025
@wgtmac wgtmac merged commit 033fa2d into apache:main Oct 21, 2025
10 checks passed
@zhjwpku zhjwpku deleted the construct_temporal_values branch October 23, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants