You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "discivigour (via GitHub)" <gi...@apache.org> on 2026/04/09 02:25:55 UTC
[PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
discivigour opened a new pull request, #230:
URL: https://github.com/apache/paimon-rust/pull/230
<!--
Thank you very much for contributing to Paimon Rust - we are happy that you want to help us improve it. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.
## Contribution Checklist
- Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/paimon-rust/issues). Exceptions are made for typos in documentation or comments, which need no issue.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Make sure that the change passes the automated tests, i.e., `cargo test` passes.
- Each pull request should address only one issue, not mix up code from multiple issues.
**(The sections below can be removed for hotfixes or typos)**
-->
### Purpose
- introduce coalesce read
- introduce metadata prefetch
### Brief change log
<!-- Please describe the changes made in this pull request and explain how they address the issue -->
### Tests
<!-- List unit tests or integration cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature or require documentation updates -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #230:
URL: https://github.com/apache/paimon-rust/pull/230#discussion_r3061692741
##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -825,6 +950,84 @@ impl AsyncFileReader for ArrowFileReader {
}
}
+// ---------------------------------------------------------------------------
+// Range coalescing
+// ---------------------------------------------------------------------------
+
+/// Merge nearby byte ranges to reduce the number of requests.
+///
+/// Ranges whose gap is ≤ `coalesce` bytes are merged into a single range.
+/// The input does not need to be sorted.
+fn merge_byte_ranges(ranges: &[Range<u64>], coalesce: u64) -> Vec<Range<u64>> {
+ if ranges.is_empty() {
+ return vec![];
+ }
+
+ let mut sorted = ranges.to_vec();
+ sorted.sort_unstable_by_key(|r| r.start);
+
+ let mut merged = Vec::with_capacity(sorted.len());
+ let mut start_idx = 0;
+ let mut end_idx = 1;
+
+ while start_idx != sorted.len() {
+ let mut range_end = sorted[start_idx].end;
+
+ while end_idx != sorted.len()
+ && sorted[end_idx]
+ .start
+ .checked_sub(range_end)
+ .map(|delta| delta <= coalesce)
+ .unwrap_or(true)
+ {
+ range_end = range_end.max(sorted[end_idx].end);
+ end_idx += 1;
+ }
+
+ merged.push(sorted[start_idx].start..range_end);
+ start_idx = end_idx;
+ end_idx += 1;
+ }
+
+ merged
+}
+
+/// Split merged ranges into fixed-size batches to utilize concurrency,
+/// Each merged range is divided into chunks of `expected_size`,
+/// with the last chunk taking whatever remains.
+/// Ranges smaller than `2 * MIN_SPLIT_SIZE` are kept as-is to
+/// avoid excessive small IO requests.
+fn split_ranges_for_concurrency(merged: Vec<Range<u64>>, target_count: usize) -> Vec<Range<u64>> {
Review Comment:
target_count => concurrency
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "discivigour (via GitHub)" <gi...@apache.org>.
discivigour commented on code in PR #230:
URL: https://github.com/apache/paimon-rust/pull/230#discussion_r3055899538
##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -809,14 +831,73 @@ impl AsyncFileReader for ArrowFileReader {
self.read_bytes(range)
}
+ fn get_byte_ranges(
+ &mut self,
+ ranges: Vec<Range<u64>>,
+ ) -> BoxFuture<'_, parquet::errors::Result<Vec<Bytes>>> {
+ let coalesce_bytes = self.range_coalesce_bytes;
+ let concurrency = self.range_fetch_concurrency.max(1);
+
+ async move {
+ if ranges.is_empty() {
+ return Ok(vec![]);
+ }
+
+ // Two-phase range optimization:
+ // Phase 1: Merge nearby ranges based on coalesce threshold.
+ let coalesced = merge_byte_ranges(&ranges, coalesce_bytes);
+ // Phase 2: Split large merged ranges to utilize concurrency,
+ // but only at original range boundaries.
+ let fetch_ranges = split_ranges_for_concurrency(coalesced, &ranges, concurrency);
+
+ // Fetch merged ranges concurrently.
+ let r = &self.r;
+ let fetched: Vec<Bytes> = if fetch_ranges.len() <= concurrency {
+ // All ranges fit within the concurrency limit — fire them all at once.
+ futures::future::try_join_all(fetch_ranges.iter().map(|range| {
+ r.read(range.clone())
+ .map_err(|e| parquet::errors::ParquetError::External(format!("{e}").into()))
+ }))
+ .await?
+ } else {
+ // More ranges than concurrency slots — use buffered stream.
+ futures::stream::iter(fetch_ranges.iter().cloned())
+ .map(|range| async move {
+ r.read(range).await.map_err(|e| {
+ parquet::errors::ParquetError::External(format!("{e}").into())
+ })
+ })
+ .buffered(concurrency)
+ .try_collect()
+ .await?
+ };
+
+ // Slice the fetched data back into the originally requested ranges.
+ Ok(ranges
+ .iter()
+ .map(|range| {
+ let idx = fetch_ranges.partition_point(|v| v.start <= range.start) - 1;
+ let fetch_range = &fetch_ranges[idx];
+ let fetch_bytes = &fetched[idx];
+ let start = (range.start - fetch_range.start) as usize;
+ let end = (range.end - fetch_range.start) as usize;
+ fetch_bytes.slice(start..end.min(fetch_bytes.len()))
Review Comment:
Good point, I will change it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "discivigour (via GitHub)" <gi...@apache.org>.
discivigour commented on code in PR #230:
URL: https://github.com/apache/paimon-rust/pull/230#discussion_r3055900697
##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -809,14 +831,73 @@ impl AsyncFileReader for ArrowFileReader {
self.read_bytes(range)
}
+ fn get_byte_ranges(
+ &mut self,
+ ranges: Vec<Range<u64>>,
+ ) -> BoxFuture<'_, parquet::errors::Result<Vec<Bytes>>> {
+ let coalesce_bytes = self.range_coalesce_bytes;
+ let concurrency = self.range_fetch_concurrency.max(1);
+
+ async move {
+ if ranges.is_empty() {
+ return Ok(vec![]);
+ }
+
+ // Two-phase range optimization:
+ // Phase 1: Merge nearby ranges based on coalesce threshold.
+ let coalesced = merge_byte_ranges(&ranges, coalesce_bytes);
+ // Phase 2: Split large merged ranges to utilize concurrency,
+ // but only at original range boundaries.
+ let fetch_ranges = split_ranges_for_concurrency(coalesced, &ranges, concurrency);
+
+ // Fetch merged ranges concurrently.
+ let r = &self.r;
+ let fetched: Vec<Bytes> = if fetch_ranges.len() <= concurrency {
+ // All ranges fit within the concurrency limit — fire them all at once.
+ futures::future::try_join_all(fetch_ranges.iter().map(|range| {
+ r.read(range.clone())
+ .map_err(|e| parquet::errors::ParquetError::External(format!("{e}").into()))
+ }))
+ .await?
+ } else {
+ // More ranges than concurrency slots — use buffered stream.
+ futures::stream::iter(fetch_ranges.iter().cloned())
+ .map(|range| async move {
+ r.read(range).await.map_err(|e| {
+ parquet::errors::ParquetError::External(format!("{e}").into())
+ })
+ })
+ .buffered(concurrency)
+ .try_collect()
+ .await?
+ };
+
+ // Slice the fetched data back into the originally requested ranges.
+ Ok(ranges
+ .iter()
+ .map(|range| {
+ let idx = fetch_ranges.partition_point(|v| v.start <= range.start) - 1;
Review Comment:
Good point.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "discivigour (via GitHub)" <gi...@apache.org>.
discivigour commented on code in PR #230:
URL: https://github.com/apache/paimon-rust/pull/230#discussion_r3055905344
##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -783,11 +783,33 @@ fn build_row_ranges_selection(
struct ArrowFileReader {
file_size: u64,
r: Box<dyn FileRead>,
+ /// Maximum gap (in bytes) between two ranges that will be merged into a
+ /// single fetch request. Defaults to 1 MiB.
+ range_coalesce_bytes: u64,
+ /// Maximum number of merged ranges to fetch concurrently. Defaults to 8.
+ range_fetch_concurrency: usize,
+ /// Hint for the number of bytes to speculatively read from the end of the
+ /// file when loading Parquet metadata. A sufficiently large hint reduces
+ /// footer loading from 2 round-trips to 1. Defaults to 512 KiB.
+ metadata_size_hint: Option<usize>,
}
+/// Default coalesce threshold: 1 MiB.
+const DEFAULT_RANGE_COALESCE_BYTES: u64 = 1024 * 1024;
+/// Default concurrent range fetches.
+const DEFAULT_RANGE_FETCH_CONCURRENCY: usize = 8;
Review Comment:
changed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #230:
URL: https://github.com/apache/paimon-rust/pull/230#discussion_r3055643843
##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -809,14 +831,73 @@ impl AsyncFileReader for ArrowFileReader {
self.read_bytes(range)
}
+ fn get_byte_ranges(
+ &mut self,
+ ranges: Vec<Range<u64>>,
+ ) -> BoxFuture<'_, parquet::errors::Result<Vec<Bytes>>> {
+ let coalesce_bytes = self.range_coalesce_bytes;
+ let concurrency = self.range_fetch_concurrency.max(1);
+
+ async move {
+ if ranges.is_empty() {
+ return Ok(vec![]);
+ }
+
+ // Two-phase range optimization:
+ // Phase 1: Merge nearby ranges based on coalesce threshold.
+ let coalesced = merge_byte_ranges(&ranges, coalesce_bytes);
+ // Phase 2: Split large merged ranges to utilize concurrency,
+ // but only at original range boundaries.
+ let fetch_ranges = split_ranges_for_concurrency(coalesced, &ranges, concurrency);
+
+ // Fetch merged ranges concurrently.
+ let r = &self.r;
+ let fetched: Vec<Bytes> = if fetch_ranges.len() <= concurrency {
+ // All ranges fit within the concurrency limit — fire them all at once.
+ futures::future::try_join_all(fetch_ranges.iter().map(|range| {
+ r.read(range.clone())
+ .map_err(|e| parquet::errors::ParquetError::External(format!("{e}").into()))
+ }))
+ .await?
+ } else {
+ // More ranges than concurrency slots — use buffered stream.
+ futures::stream::iter(fetch_ranges.iter().cloned())
+ .map(|range| async move {
+ r.read(range).await.map_err(|e| {
+ parquet::errors::ParquetError::External(format!("{e}").into())
+ })
+ })
+ .buffered(concurrency)
+ .try_collect()
+ .await?
+ };
+
+ // Slice the fetched data back into the originally requested ranges.
+ Ok(ranges
+ .iter()
+ .map(|range| {
+ let idx = fetch_ranges.partition_point(|v| v.start <= range.start) - 1;
+ let fetch_range = &fetch_ranges[idx];
+ let fetch_bytes = &fetched[idx];
+ let start = (range.start - fetch_range.start) as usize;
+ let end = (range.end - fetch_range.start) as usize;
+ fetch_bytes.slice(start..end.min(fetch_bytes.len()))
Review Comment:
If the data returned by fetch is not long enough, truncated data will be silently returned here, and downstream may obtain incomplete column chunks, leading to parsing errors or data corruption. Suggest changing it to assert or returning an error, do not silently swallow it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #230:
URL: https://github.com/apache/paimon-rust/pull/230#discussion_r3061706626
##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -825,6 +950,84 @@ impl AsyncFileReader for ArrowFileReader {
}
}
+// ---------------------------------------------------------------------------
+// Range coalescing
+// ---------------------------------------------------------------------------
+
+/// Merge nearby byte ranges to reduce the number of requests.
+///
+/// Ranges whose gap is ≤ `coalesce` bytes are merged into a single range.
+/// The input does not need to be sorted.
+fn merge_byte_ranges(ranges: &[Range<u64>], coalesce: u64) -> Vec<Range<u64>> {
+ if ranges.is_empty() {
+ return vec![];
+ }
+
+ let mut sorted = ranges.to_vec();
+ sorted.sort_unstable_by_key(|r| r.start);
+
+ let mut merged = Vec::with_capacity(sorted.len());
+ let mut start_idx = 0;
+ let mut end_idx = 1;
+
+ while start_idx != sorted.len() {
+ let mut range_end = sorted[start_idx].end;
+
+ while end_idx != sorted.len()
+ && sorted[end_idx]
+ .start
+ .checked_sub(range_end)
+ .map(|delta| delta <= coalesce)
+ .unwrap_or(true)
+ {
+ range_end = range_end.max(sorted[end_idx].end);
+ end_idx += 1;
+ }
+
+ merged.push(sorted[start_idx].start..range_end);
+ start_idx = end_idx;
+ end_idx += 1;
+ }
+
+ merged
+}
+
+/// Split merged ranges into fixed-size batches to utilize concurrency,
+/// Each merged range is divided into chunks of `expected_size`,
+/// with the last chunk taking whatever remains.
+/// Ranges smaller than `2 * MIN_SPLIT_SIZE` are kept as-is to
+/// avoid excessive small IO requests.
+fn split_ranges_for_concurrency(merged: Vec<Range<u64>>, target_count: usize) -> Vec<Range<u64>> {
+ if merged.is_empty() || target_count <= 1 {
+ return merged;
+ }
+
+ let mut result = Vec::with_capacity(merged.len());
+
+ for range in &merged {
+ let length = range.end - range.start;
+ let expected_size = MIN_SPLIT_SIZE.max(length / target_count as u64 + 1);
Review Comment:
MIN_SPLIT_SIZE.max(length.div_ceil(target_count as u64)) ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #230:
URL: https://github.com/apache/paimon-rust/pull/230#discussion_r3061692132
##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -825,6 +950,84 @@ impl AsyncFileReader for ArrowFileReader {
}
}
+// ---------------------------------------------------------------------------
+// Range coalescing
+// ---------------------------------------------------------------------------
+
+/// Merge nearby byte ranges to reduce the number of requests.
+///
+/// Ranges whose gap is ≤ `coalesce` bytes are merged into a single range.
+/// The input does not need to be sorted.
+fn merge_byte_ranges(ranges: &[Range<u64>], coalesce: u64) -> Vec<Range<u64>> {
+ if ranges.is_empty() {
+ return vec![];
+ }
+
+ let mut sorted = ranges.to_vec();
+ sorted.sort_unstable_by_key(|r| r.start);
+
+ let mut merged = Vec::with_capacity(sorted.len());
+ let mut start_idx = 0;
+ let mut end_idx = 1;
+
+ while start_idx != sorted.len() {
+ let mut range_end = sorted[start_idx].end;
+
+ while end_idx != sorted.len()
+ && sorted[end_idx]
+ .start
+ .checked_sub(range_end)
+ .map(|delta| delta <= coalesce)
+ .unwrap_or(true)
+ {
+ range_end = range_end.max(sorted[end_idx].end);
+ end_idx += 1;
+ }
+
+ merged.push(sorted[start_idx].start..range_end);
+ start_idx = end_idx;
+ end_idx += 1;
+ }
+
+ merged
+}
+
+/// Split merged ranges into fixed-size batches to utilize concurrency,
+/// Each merged range is divided into chunks of `expected_size`,
+/// with the last chunk taking whatever remains.
+/// Ranges smaller than `2 * MIN_SPLIT_SIZE` are kept as-is to
+/// avoid excessive small IO requests.
+fn split_ranges_for_concurrency(merged: Vec<Range<u64>>, target_count: usize) -> Vec<Range<u64>> {
+ if merged.is_empty() || target_count <= 1 {
+ return merged;
+ }
+
+ let mut result = Vec::with_capacity(merged.len());
+
+ for range in &merged {
+ let length = range.end - range.start;
+ let expected_size = MIN_SPLIT_SIZE.max(length / target_count as u64 + 1);
+ let min_remain = expected_size.max(MIN_SPLIT_SIZE * 2);
Review Comment:
min_tail_size
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "discivigour (via GitHub)" <gi...@apache.org>.
discivigour commented on code in PR #230:
URL: https://github.com/apache/paimon-rust/pull/230#discussion_r3063122430
##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -825,6 +950,84 @@ impl AsyncFileReader for ArrowFileReader {
}
}
+// ---------------------------------------------------------------------------
+// Range coalescing
+// ---------------------------------------------------------------------------
+
+/// Merge nearby byte ranges to reduce the number of requests.
+///
+/// Ranges whose gap is ≤ `coalesce` bytes are merged into a single range.
+/// The input does not need to be sorted.
+fn merge_byte_ranges(ranges: &[Range<u64>], coalesce: u64) -> Vec<Range<u64>> {
+ if ranges.is_empty() {
+ return vec![];
+ }
+
+ let mut sorted = ranges.to_vec();
+ sorted.sort_unstable_by_key(|r| r.start);
+
+ let mut merged = Vec::with_capacity(sorted.len());
+ let mut start_idx = 0;
+ let mut end_idx = 1;
+
+ while start_idx != sorted.len() {
+ let mut range_end = sorted[start_idx].end;
+
+ while end_idx != sorted.len()
+ && sorted[end_idx]
+ .start
+ .checked_sub(range_end)
+ .map(|delta| delta <= coalesce)
+ .unwrap_or(true)
+ {
+ range_end = range_end.max(sorted[end_idx].end);
+ end_idx += 1;
+ }
+
+ merged.push(sorted[start_idx].start..range_end);
+ start_idx = end_idx;
+ end_idx += 1;
+ }
+
+ merged
+}
+
+/// Split merged ranges into fixed-size batches to utilize concurrency,
+/// Each merged range is divided into chunks of `expected_size`,
+/// with the last chunk taking whatever remains.
+/// Ranges smaller than `2 * MIN_SPLIT_SIZE` are kept as-is to
+/// avoid excessive small IO requests.
+fn split_ranges_for_concurrency(merged: Vec<Range<u64>>, target_count: usize) -> Vec<Range<u64>> {
+ if merged.is_empty() || target_count <= 1 {
+ return merged;
+ }
+
+ let mut result = Vec::with_capacity(merged.len());
+
+ for range in &merged {
+ let length = range.end - range.start;
+ let expected_size = MIN_SPLIT_SIZE.max(length / target_count as u64 + 1);
Review Comment:
All changed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #230:
URL: https://github.com/apache/paimon-rust/pull/230#discussion_r3055645783
##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -809,14 +831,73 @@ impl AsyncFileReader for ArrowFileReader {
self.read_bytes(range)
}
+ fn get_byte_ranges(
+ &mut self,
+ ranges: Vec<Range<u64>>,
+ ) -> BoxFuture<'_, parquet::errors::Result<Vec<Bytes>>> {
+ let coalesce_bytes = self.range_coalesce_bytes;
+ let concurrency = self.range_fetch_concurrency.max(1);
+
+ async move {
+ if ranges.is_empty() {
+ return Ok(vec![]);
+ }
+
+ // Two-phase range optimization:
+ // Phase 1: Merge nearby ranges based on coalesce threshold.
+ let coalesced = merge_byte_ranges(&ranges, coalesce_bytes);
+ // Phase 2: Split large merged ranges to utilize concurrency,
+ // but only at original range boundaries.
+ let fetch_ranges = split_ranges_for_concurrency(coalesced, &ranges, concurrency);
+
+ // Fetch merged ranges concurrently.
+ let r = &self.r;
+ let fetched: Vec<Bytes> = if fetch_ranges.len() <= concurrency {
+ // All ranges fit within the concurrency limit — fire them all at once.
+ futures::future::try_join_all(fetch_ranges.iter().map(|range| {
+ r.read(range.clone())
+ .map_err(|e| parquet::errors::ParquetError::External(format!("{e}").into()))
+ }))
+ .await?
+ } else {
+ // More ranges than concurrency slots — use buffered stream.
+ futures::stream::iter(fetch_ranges.iter().cloned())
+ .map(|range| async move {
+ r.read(range).await.map_err(|e| {
+ parquet::errors::ParquetError::External(format!("{e}").into())
+ })
+ })
+ .buffered(concurrency)
+ .try_collect()
+ .await?
+ };
+
+ // Slice the fetched data back into the originally requested ranges.
+ Ok(ranges
+ .iter()
+ .map(|range| {
+ let idx = fetch_ranges.partition_point(|v| v.start <= range.start) - 1;
Review Comment:
If partition_point returns 0, 0-1 overflow panic will occur here. Although logically fetch_range must cover all original ranges, this is an implicit assumption. It is recommended to add a debug_assert! Or use checked_stub+more explicit error messages
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #230:
URL: https://github.com/apache/paimon-rust/pull/230#discussion_r3055657875
##########
crates/paimon/src/arrow/format/parquet.rs:
##########
@@ -783,11 +783,33 @@ fn build_row_ranges_selection(
struct ArrowFileReader {
file_size: u64,
r: Box<dyn FileRead>,
+ /// Maximum gap (in bytes) between two ranges that will be merged into a
+ /// single fetch request. Defaults to 1 MiB.
+ range_coalesce_bytes: u64,
+ /// Maximum number of merged ranges to fetch concurrently. Defaults to 8.
+ range_fetch_concurrency: usize,
+ /// Hint for the number of bytes to speculatively read from the end of the
+ /// file when loading Parquet metadata. A sufficiently large hint reduces
+ /// footer loading from 2 round-trips to 1. Defaults to 512 KiB.
+ metadata_size_hint: Option<usize>,
}
+/// Default coalesce threshold: 1 MiB.
+const DEFAULT_RANGE_COALESCE_BYTES: u64 = 1024 * 1024;
+/// Default concurrent range fetches.
+const DEFAULT_RANGE_FETCH_CONCURRENCY: usize = 8;
Review Comment:
Same to iceberg, maybe 10?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] perf(reader): Improve the performance of parquet reader [paimon-rust]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #230:
URL: https://github.com/apache/paimon-rust/pull/230
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org