Skip to content
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

Seal ArrowPrimitiveType #3882

Merged
merged 3 commits into from
Mar 17, 2023
Merged

Conversation

tustvold
Copy link
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

As ArrowNativeType is sealed, it is hard to see how or why anyone would implement this for a custom type, but sealing it makes this contract very clear.

What changes are included in this PR?

Are there any user-facing changes?

Technically this is a breaking change, practically I sincerely doubt anyone will notice

@tustvold tustvold added the api-change Changes to the arrow API label Mar 17, 2023
@github-actions github-actions bot added the arrow Changes to the arrow crate label Mar 17, 2023
@@ -230,27 +230,7 @@ pub type Decimal128Array = PrimitiveArray<Decimal128Type>;
/// scale less or equal to 76.
pub type Decimal256Array = PrimitiveArray<Decimal256Type>;

/// Trait bridging the dynamic-typed nature of Arrow (via [`DataType`]) with the
/// static-typed nature of rust types ([`ArrowNativeType`]) for all types that implement [`ArrowNativeType`].
pub trait ArrowPrimitiveType: 'static {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved this into types along with all the other traits of this sort

mod run {
use super::*;

pub trait RunEndTypeSealed {}
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 no longer necessary, as PrimitiveType is sealed

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.

LGTM -- @jhorstmann and @viirya may be interested

@jhorstmann
Copy link
Contributor

Fully agree with making this sealed 👍


impl RunEndTypeSealed for Int64Type {}
}

/// A subtype of primitive type that is used as run-ends index
/// in `RunArray`.
/// See <https://arrow.apache.org/docs/format/Columnar.html>
///
/// Note: The implementation of this trait is sealed to avoid accidental misuse.
Copy link
Member

@viirya viirya Mar 17, 2023

Choose a reason for hiding this comment

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

Now a redundant comment line:

Suggested change
/// Note: The implementation of this trait is sealed to avoid accidental misuse.

@viirya
Copy link
Member

viirya commented Mar 17, 2023

Making sense. 👍

@tustvold tustvold merged commit b08490e into apache:master Mar 17, 2023
spebern pushed a commit to spebern/arrow-rs that referenced this pull request Mar 25, 2023
* Seal ArrowPrimitiveType

* Fix doc

* Review feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-change Changes to the arrow API arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants