Skip to content

[Variant] Support Timestamp to variant for cast_to_variant kernel#8113

Merged
alamb merged 5 commits intoapache:mainfrom
abacef:timestamp_to_variant
Aug 13, 2025
Merged

[Variant] Support Timestamp to variant for cast_to_variant kernel#8113
alamb merged 5 commits intoapache:mainfrom
abacef:timestamp_to_variant

Conversation

@abacef
Copy link
Copy Markdown
Contributor

@abacef abacef commented Aug 12, 2025

Which issue does this PR close?

We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax.

Rationale for this change

Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.

What changes are included in this PR?

There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.

Are these changes tested?

We typically require tests for all PRs in order to:

  1. Prevent the code from being accidentally broken by subsequent changes
  2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?

I am pretty sure I tested all the code paths

Are there any user-facing changes?

If there are user-facing changes then we may require documentation to be updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.

There is some documentation saying that nanoseconds will get truncated when converted

@abacef
Copy link
Copy Markdown
Contributor Author

abacef commented Aug 12, 2025

This is pretty DRY so feel free to propose wetting it

let timestamp = DateTime::from_timestamp_nanos(microseconds * 1000);
run_test(
array_tz,
vec![Some(Variant::TimestampMicros(timestamp)), None],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust variant support does not include Variant::TimestampNanos link?

Copy link
Copy Markdown
Member

@klion26 klion26 Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, currently, Variant::TimestampNanos/UUID/TimeNTZ has not been supported, I added TimeNTZ in #8114

@alamb alamb changed the title Timestamp to variant [Variant] Timestamp to variant Aug 12, 2025
@alamb alamb changed the title [Variant] Timestamp to variant [Variant] Support Timestamp to variant for cast_to_variant kernel Aug 12, 2025
Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @abacef and @klion26 -- I think this looks good to me 🙏

@alamb
Copy link
Copy Markdown
Contributor

alamb commented Aug 13, 2025

I merged up to resolve a conflict

@github-actions github-actions Bot added the parquet-variant parquet-variant* crates label Aug 13, 2025
@alamb alamb merged commit 991170d into apache:main Aug 13, 2025
13 checks passed
@alamb
Copy link
Copy Markdown
Contributor

alamb commented Aug 13, 2025

Thanks again @abacef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet-variant parquet-variant* crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Variant]: Implement DataType::Timestamp(..) support for cast_to_variant kernel

3 participants