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

prepare for ip field #1554

Merged
merged 1 commit into from
Sep 26, 2022
Merged

prepare for ip field #1554

merged 1 commit into from
Sep 26, 2022

Conversation

PSeitz
Copy link
Contributor

@PSeitz PSeitz commented Sep 26, 2022

No description provided.

@@ -31,36 +31,39 @@ impl BytesFastFieldReader {
Ok(BytesFastFieldReader { idx_reader, values })
}

fn range(&self, doc: DocId) -> (usize, usize) {
fn range(&self, doc: DocId) -> std::ops::Range<u64> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
fn range(&self, doc: DocId) -> std::ops::Range<u64> {
fn range(&self, doc: DocId) -> Range<usize> {

Copy link
Contributor Author

@PSeitz PSeitz Sep 26, 2022

Choose a reason for hiding this comment

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

Why usize? Multivalue ff values can be u64

Copy link
Collaborator

Choose a reason for hiding this comment

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

The index you mean? They are consumed as usize and it is a private method here.

(Actually I think we should make all column indexes u32 but that's another discussion.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

for this PR you don't have to take the suggestions if you judge better as it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The method is also used in the trait, which is u64. I also think we can change that, 4GB should be enough for a segment. For the time being I would be explicit with the type.

let (start, stop) = self.range(doc);
&self.values.as_slice()[start..stop]
let range = self.range(doc);
&self.values.as_slice()[range.start as usize..range.end as usize]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
&self.values.as_slice()[range.start as usize..range.end as usize]
&self.values.as_slice()[range]

let start = self.idx_reader.get_val(idx) as usize;
let stop = self.idx_reader.get_val(idx + 1) as usize;
(start, stop)
let start = self.idx_reader.get_val(idx);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let start = self.idx_reader.get_val(idx);
let start = self.idx_reader.get_val(idx) as usize;

stop - start
pub fn num_bytes(&self, doc: DocId) -> u64 {
let range = self.range(doc);
range.end - range.start
Copy link
Collaborator

@fulmicoton fulmicoton Sep 26, 2022

Choose a reason for hiding this comment

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

Suggested change
range.end - range.start
range.len() as u64

Copy link
Collaborator

Choose a reason for hiding this comment

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

You might need to use std::iter::ExactSizeIterator for that one.

@PSeitz PSeitz merged commit 10f10a3 into main Sep 26, 2022
@PSeitz PSeitz deleted the prepare_ip_field branch September 26, 2022 08:34
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