IRowStream * doGlobalSelfJoin() { #if THOR_TRACE_LEVEL > 5 ActPrintLog("SELFJOIN: Performing global self-join"); #endif sorter->Gather(::queryRowInterfaces(input), input, compare, NULL, NULL, keyserializer, NULL, false, isUnstable(), abortSoon, NULL); stopInput(input); input = NULL; if(abortSoon) { barrier->cancel(); return NULL; } if (!barrier->wait(false)) { Sleep(1000); // let original error through throw MakeThorException(TE_BarrierAborted,"SELFJOIN: Barrier Aborted"); } rowcount_t totalrows; return sorter->startMerge(totalrows); }
void start() { ActivityTimer s(totalCycles, timeActivities); input = inputs.item(0); try { try { startInput(input); } catch (IException *e) { fireException(e); barrier->cancel(); throw; } catch (CATCHALL) { Owned<IException> e = MakeActivityException(this, 0, "Unknown exception starting sort input"); fireException(e); barrier->cancel(); throw; } dataLinkStart(); Linked<IRowInterfaces> rowif = queryRowInterfaces(input); Owned<IRowInterfaces> auxrowif = createRowInterfaces(helper->querySortedRecordSize(),queryActivityId(),queryCodeContext()); sorter->Gather( rowif, input, helper->queryCompare(), helper->queryCompareLeftRight(), NULL,helper->querySerialize(), NULL, false, isUnstable(), abortSoon, auxrowif); stopInput(input); input = NULL; if (abortSoon) { ActPrintLogEx(&queryContainer(), thorlog_null, MCwarning, "MSortSlaveActivity::start aborting"); barrier->cancel(); return; } } catch (IException *e) { fireException(e); barrier->cancel(); throw; } catch (CATCHALL) { Owned<IException> e = MakeActivityException(this, 0, "Unknown exception gathering sort input"); fireException(e); barrier->cancel(); throw; } ActPrintLog("SORT waiting barrier.1"); if (!barrier->wait(false)) { Sleep(1000); // let original error through throw MakeThorException(TE_BarrierAborted,"SORT: Barrier Aborted"); } ActPrintLog("SORT barrier.1 raised"); output.setown(sorter->startMerge(totalrows)); }