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

Should be able to specify a name when deriving ArrowField #1774

Closed
Tracked by #1899
teh-cmc opened this issue Apr 5, 2023 · 1 comment
Closed
Tracked by #1899

Should be able to specify a name when deriving ArrowField #1774

teh-cmc opened this issue Apr 5, 2023 · 1 comment
Labels
🏹 arrow concerning arrow

Comments

@teh-cmc
Copy link
Member

teh-cmc commented Apr 5, 2023

You should be able to do this:

#[derive(ArrowField)]
#[arrow_field(name = "rerun.tuid")]
pub struct Tuid {
    /// Approximate nanoseconds since epoch.
    time_ns: u64,

    /// Initialized to something random on each thread,
    /// then incremented for each new [`Tuid`] being allocated.
    inc: u64,
}

in order to yield this:

impl arrow2_convert::field::ArrowField for Tuid {
    type Type = Self;

    fn data_type() -> arrow2::datatypes::DataType {
        let datatype = arrow2::datatypes::DataType::Struct(<[_]>::into_vec(Box::new([
            <u64 as arrow2_convert::field::ArrowField>::field("time_ns"),
            <u64 as arrow2_convert::field::ArrowField>::field("inc"),
        ])));
        DataType::Extension("rerun.tuid".into(), Box::new(datatype), None)
    }
}

Similarly, the Component trait should always generate extension types, automatically injecting the component name into the ArrowField definition (related to #1696).

This is not just about dev experience, this opens many doors in terms of data inspection.

@teh-cmc
Copy link
Member Author

teh-cmc commented Oct 9, 2023

Closing: we're moving away from arrow2-convert.

@teh-cmc teh-cmc closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏹 arrow concerning arrow
Projects
None yet
Development

No branches or pull requests

1 participant