refactor: upgrade DataFusion, Arrow and Sqlparser (#1074)

* refactor: upgrade DataFusion, Arrow and Sqlparser

* fix: resolve PR comments
This commit is contained in:
LFC
2023-02-27 22:20:08 +08:00
committed by GitHub
parent 30287e7e41
commit 11d45e2918
115 changed files with 1368 additions and 1000 deletions

View File

@@ -376,14 +376,16 @@ impl PyQueryEngine {
let thread_handle = std::thread::spawn(move || -> std::result::Result<_, String> {
if let Some(engine) = query {
let stmt = QueryLanguageParser::parse_sql(s.as_str()).map_err(|e| e.to_string())?;
let plan = engine
.statement_to_plan(stmt, Default::default())
.map_err(|e| e.to_string())?;
// To prevent the error of nested creating Runtime, if is nested, use the parent runtime instead
let rt = tokio::runtime::Runtime::new().map_err(|e| e.to_string())?;
let handle = rt.handle().clone();
let res = handle.block_on(async {
let plan = engine
.statement_to_plan(stmt, Default::default())
.await
.map_err(|e| e.to_string())?;
let res = engine
.clone()
.execute(&plan)

View File

@@ -241,7 +241,8 @@ impl Script for PyScript {
);
let plan = self
.query_engine
.statement_to_plan(stmt, Arc::new(QueryContext::new()))?;
.statement_to_plan(stmt, Arc::new(QueryContext::new()))
.await?;
let res = self.query_engine.execute(&plan).await?;
let copr = self.copr.clone();
match res {

View File

@@ -126,6 +126,7 @@ impl ScriptsTable {
DEFAULT_SCHEMA_NAME,
SCRIPTS_TABLE_NAME,
)
.await
.context(FindScriptsTableSnafu)?
.context(ScriptsTableNotFoundSnafu)?;
@@ -160,6 +161,7 @@ impl ScriptsTable {
let plan = self
.query_engine
.statement_to_plan(stmt, Arc::new(QueryContext::new()))
.await
.unwrap();
let stream = match self