Exemple #1
0
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();
}
Exemple #2
0
void SubAdapterStep::execute()
{
	RGData rgDataIn;
	RGData rgDataOut;
	Row rowIn;
	Row rowFe;
	Row rowOut;
	fRowGroupIn.initRow(&rowIn);
	fRowGroupOut.initRow(&rowOut);

	RGData rowFeData;
	StepTeleStats sts;
	sts.query_uuid = fQueryUuid;
	sts.step_uuid = fStepUuid;
	bool usesFE = false;
	if (fRowGroupFe.getColumnCount() > 0)
	{
		usesFE = true;
		fRowGroupFe.initRow(&rowFe, true);
		rowFeData = RGData(fRowGroupFe, 1);
		fRowGroupFe.setData(&rowFeData);
		fRowGroupFe.getRow(0, &rowFe);
	}

	bool more = false;
	try
	{
		sts.msg_type = StepTeleStats::ST_START;
		sts.total_units_of_work = 1;
		postStepStartTele(sts);

		fSubStep->run();

		more = fInputDL->next(fInputIterator, &rgDataIn);
		if (traceOn()) dlTimes.setFirstReadTime();

		while (more && !cancelled())
		{
			fRowGroupIn.setData(&rgDataIn);
			rgDataOut.reinit(fRowGroupOut, fRowGroupIn.getRowCount());
			fRowGroupOut.setData(&rgDataOut);
			fRowGroupOut.resetRowGroup(fRowGroupIn.getBaseRid());

			fRowGroupIn.getRow(0, &rowIn);
			fRowGroupOut.getRow(0, &rowOut);

			fRowsInput += fRowGroupIn.getRowCount();

			for (uint64_t i = 0; i < fRowGroupIn.getRowCount(); ++i)
			{
				if(fExpression.get() == NULL)
				{
					outputRow(rowIn, rowOut);
				}
				else if (!usesFE)
				{
					if(fExpression->evaluate(&rowIn))
					{
						outputRow(rowIn, rowOut);
					}
				}
				else
				{
					copyRow(rowIn, &rowFe, rowIn.getColumnCount());
					//memcpy(rowFe.getData(), rowIn.getData(), rowIn.getSize());
					if(fExpression->evaluate(&rowFe))
					{
						outputRow(rowFe, rowOut);
					}
				}

				rowIn.nextRow();
			}

			if (fRowGroupOut.getRowCount() > 0)
			{
				fRowsReturned += fRowGroupOut.getRowCount();
				fOutputDL->insert(rgDataOut);
			}

			more = fInputDL->next(fInputIterator, &rgDataIn);
		}
	}
	catch(const std::exception& ex)
	{
		catchHandler(ex.what(), ERR_EXEMGR_MALFUNCTION, fErrorInfo, fSessionId);
	}
	catch(...)
	{
		catchHandler("SubAdapterStep execute caught an unknown exception",
						ERR_EXEMGR_MALFUNCTION, fErrorInfo, fSessionId);
	}

	if (cancelled())
		while (more)
			more = fInputDL->next(fInputIterator, &rgDataIn);

	if (traceOn())
	{
		dlTimes.setLastReadTime();
		dlTimes.setEndOfInputTime();
		printCalTrace();
	}

	sts.msg_type = StepTeleStats::ST_SUMMARY;
	sts.total_units_of_work = sts.units_of_work_completed = 1;
	sts.rows = fRowsReturned;
	postStepSummaryTele(sts);

	// Bug 3136, let mini stats to be formatted if traceOn.
	fOutputDL->endOfInput();
}