Skip to content

[Variant] Add Variant::Time primitive and cast logic#8114

Merged
alamb merged 6 commits intoapache:mainfrom
klion26:variant_time
Aug 14, 2025
Merged

[Variant] Add Variant::Time primitive and cast logic#8114
alamb merged 6 commits intoapache:mainfrom
klion26:variant_time

Conversation

@klion26
Copy link
Copy Markdown
Member

@klion26 klion26 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

Add Variant::Time support and cast_to_variant for Variant::Time

What changes are included in this PR?

  • Add Variant::Time primitive support
  • Add primitive_time.metadata and primitive_time.value generated from Iceberg Code into parquet-testing
  • Add cast_to_variant support for Variant::Time

Are these changes tested?

Added tests for the added feature.

Are there any user-facing changes?

No

@github-actions github-actions bot added the parquet Changes to the parquet crate label Aug 12, 2025
@klion26 klion26 force-pushed the variant_time branch 2 times, most recently from 46a82fb to f086463 Compare August 12, 2025 12:00
@klion26
Copy link
Copy Markdown
Member Author

klion26 commented Aug 12, 2025

@alamb please help review this when you're free, thanks.

I've also filed a pr to parquet-testing here

@alamb
Copy link
Copy Markdown
Contributor

alamb commented Aug 12, 2025

Thanks @klion26 !

Add primitive_time.metadata and primitive_time.value generated from Iceberg Code into parquet-testing

Can you please make a PR to parquet-testing repo directly? We'll need to get that repo updated prior to merging this PR

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 @klion26 -- I think this looks great.

We just need to sort out the parquet-testing pin and I think this would be good to merge

I did have a question about utc normalization that might be worth looking at

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this logic looks good to me -- thank you

Comment thread parquet-variant-json/src/to_json.rs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

perhaps the println is left over

Copy link
Copy Markdown
Member Author

@klion26 klion26 Aug 13, 2025

Choose a reason for hiding this comment

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

fixed in the followup pr(will push remote after parquet-testing pr has been merged)

Comment thread parquet-variant-json/src/to_json.rs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if there is a reason not to compare the output json string directly (why look for contains and starts/ends)? One thing a full compare would do is output the actual value in any failure message

Copy link
Copy Markdown
Member Author

@klion26 klion26 Aug 13, 2025

Choose a reason for hiding this comment

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

Fixed it(in the follow-up pr, will push remote after parquet-testing pr has been merged).

Comment thread parquet-variant/src/variant.rs Outdated
Copy link
Copy Markdown
Member Author

@klion26 klion26 left a comment

Choose a reason for hiding this comment

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

@alamb thanks for the review. I've filed pr for parquet-testing(apache/parquet-testing#92), and will update the current pr after the parquet-testing pr has been merged.

Comment thread parquet-variant-json/src/to_json.rs Outdated
Copy link
Copy Markdown
Member Author

@klion26 klion26 Aug 13, 2025

Choose a reason for hiding this comment

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

Fixed it(in the follow-up pr, will push remote after parquet-testing pr has been merged).

Comment thread parquet-variant-json/src/to_json.rs Outdated
Copy link
Copy Markdown
Member Author

@klion26 klion26 Aug 13, 2025

Choose a reason for hiding this comment

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

fixed in the followup pr(will push remote after parquet-testing pr has been merged)

Comment thread parquet-variant/src/variant.rs Outdated
@klion26 klion26 requested a review from alamb August 14, 2025 06:52
@klion26
Copy link
Copy Markdown
Member Author

klion26 commented Aug 14, 2025

Close and reopen to trigger ci

@klion26 klion26 closed this Aug 14, 2025
@klion26 klion26 reopened this Aug 14, 2025
@klion26
Copy link
Copy Markdown
Member Author

klion26 commented Aug 14, 2025

@alamb I've updated the pr, and the pr in parquet-testing has been merged. Please take another look when you're free.

The parquet-testing pr has been added in the current pr(the latest commit id in parquet-testing is the same as the latest commit id in apache/parquet-testing master branch). I can change it if there is something wrong.

The CI tests rust/verify MSRV failed because of error: binary cargo-msrv already exists in destination, it seems is not related to the current pr

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 @klion26 -- this is really solid and well done ❤️

I merged up from main to resolve a conflict and I'll then plan to merge it

Ok(())
}

#[test]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❤️

@alamb
Copy link
Copy Markdown
Contributor

alamb commented Aug 14, 2025

The CI tests rust/verify MSRV failed because of error: binary cargo-msrv already exists in destination, it seems is not related to the current pr

Yes, I agree this does not seem relate. I did some digging and I think it is related to the binary being cached already. I pushed a commit to fix this (hopefully): afbcb4b

@alamb alamb merged commit 48b723f into apache:main Aug 14, 2025
32 checks passed
@alamb
Copy link
Copy Markdown
Contributor

alamb commented Aug 14, 2025

Thank you @klion26 for your patience

@klion26 klion26 deleted the variant_time branch August 15, 2025 03:08
@klion26
Copy link
Copy Markdown
Member Author

klion26 commented Aug 15, 2025

@alamb thank you for your review and merging!

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::Time32/Time64 support for cast_to_variant kernel

2 participants