Skip to content

Row changes #1787

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

Merged
merged 3 commits into from
Feb 3, 2020
Merged

Row changes #1787

merged 3 commits into from
Feb 3, 2020

Conversation

frankmcsherry
Copy link
Contributor

Minor changes to Row intended to uncontroversially improve things.

/// Number of bytes required by the datum.
///
/// This is used to optimistically pre-allocate buffers for packing rows.
pub fn datum_size(datum: &Datum) -> usize {
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'm not very happy with where this is at the moment. Because the row mod is private it can't be repr::row::datum_size(), and repr::datum_size() doesn't communicate what it is about. It could be a Row::datum_size() method?

Copy link
Contributor

Choose a reason for hiding this comment

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

We could just make row public. As long as only the safe fns are public, should still be fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could also be Datum::packed_size

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to punt on this for the moment. @benesch indicates we might de-flatten repr at which point making it be a method in row would be great!

@frankmcsherry frankmcsherry changed the title WIP: Row changes Row changes Feb 3, 2020
pub struct Row {
data: Box<[u8]>,
}

/// These implementations order first by length, and then by slice contents.
/// This allows many comparisons to complete without dereferencing memory.
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 devious. I like it.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should do it for Eq/PartialEq too.

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 hoped they were, but maybe they aren't. As in, I hoped Rust would be bright enough to check length equality first and then go for the contents. I'll look into it.

Copy link
Contributor

@jamii jamii left a comment

Choose a reason for hiding this comment

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

Left a lot of little comments but the overall thrust is indeed uncontroversial :)

@frankmcsherry frankmcsherry merged commit 7644948 into MaterializeInc:master Feb 3, 2020
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

Successfully merging this pull request may close these issues.

2 participants