mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-24 17:00:37 +00:00
refactor: upgrade DataFusion, Arrow and Sqlparser (#1074)
* refactor: upgrade DataFusion, Arrow and Sqlparser * fix: resolve PR comments
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user