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

upgrade to datafusion 8.0.0 #5

Merged
merged 2 commits into from
Jul 8, 2022
Merged

upgrade to datafusion 8.0.0 #5

merged 2 commits into from
Jul 8, 2022

Conversation

jychen7
Copy link
Member

@jychen7 jychen7 commented Jun 26, 2022

close #4

Problem

there is a breaking change of datafusion v8

  1. ExecutionPlan.execute switch from async to sync

also original implementation "should not" call bigtable.read_rows during plan phase execute. It should deferred to the return stream

Solution

split original async method execute to execute_query and use futures::stream::once and RecordBatchStreamAdapter to wrap it in plan phase execute

let stream = futures::stream::once(
    execute_query(self.clone()).map_err(|e| ArrowError::ExternalError(Box::new(e)))
).try_flatten();

let schema = self.schema();
Ok(Box::pin(RecordBatchStreamAdapter::new(schema, stream)))

To reviewers

please review by commits. Datafusion 8 requires some change on ExecutionPlan, thus I split it to another file first

@jychen7 jychen7 changed the title upgrade to datafusion v8 upgrade to datafusion 8.0.0 Jun 26, 2022
src/datasource.rs Outdated Show resolved Hide resolved
src/datasource.rs Outdated Show resolved Hide resolved
@@ -293,3 +157,158 @@ impl ExecutionPlan for BigtableExec {
}
}

async fn execute_query(
Copy link
Member Author

@jychen7 jychen7 Jun 26, 2022

Choose a reason for hiding this comment

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

same as original async fn execute, separate because execute in the trait is defined as sync now

execute_query(self.clone()).map_err(|e| ArrowError::ExternalError(Box::new(e)))
).try_flatten();
let schema = self.schema();
Ok(Box::pin(RecordBatchStreamAdapter::new(schema, stream)))
Copy link
Member Author

Choose a reason for hiding this comment

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

this is the key to delay async execute_query to stream

@jychen7 jychen7 marked this pull request as ready for review June 26, 2022 20:12
@jychen7 jychen7 merged commit f099810 into master Jul 8, 2022
@jychen7 jychen7 deleted the datafusion-8 branch July 8, 2022 18:30
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.

Update DataFusion dependency to 8.0.0
1 participant