MCPcopy Create free account
hub / github.com/BlazingDB/blazingsql / run

Method run

engine/src/execution_kernels/BatchWindowFunctionProcessing.cpp:250–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250kstatus ComputeWindowKernel::run() {
251 CodeTimer timer;
252
253 int self_node_idx = context->getNodeIndex(ral::communication::CommunicationData::getInstance().getSelfNode());
254 int num_nodes = context->getTotalNodes();
255
256 bool is_first_batch = true;
257 bool is_last_batch = false;
258 bool is_first_node = self_node_idx == 0;
259 bool is_last_node = self_node_idx == num_nodes - 1;
260
261 std::unique_ptr<ral::cache::CacheData> cache_data = this->input_cache()->pullCacheData();
262
263 if (this->remove_overlap){
264 while (cache_data != nullptr ){
265 std::vector<std::unique_ptr <ral::cache::CacheData> > inputs;
266 inputs.push_back(std::move(cache_data));
267
268 cache_data = this->input_cache()->pullCacheData();
269 if (cache_data == nullptr){
270 is_last_batch = true;
271 }
272
273 std::map<std::string, std::string> task_args;
274 task_args[TASK_ARG_REMOVE_PRECEDING_OVERLAP] = !(is_first_batch && is_first_node) ? TRUE : FALSE;
275 task_args[TASK_ARG_REMOVE_FOLLOWING_OVERLAP] = !(is_last_batch && is_last_node) ? TRUE : FALSE;
276
277 ral::execution::executor::get_instance()->add_task(
278 std::move(inputs),
279 this->output_cache(),
280 this,
281 task_args);
282
283 is_first_batch = false;
284 }
285 } else {
286 while (cache_data != nullptr ){
287 std::vector<std::unique_ptr <ral::cache::CacheData> > inputs;
288 inputs.push_back(std::move(cache_data));
289
290 ral::execution::executor::get_instance()->add_task(
291 std::move(inputs),
292 this->output_cache(),
293 this);
294
295 cache_data = this->input_cache()->pullCacheData();
296 }
297 }
298
299
300
301 std::unique_lock<std::mutex> lock(kernel_mutex);
302 kernel_cv.wait(lock,[this]{
303 return this->tasks.empty();
304 });
305
306 if (logger != nullptr) {
307 logger->debug("{query_id}|{step}|{substep}|{info}|{duration}|kernel_id|{kernel_id}||",

Callers

nothing calls this directly

Calls 15

create_empty_tableFunction · 0.85
BlazingThreadClass · 0.85
getNodeIndexMethod · 0.80
getTotalNodesMethod · 0.80
pullCacheDataMethod · 0.80
input_cacheMethod · 0.80
output_cacheMethod · 0.80
waitMethod · 0.80
getContextTokenMethod · 0.80
getQueryStepMethod · 0.80
getQuerySubstepMethod · 0.80
elapsed_timeMethod · 0.80

Tested by

no test coverage detected