DDtKey commented on code in PR #5197:
URL: https://github.com/apache/arrow-datafusion/pull/5197#discussion_r1097864800
##########
datafusion/core/src/datasource/memory.rs:
##########
@@ -76,20 +77,26 @@ impl MemTable {
.map(|part_i| {
let task = state.task_ctx();
let exec = exec.clone();
- tokio::spawn(async move {
+ let task = tokio::spawn(async move {
let stream = exec.execute(part_i, task)?;
common::collect(stream).await
- })
+ });
+
+ AbortOnDropSingle::new(task)
})
// this collect *is needed* so that the join below can
// switch between tasks
.collect::<Vec<_>>();
let mut data: Vec<Vec<RecordBatch>> =
Vec::with_capacity(exec.output_partitioning().partition_count());
- for task in tasks {
- let result = task.await.expect("MemTable::load could not join
task")?;
- data.push(result);
+
+ for result in futures::future::join_all(tasks).await {
+ data.push(result.map_err(|_| {
+ DataFusionError::Internal(
+ "MemTable::load could not join task".to_string(),
+ )
Review Comment:
`Context` requires `DataFusionError`, so it's anyway should be wrapped to
something 🤔
Could be `data.push(result.map_err(|e|
DataFusionError::External(Box::new(e)))??)`, WDYT?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]