IRowStream * doLocalSelfJoin()
    {
#if THOR_TRACE_LEVEL > 5
        ActPrintLog("SELFJOIN: Performing local self-join");
#endif
        Owned<IThorRowLoader> iLoader = createThorRowLoader(*this, ::queryRowInterfaces(input), compare, isUnstable() ? stableSort_none : stableSort_earlyAlloc, rc_mixed, SPILL_PRIORITY_SELFJOIN);
        Owned<IRowStream> rs = iLoader->load(input, abortSoon);
        stopInput(input);
        input = NULL;
        return rs.getClear();
    }
    IRowStream * doLocalSelfJoin()
    {
#if THOR_TRACE_LEVEL > 5
        ActPrintLog("SELFJOIN: Performing local self-join");
#endif
        Owned<IThorRowLoader> iLoader = createThorRowLoader(*this, ::queryRowInterfaces(input), compare, isUnstable() ? stableSort_none : stableSort_earlyAlloc, rc_mixed, SPILL_PRIORITY_SELFJOIN);
        Owned<IRowStream> rs = iLoader->load(inputStream, abortSoon);
        mergeStats(spillStats, iLoader);  // Not sure of the best policy if rs spills later on.
        PARENT::stop();
        return rs.getClear();
    }
 void start()
 {
     ActivityTimer s(totalCycles, timeActivities, NULL);
     dataLinkStart();
     input = inputs.item(0);
     unsigned spillPriority = container.queryGrouped() ? SPILL_PRIORITY_GROUPSORT : SPILL_PRIORITY_LARGESORT;
     iLoader.setown(createThorRowLoader(*this, queryRowInterfaces(input), iCompare, unstable ? stableSort_none : stableSort_earlyAlloc, rc_mixed, spillPriority));
     startInput(input);
     eoi = false;
     if (container.queryGrouped())
         out.setown(iLoader->loadGroup(input, abortSoon));
     else
         out.setown(iLoader->load(input, abortSoon));
     if (0 == iLoader->numRows())
         eoi = true;
 }