@@ -25,7 +25,6 @@ use chrono_tz::Tz;
25
25
use common_base:: base:: tokio:: task:: JoinHandle ;
26
26
use common_base:: base:: Progress ;
27
27
use common_base:: base:: ProgressValues ;
28
- use common_base:: base:: Runtime ;
29
28
use common_base:: base:: TrySpawn ;
30
29
use common_contexts:: DalContext ;
31
30
use common_contexts:: DalMetrics ;
@@ -69,7 +68,6 @@ pub struct QueryContext {
69
68
version : String ,
70
69
partition_queue : Arc < RwLock < VecDeque < PartInfoPtr > > > ,
71
70
shared : Arc < QueryContextShared > ,
72
- precommit_blocks : Arc < RwLock < Vec < DataBlock > > > ,
73
71
fragment_id : Arc < AtomicUsize > ,
74
72
}
75
73
@@ -85,7 +83,6 @@ impl QueryContext {
85
83
partition_queue : Arc :: new ( RwLock :: new ( VecDeque :: new ( ) ) ) ,
86
84
version : format ! ( "DatabendQuery {}" , * crate :: version:: DATABEND_COMMIT_VERSION ) ,
87
85
shared,
88
- precommit_blocks : Arc :: new ( RwLock :: new ( Vec :: new ( ) ) ) ,
89
86
fragment_id : Arc :: new ( AtomicUsize :: new ( 0 ) ) ,
90
87
} )
91
88
}
@@ -226,20 +223,6 @@ impl TableContext for QueryContext {
226
223
fn get_result_progress_value ( & self ) -> ProgressValues {
227
224
self . shared . result_progress . as_ref ( ) . get_values ( )
228
225
}
229
- // Steal n partitions from the partition pool by the pipeline worker.
230
- // This also can steal the partitions from distributed node.
231
- fn try_get_partitions ( & self , num : u64 ) -> Result < Partitions > {
232
- let mut partitions = vec ! [ ] ;
233
- for _ in 0 ..num {
234
- match self . partition_queue . write ( ) . pop_back ( ) {
235
- None => break ,
236
- Some ( partition) => {
237
- partitions. push ( partition) ;
238
- }
239
- }
240
- }
241
- Ok ( partitions)
242
- }
243
226
244
227
fn try_get_part ( & self ) -> Option < PartInfoPtr > {
245
228
self . partition_queue . write ( ) . pop_front ( )
@@ -334,15 +317,10 @@ impl TableContext for QueryContext {
334
317
self . shared . dal_ctx . as_ref ( )
335
318
}
336
319
fn push_precommit_block ( & self , block : DataBlock ) {
337
- let mut blocks = self . precommit_blocks . write ( ) ;
338
- blocks. push ( block) ;
320
+ self . shared . push_precommit_block ( block)
339
321
}
340
322
fn consume_precommit_blocks ( & self ) -> Vec < DataBlock > {
341
- let mut blocks = self . precommit_blocks . write ( ) ;
342
-
343
- let mut swaped_precommit_blocks = vec ! [ ] ;
344
- std:: mem:: swap ( & mut * blocks, & mut swaped_precommit_blocks) ;
345
- swaped_precommit_blocks
323
+ self . shared . consume_precommit_blocks ( )
346
324
}
347
325
fn try_get_function_context ( & self ) -> Result < FunctionContext > {
348
326
let tz = self . get_settings ( ) . get_timezone ( ) ?;
@@ -382,14 +360,6 @@ impl TableContext for QueryContext {
382
360
fn get_processes_info ( & self ) -> Vec < ProcessInfo > {
383
361
SessionManager :: instance ( ) . processes_info ( )
384
362
}
385
-
386
- fn get_runtime ( & self ) -> Result < Arc < Runtime > > {
387
- self . shared . try_get_runtime ( )
388
- }
389
-
390
- fn clone_inner ( & self ) -> Arc < dyn TableContext > {
391
- QueryContext :: create_from_shared ( self . shared . clone ( ) )
392
- }
393
363
}
394
364
395
365
impl TrySpawn for QueryContext {
0 commit comments