void TupleHavingStep::execute() { RGData rgDataIn; RGData rgDataOut; bool more = false; try { more = fInputDL->next(fInputIterator, &rgDataIn); dlTimes.setFirstReadTime(); if (!more && cancelled()) { fEndOfResult = true; } while (more && !fEndOfResult) { fRowGroupIn.setData(&rgDataIn); rgDataOut.reinit(fRowGroupOut, fRowGroupIn.getRowCount()); fRowGroupOut.setData(&rgDataOut); doHavingFilters(); more = fInputDL->next(fInputIterator, &rgDataIn); if (cancelled()) { fEndOfResult = true; } else { fOutputDL->insert(rgDataOut); } } } catch(const std::exception& ex) { catchHandler(ex.what(), tupleHavingStepErr, fErrorInfo, fSessionId); } catch(...) { catchHandler("TupleHavingStep execute caught an unknown exception", tupleHavingStepErr, fErrorInfo, fSessionId); } while (more) more = fInputDL->next(fInputIterator, &rgDataIn); fEndOfResult = true; fOutputDL->endOfInput(); dlTimes.setLastReadTime(); dlTimes.setEndOfInputTime(); if (traceOn()) printCalTrace(); }
void TupleHavingStep::execute() { RGData rgDataIn; RGData rgDataOut; bool more = false; StepTeleStats sts; sts.query_uuid = fQueryUuid; sts.step_uuid = fStepUuid; try { more = fInputDL->next(fInputIterator, &rgDataIn); dlTimes.setFirstReadTime(); sts.msg_type = StepTeleStats::ST_START; sts.total_units_of_work = 1; postStepStartTele(sts); if (!more && cancelled()) { fEndOfResult = true; } while (more && !fEndOfResult) { fRowGroupIn.setData(&rgDataIn); rgDataOut.reinit(fRowGroupOut, fRowGroupIn.getRowCount()); fRowGroupOut.setData(&rgDataOut); doHavingFilters(); more = fInputDL->next(fInputIterator, &rgDataIn); if (cancelled()) { fEndOfResult = true; } else { fOutputDL->insert(rgDataOut); } } } catch(const std::exception& ex) { catchHandler(ex.what(), tupleHavingStepErr, fErrorInfo, fSessionId); } catch(...) { catchHandler("TupleHavingStep execute caught an unknown exception", tupleHavingStepErr, fErrorInfo, fSessionId); } while (more) more = fInputDL->next(fInputIterator, &rgDataIn); fEndOfResult = true; fOutputDL->endOfInput(); sts.msg_type = StepTeleStats::ST_SUMMARY; sts.total_units_of_work = sts.units_of_work_completed = 1; sts.rows = fRowsReturned; postStepSummaryTele(sts); dlTimes.setLastReadTime(); dlTimes.setEndOfInputTime(); if (traceOn()) printCalTrace(); }
uint32_t TupleHavingStep::nextBand(messageqcpp::ByteStream &bs) { RGData rgDataIn; RGData rgDataOut; bool more = false; uint32_t rowCount = 0; try { bs.restart(); more = fInputDL->next(fInputIterator, &rgDataIn); if (dlTimes.FirstReadTime().tv_sec ==0) dlTimes.setFirstReadTime(); if (!more || cancelled()) { fEndOfResult = true; } bool emptyRowGroup = true; while (more && !fEndOfResult && emptyRowGroup) { if (cancelled()) { while (more) more = fInputDL->next(fInputIterator, &rgDataIn); break; } fRowGroupIn.setData(&rgDataIn); rgDataOut.reinit(fRowGroupOut, fRowGroupIn.getRowCount()); fRowGroupOut.setData(&rgDataOut); doHavingFilters(); if (fRowGroupOut.getRowCount() > 0) { emptyRowGroup = false; fRowGroupOut.serializeRGData(bs); rowCount = fRowGroupOut.getRowCount(); } else { more = fInputDL->next(fInputIterator, &rgDataIn); } } if (!more) { fEndOfResult = true; } } catch(const std::exception& ex) { catchHandler(ex.what(), tupleHavingStepErr, fErrorInfo, fSessionId); while (more) more = fInputDL->next(fInputIterator, &rgDataIn); fEndOfResult = true; } catch(...) { catchHandler("TupleHavingStep next band caught an unknown exception", tupleHavingStepErr, fErrorInfo, fSessionId); while (more) more = fInputDL->next(fInputIterator, &rgDataIn); fEndOfResult = true; } if (fEndOfResult) { // send an empty / error band rgDataOut.reinit(fRowGroupOut, 0); fRowGroupOut.setData(&rgDataOut); fRowGroupOut.resetRowGroup(0); fRowGroupOut.setStatus(status()); fRowGroupOut.serializeRGData(bs); dlTimes.setLastReadTime(); dlTimes.setEndOfInputTime(); if (traceOn()) printCalTrace(); } return rowCount; }