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

Implement series_key in a more efficient way #25606

Open
mgattozzi opened this issue Dec 2, 2024 · 0 comments
Open

Implement series_key in a more efficient way #25606

mgattozzi opened this issue Dec 2, 2024 · 0 comments

Comments

@mgattozzi
Copy link
Contributor

As part of #25596 I changed the series_key method to look like this

pub fn series_key(&self) -> Vec<String> {
self.series_key
.iter()
.map(|k| self.column_id_to_name_unchecked(k).to_string())
.collect()
}

This isn't the most efficient as we're changing an Arc<str> into an owned String and creating a Vec. However, the comparison where it's used in is comparing against a Vec<&str>. We can't use the lookup method on the ColumnId to get an Arc<str> and turn it into an &str without facing issues with the type system. We also can't return a slice easily either.

Our best bet is to cache the names of the columns as a Vec<String> in the TableDefinition and to return an &[&str] instead of a Vec<String>. Since this is a bit invasive I've split this off into a separate ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant