-
Notifications
You must be signed in to change notification settings - Fork 873
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
Faster GenericByteView
construction
#6102
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,9 +263,10 @@ where | |
InMemoryPageIterator::new(pages) | ||
} | ||
|
||
fn build_plain_encoded_byte_array_page_iterator( | ||
fn build_plain_encoded_byte_array_page_iterator_inner( | ||
column_desc: ColumnDescPtr, | ||
null_density: f32, | ||
short_string: bool, | ||
) -> impl PageIterator + Clone { | ||
let max_def_level = column_desc.max_def_level(); | ||
let max_rep_level = column_desc.max_rep_level(); | ||
|
@@ -285,7 +286,11 @@ fn build_plain_encoded_byte_array_page_iterator( | |
max_def_level | ||
}; | ||
if def_level == max_def_level { | ||
let string_value = format!("Test value {k}, row group: {i}, page: {j}"); | ||
let string_value = if short_string { | ||
format!("{k}{i}{j}") | ||
} else { | ||
format!("Test value {k}, row group: {i}, page: {j}") | ||
}; | ||
values.push(parquet::data_type::ByteArray::from(string_value.as_str())); | ||
} | ||
def_levels.push(def_level); | ||
|
@@ -303,6 +308,13 @@ fn build_plain_encoded_byte_array_page_iterator( | |
InMemoryPageIterator::new(pages) | ||
} | ||
|
||
fn build_plain_encoded_byte_array_page_iterator( | ||
column_desc: ColumnDescPtr, | ||
null_density: f32, | ||
) -> impl PageIterator + Clone { | ||
build_plain_encoded_byte_array_page_iterator_inner(column_desc, null_density, false) | ||
} | ||
|
||
fn build_dictionary_encoded_string_page_iterator( | ||
column_desc: ColumnDescPtr, | ||
null_density: f32, | ||
|
@@ -1066,6 +1078,27 @@ fn add_benches(c: &mut Criterion) { | |
|
||
let mut group = c.benchmark_group("arrow_array_reader/BinaryViewArray"); | ||
|
||
// binary view, plain encoded, no NULLs, short string | ||
let plain_byte_array_no_null_data = build_plain_encoded_byte_array_page_iterator_inner( | ||
mandatory_binary_column_desc.clone(), | ||
0.0, | ||
true, | ||
); | ||
|
||
// Short strings should not be slower than long strings, however, as discussed in https://github.com/apache/arrow-rs/issues/6034, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment seems out of date. Doesn't this PR close #6034 ? |
||
// the current implementation is more than 2x slower. | ||
// This benchmark tracks the performance of short strings so that we can optimize it. | ||
group.bench_function("plain encoded, mandatory, no NULLs, short string", |b| { | ||
b.iter(|| { | ||
let array_reader = create_byte_view_array_reader( | ||
plain_byte_array_no_null_data.clone(), | ||
mandatory_binary_column_desc.clone(), | ||
); | ||
count = bench_array_reader(array_reader); | ||
}); | ||
assert_eq!(count, EXPECTED_VALUE_COUNT); | ||
}); | ||
|
||
// binary view, plain encoded, no NULLs | ||
let plain_byte_array_no_null_data = | ||
build_plain_encoded_byte_array_page_iterator(mandatory_binary_column_desc.clone(), 0.0); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️