Skip to content

Conversation

@etseidl
Copy link
Contributor

@etseidl etseidl commented Oct 21, 2025

Which issue does this PR close?

Rationale for this change

While converting to the new Thrift model, the ConvertedType enum was done manually due to the NONE variant, which used the discriminant of 0. This PR changes that to -1 which allows the thrift_enum macro to be used instead. This improves code maintainability.

What changes are included in this PR?

See above.

Are these changes tested?

Covered by existing tests

Are there any user-facing changes?

No, this only changes the discriminant value for a unit variant enum.

@github-actions github-actions bot added the parquet Changes to the parquet crate label Oct 21, 2025
@etseidl etseidl changed the title use macro for converted type [thrift-remodel] Use thrift_enum macro for ConvertedType Oct 21, 2025
Copy link
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.

Thanks @etseidl

///
/// This struct was renamed from `LogicalType` in version 4.0.0.
/// If targeting Parquet format 2.4.0 or above, please use [LogicalType] instead.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a breaking API change I think given that ConvertedType is pub: https://docs.rs/parquet/latest/parquet/basic/enum.ConvertedType.html

Maybe to avoid the breaking change, we could deprecate ConvertedType instead 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a breaking API change I think given that ConvertedType is pub: https://docs.rs/parquet/latest/parquet/basic/enum.ConvertedType.html

I'm just curious as to what makes this a breaking change? Adding derived impls or changing the discriminants to match the spec? I didn't think either would qualify.

Maybe to avoid the breaking change, we could deprecate ConvertedType instead 🤔

I like the way you think 😄. I think it's long overdue to standardize on logical type and stop using converted type altogether.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just curious as to what makes this a breaking change? Adding derived impls or changing the discriminants to match the spec? I didn't think either would qualify.

My reading of the diff of this PR is that it removes pub enum ConvertedType, which is a public struct

Thus if anyone has code that refers to ConvertedType, removing it would cause their code to stop compiling

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the way you think 😄. I think it's long overdue to standardize on logical type and stop using converted type altogether.

💯

Copy link
Contributor Author

@etseidl etseidl Oct 24, 2025

Choose a reason for hiding this comment

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

My reading of the diff of this PR is that it removes pub enum ConvertedType, which is a public struct

Ahh. The thrift_enum macro makes all enums pub, so that doesn't change.

pub enum $identifier {

Edit: I guess that fact could be better documented

/// A BSON document embedded within a single BINARY column.
BSON = 20;

/// An interval of time
Copy link
Contributor

Choose a reason for hiding this comment

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

this certainly looks a lot nicer

Copy link
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 @etseidl

alamb pushed a commit that referenced this pull request Oct 24, 2025
# Which issue does this PR close?

N/A

# Rationale for this change

It is not obvious that the thrift macros produce public enums only (e.g.
see
#8680 (comment)).
This should be made clear in the documentation.

# What changes are included in this PR?

Add said clarification.

# Are these changes tested?

Documentation only, so no tests required.

# Are there any user-facing changes?

No, only changes to private documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants