-
Notifications
You must be signed in to change notification settings - Fork 147
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
[FEAT] Streaming Local Parquet Reads #2592
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
be7bf82
local files
2058d58
comments + cleanup
f41f331
in order
4bc61af
remove dep
a3ea37d
move out of micropartition
9fc97f0
cleanup
8726ac8
add try take while
642093d
remove comment
618fd7c
use crossbeam + some nits
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -296,8 +296,7 @@ pub async fn stream_json( | |
io_client: Arc<IOClient>, | ||
io_stats: Option<IOStatsRef>, | ||
max_chunks_in_flight: Option<usize>, | ||
) -> DaftResult<BoxStream<'static, DaftResult<Vec<Table>>>> { | ||
// BoxStream:: | ||
) -> DaftResult<BoxStream<'static, DaftResult<Table>>> { | ||
let predicate = convert_options | ||
.as_ref() | ||
.and_then(|opts| opts.predicate.clone()); | ||
|
@@ -349,7 +348,8 @@ pub async fn stream_json( | |
// Limit the number of chunks we have in flight at any given time. | ||
.try_buffered(max_chunks_in_flight); | ||
|
||
let filtered_tables = tables.map_ok(move |table| { | ||
let filtered_tables = tables.map(move |table| { | ||
let table = table?; | ||
if let Some(predicate) = &predicate { | ||
let filtered = table?.filter(&[predicate.clone()])?; | ||
if let Some(include_columns) = &include_columns { | ||
|
@@ -363,28 +363,19 @@ pub async fn stream_json( | |
}); | ||
|
||
let mut remaining_rows = limit.map(|limit| limit as i64); | ||
let tables = filtered_tables | ||
.try_take_while(move |result| { | ||
match (result, remaining_rows) { | ||
// Limit has been met, early-terminate. | ||
(_, Some(rows_left)) if rows_left <= 0 => futures::future::ready(Ok(false)), | ||
// Limit has not yet been met, update remaining limit slack and continue. | ||
(Ok(table), Some(rows_left)) => { | ||
remaining_rows = Some(rows_left - table.len() as i64); | ||
futures::future::ready(Ok(true)) | ||
} | ||
// (1) No limit, never early-terminate. | ||
// (2) Encountered error, propagate error to try_collect to allow it to short-circuit. | ||
(_, None) | (Err(_), _) => futures::future::ready(Ok(true)), | ||
let tables = filtered_tables.try_take_while(move |table| { | ||
match remaining_rows { | ||
// Limit has been met, early-terminate. | ||
Some(rows_left) if rows_left <= 0 => futures::future::ready(Ok(false)), | ||
// Limit has not yet been met, update remaining limit slack and continue. | ||
Some(rows_left) => { | ||
remaining_rows = Some(rows_left - table.len() as i64); | ||
futures::future::ready(Ok(true)) | ||
} | ||
}) | ||
.map(|r| match r { | ||
Ok(table) => table, | ||
Err(e) => Err(e.into()), | ||
}) | ||
// Chunk the tables into chunks of size max_chunks_in_flight. | ||
.try_ready_chunks(max_chunks_in_flight) | ||
.map_err(|e| DaftError::ComputeError(e.to_string())); | ||
// No limit, never early-terminate. | ||
None => futures::future::ready(Ok(true)), | ||
} | ||
}); | ||
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. Just cleaning up some of the streaming json code |
||
Ok(Box::pin(tables)) | ||
} | ||
|
||
|
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
Oops, something went wrong.
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.
Just cleaning up some of the streaming CSV code