Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions rust/cubesql/cubesql/src/compile/query_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,22 @@ pub trait QueryEngine {
)
.map_err(|e| CompilationError::internal(e.to_string()))?;

let rewriting_start = SystemTime::now();
if let Some(span_id) = span_id.as_ref() {
if let Some(auth_context) = state.auth_context() {
self.transport_ref()
.log_load_state(
Some(span_id.clone()),
auth_context,
state.get_load_request_meta("sql"),
"SQL API Plan Rewrite".to_string(),
serde_json::json!({}),
)
.await
.map_err(|e| CompilationError::internal(e.to_string()))?;
}
}

let mut finalized_graph = self
.compiler_cache_ref()
.rewrite(
Expand Down Expand Up @@ -267,6 +283,23 @@ pub trait QueryEngine {

let rewrite_plan = result?;

if let Some(span_id) = span_id.as_ref() {
if let Some(auth_context) = state.auth_context() {
self.transport_ref()
.log_load_state(
Some(span_id.clone()),
auth_context,
state.get_load_request_meta("sql"),
"SQL API Plan Rewrite Success".to_string(),
serde_json::json!({
"duration": rewriting_start.elapsed().unwrap().as_millis() as u64,
}),
)
.await
.map_err(|e| CompilationError::internal(e.to_string()))?;
}
}

// DF optimizes logical plan (second time) on physical plan creation
// It's not safety to use all optimizers from DF for OLAP queries, because it will lead to errors
// From another side, 99% optimizers cannot optimize anything
Expand Down
Loading