File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
rust/cubesql/cubesql/src/compile Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,22 @@ pub trait QueryEngine {
174
174
)
175
175
. map_err ( |e| CompilationError :: internal ( e. to_string ( ) ) ) ?;
176
176
177
+ let rewriting_start = SystemTime :: now ( ) ;
178
+ if let Some ( span_id) = span_id. as_ref ( ) {
179
+ if let Some ( auth_context) = state. auth_context ( ) {
180
+ self . transport_ref ( )
181
+ . log_load_state (
182
+ Some ( span_id. clone ( ) ) ,
183
+ auth_context,
184
+ state. get_load_request_meta ( "sql" ) ,
185
+ "SQL API Plan Rewrite" . to_string ( ) ,
186
+ serde_json:: json!( { } ) ,
187
+ )
188
+ . await
189
+ . map_err ( |e| CompilationError :: internal ( e. to_string ( ) ) ) ?;
190
+ }
191
+ }
192
+
177
193
let mut finalized_graph = self
178
194
. compiler_cache_ref ( )
179
195
. rewrite (
@@ -267,6 +283,23 @@ pub trait QueryEngine {
267
283
268
284
let rewrite_plan = result?;
269
285
286
+ if let Some ( span_id) = span_id. as_ref ( ) {
287
+ if let Some ( auth_context) = state. auth_context ( ) {
288
+ self . transport_ref ( )
289
+ . log_load_state (
290
+ Some ( span_id. clone ( ) ) ,
291
+ auth_context,
292
+ state. get_load_request_meta ( "sql" ) ,
293
+ "SQL API Plan Rewrite Success" . to_string ( ) ,
294
+ serde_json:: json!( {
295
+ "duration" : rewriting_start. elapsed( ) . unwrap( ) . as_millis( ) as u64 ,
296
+ } ) ,
297
+ )
298
+ . await
299
+ . map_err ( |e| CompilationError :: internal ( e. to_string ( ) ) ) ?;
300
+ }
301
+ }
302
+
270
303
// DF optimizes logical plan (second time) on physical plan creation
271
304
// It's not safety to use all optimizers from DF for OLAP queries, because it will lead to errors
272
305
// From another side, 99% optimizers cannot optimize anything
You can’t perform that action at this time.
0 commit comments