void PageScheme::connectSignals() { connect(BtnCopy, SIGNAL(clicked()), this, SLOT(copyRow())); connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow())); connect(BtnDelete, SIGNAL(clicked()), this, SLOT(deleteRow())); mapper = new QDataWidgetMapper(this); connect(selectScheme, SIGNAL(currentIndexChanged(int)), mapper, SLOT(setCurrentIndex(int))); connect(selectScheme, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeSelected(int))); }
void TupleConstantOnlyStep::fillInConstants() { fRowGroupOut.getRow(0, &fRowOut); idbassert(fRowConst.getSize() == fRowOut.getSize()); copyRow(fRowConst, &fRowOut); fRowGroupOut.resetRowGroup(0); fRowGroupOut.setRowCount(1); fRowsReturned = 1; }
void LimitedOrderBy::finalize() { if (fRowGroup.getRowCount() > 0) fDataQueue.push(fData); if (fStart != 0) { uint64_t newSize = fRowsPerRG * fRowGroup.getRowSize(); if (!fRm->getMemory(newSize)) { cerr << IDBErrorInfo::instance()->errorMsg(fErrorCode) << " @" << __FILE__ << ":" << __LINE__; throw IDBExcept(fErrorCode); } fMemSize += newSize; fData.reinit(fRowGroup, fRowsPerRG); fRowGroup.setData(&fData); fRowGroup.resetRowGroup(0); fRowGroup.getRow(0, &fRow0); queue<RGData> tempQueue; uint64_t i = 0; while ((fOrderByQueue.size() > fStart) && (i++ < fCount)) { const OrderByRow& topRow = fOrderByQueue.top(); row1.setData(topRow.fData); copyRow(row1, &fRow0); //memcpy(fRow0.getData(), topRow.fData, fRow0.getSize()); fRowGroup.incRowCount(); fRow0.nextRow(); fOrderByQueue.pop(); if (fRowGroup.getRowCount() >= fRowsPerRG) { tempQueue.push(fData); if (!fRm->getMemory(newSize)) { cerr << IDBErrorInfo::instance()->errorMsg(fErrorCode) << " @" << __FILE__ << ":" << __LINE__; throw IDBExcept(fErrorCode); } fMemSize += newSize; fData.reinit(fRowGroup, fRowsPerRG); //fData.reset(new uint8_t[fRowGroup.getDataSize(fRowsPerRG)]); fRowGroup.setData(&fData); fRowGroup.resetRowGroup(0); fRowGroup.getRow(0, &fRow0); } } if (fRowGroup.getRowCount() > 0) tempQueue.push(fData); fDataQueue = tempQueue; } }
TableOfReal TableOfReal_extractRowRanges (TableOfReal me, const wchar_t *ranges) { try { long numberOfElements; autoNUMvector <long> elements (getElementsOfRanges (ranges, my numberOfRows, & numberOfElements, L"row"), 1); autoTableOfReal thee = TableOfReal_create (numberOfElements, my numberOfColumns); copyColumnLabels (me, thee.peek()); for (long ielement = 1; ielement <= numberOfElements; ielement ++) copyRow (me, elements [ielement], thee.peek(), ielement); return thee.transfer(); } catch (MelderError) { Melder_throw (me, ": row ranges not extracted."); } }
int64_t JoinPartition::insertLargeSideRow(const Row &row) { int64_t ret = 0; copyRow(row, &largeRow); largeRG.incRowCount(); if (largeRG.getRowCount() == 8192) ret = processLargeBuffer(); else largeRow.nextRow(); return ret; }
int64_t JoinPartition::insertSmallSideRow(const Row &row) { int64_t ret = 0; copyRow(row, &smallRow); smallRG.incRowCount(); if (smallRG.getRowCount() == 8192) ret = processSmallBuffer(); else smallRow.nextRow(); return ret; }
TableOfReal TableOfReal_extractRowsWhere (TableOfReal me, const wchar_t *condition, Interpreter interpreter) { try { Formula_compile (interpreter, me, condition, kFormula_EXPRESSION_TYPE_NUMERIC, TRUE); /* * Count the new number of rows. */ long numberOfElements = 0; for (long irow = 1; irow <= my numberOfRows; irow ++) { for (long icol = 1; icol <= my numberOfColumns; icol ++) { struct Formula_Result result; Formula_run (irow, icol, & result); if (result. result.numericResult != 0.0) { numberOfElements ++; break; } } } if (numberOfElements < 1) Melder_throw ("No rows match this condition."); /* * Create room for the result. */ autoTableOfReal thee = TableOfReal_create (numberOfElements, my numberOfColumns); copyColumnLabels (me, thee.peek()); /* * Store the result. */ numberOfElements = 0; for (long irow = 1; irow <= my numberOfRows; irow ++) { for (long icol = 1; icol <= my numberOfColumns; icol ++) { struct Formula_Result result; Formula_run (irow, icol, & result); if (result. result.numericResult != 0.0) { copyRow (me, irow, thee.peek(), ++ numberOfElements); break; } } } return thee.transfer(); } catch (MelderError) { Melder_throw (me, ": rows not extracted."); } }
void TupleHavingStep::doHavingFilters() { fRowGroupIn.getRow(0, &fRowIn); fRowGroupOut.getRow(0, &fRowOut); fRowGroupOut.resetRowGroup(fRowGroupIn.getBaseRid()); for (uint64_t i = 0; i < fRowGroupIn.getRowCount(); ++i) { if(fFeInstance->evaluate(fRowIn, fExpressionFilter)) { copyRow(fRowIn, &fRowOut); fRowGroupOut.incRowCount(); fRowOut.nextRow(); } fRowIn.nextRow(); } fRowsReturned += fRowGroupOut.getRowCount(); }
TableOfReal TableOfReal_extractRowsWhereLabel (TableOfReal me, int which_Melder_STRING, const wchar_t *criterion) { try { long n = 0; for (long irow = 1; irow <= my numberOfRows; irow ++) { if (Melder_stringMatchesCriterion (my rowLabels [irow], which_Melder_STRING, criterion)) { n ++; } } if (n == 0) Melder_throw (L"No row matches this criterion."); autoTableOfReal thee = TableOfReal_create (n, my numberOfColumns); copyColumnLabels (me, thee.peek()); n = 0; for (long irow = 1; irow <= my numberOfRows; irow ++) if (Melder_stringMatchesCriterion (my rowLabels [irow], which_Melder_STRING, criterion)) copyRow (me, irow, thee.peek(), ++ n); return thee.transfer(); } catch (MelderError) { Melder_throw (me, ": rows not extracted."); } }
TableOfReal TableOfReal_extractRowsWhereColumn (TableOfReal me, long column, int which_Melder_NUMBER, double criterion) { try { if (column < 1 || column > my numberOfColumns) Melder_throw ("No such column: ", column, "."); long n = 0; for (long irow = 1; irow <= my numberOfRows; irow ++) { if (Melder_numberMatchesCriterion (my data [irow] [column], which_Melder_NUMBER, criterion)) { n ++; } } if (n == 0) Melder_throw ("No row matches this criterion."); autoTableOfReal thee = TableOfReal_create (n, my numberOfColumns); copyColumnLabels (me, thee.peek()); n = 0; for (long irow = 1; irow <= my numberOfRows; irow ++) if (Melder_numberMatchesCriterion (my data [irow] [column], which_Melder_NUMBER, criterion)) copyRow (me, irow, thee.peek(), ++ n); return thee.transfer(); } catch (MelderError) { Melder_throw (me, ": rows not extracted."); } }
void TupleConstantStep::fillInConstants(const rowgroup::Row& rowIn, rowgroup::Row& rowOut) { if (fIndexConst.size() > 1 || fIndexConst[0] != 0) { copyRow(fRowConst, &rowOut); //memcpy(rowOut.getData(), fRowConst.getData(), fRowConst.getSize()); rowOut.setRid(rowIn.getRelRid()); for (uint64_t j = 0; j < fIndexMapping.size(); ++j) rowIn.copyField(rowOut, fIndexMapping[j], j); //rowIn.copyField(rowOut.getData() + rowOut.getOffset(fIndexMapping[j]), j); } else // only first column is constant { //size_t n = rowOut.getOffset(rowOut.getColumnCount()) - rowOut.getOffset(1); rowOut.setRid(rowIn.getRelRid()); fRowConst.copyField(rowOut, 0, 0); //fRowConst.copyField(rowOut.getData()+2, 0); // hardcoded 2 for rid length for (uint i = 1; i < rowOut.getColumnCount(); i++) rowIn.copyField(rowOut, i, i-1); //memcpy(rowOut.getData()+rowOut.getOffset(1), rowIn.getData()+2, n); } }
void TupleConstantStep::fillInConstants() { fRowGroupIn.getRow(0, &fRowIn); fRowGroupOut.getRow(0, &fRowOut); if (fIndexConst.size() > 1 || fIndexConst[0] != 0) { for (uint64_t i = 0; i < fRowGroupIn.getRowCount(); ++i) { copyRow(fRowConst, &fRowOut); fRowOut.setRid(fRowIn.getRelRid()); for (uint64_t j = 0; j < fIndexMapping.size(); ++j) fRowIn.copyField(fRowOut, fIndexMapping[j], j); fRowIn.nextRow(); fRowOut.nextRow(); } } else // only first column is constant { //size_t n = fRowOut.getOffset(fRowOut.getColumnCount()) - fRowOut.getOffset(1); for (uint64_t i = 0; i < fRowGroupIn.getRowCount(); ++i) { fRowOut.setRid(fRowIn.getRelRid()); fRowConst.copyField(fRowOut, 0, 0); for (uint i = 1; i < fRowOut.getColumnCount(); i++) fRowIn.copyField(fRowOut, i, i-1); fRowIn.nextRow(); fRowOut.nextRow(); } } fRowGroupOut.resetRowGroup(fRowGroupIn.getBaseRid()); fRowGroupOut.setRowCount(fRowGroupIn.getRowCount()); fRowsReturned += fRowGroupOut.getRowCount(); }
void AbstractTextureRenderer::setupTexture() { glBindTexture(GL_TEXTURE_2D, m_textureID); // clear the texture memset(m_textureData, 0, m_textureWidth * m_textureHeight * sizeof(XuColorPixel)); setupCopy(); XuColorPixel* dst = m_textureData + m_imageRect.x + m_imageRect.y * m_textureWidth; int srcOffset = 0; for (int i = 0; i < m_imageRect.height; i++) { copyRow(dst, srcOffset); dst += m_textureWidth; srcOffset += m_imageRect.width; } finalizeCopy(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_textureWidth, m_textureHeight, 0, XU_RAW_COLOR_PIXEL_GL_FORMAT, GL_UNSIGNED_BYTE, m_textureData); }
static jlong nativeExecuteForCursorWindow(JNIEnv* env, jclass clazz, jlong connectionPtr, jlong statementPtr, jlong windowPtr, jint startPos, jint requiredPos, jboolean countAllRows) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); status_t status = window->clear(); if (status) { String8 msg; msg.appendFormat("Failed to clear the cursor window, status=%d", status); throw_sqlite3_exception(env, connection->db, msg.string()); return 0; } int numColumns = sqlite3_column_count(statement); status = window->setNumColumns(numColumns); if (status) { String8 msg; msg.appendFormat("Failed to set the cursor window column count to %d, status=%d", numColumns, status); throw_sqlite3_exception(env, connection->db, msg.string()); return 0; } int retryCount = 0; int totalRows = 0; int addedRows = 0; bool windowFull = false; bool gotException = false; while (!gotException && (!windowFull || countAllRows)) { int err = sqlite3_step(statement); if (err == SQLITE_ROW) { LOG_WINDOW("Stepped statement %p to row %d", statement, totalRows); retryCount = 0; totalRows += 1; // Skip the row if the window is full or we haven't reached the start position yet. if (startPos >= totalRows || windowFull) { continue; } CopyRowResult cpr = copyRow(env, window, statement, numColumns, startPos, addedRows); if (cpr == CPR_FULL && addedRows && startPos + addedRows <= requiredPos) { // We filled the window before we got to the one row that we really wanted. // Clear the window and start filling it again from here. // TODO: Would be nicer if we could progressively replace earlier rows. window->clear(); window->setNumColumns(numColumns); startPos += addedRows; addedRows = 0; cpr = copyRow(env, window, statement, numColumns, startPos, addedRows); } if (cpr == CPR_OK) { addedRows += 1; } else if (cpr == CPR_FULL) { windowFull = true; } else { gotException = true; } } else if (err == SQLITE_DONE) { // All rows processed, bail LOG_WINDOW("Processed all rows"); break; } else if (err == SQLITE_LOCKED || err == SQLITE_BUSY) { // The table is locked, retry LOG_WINDOW("Database locked, retrying"); if (retryCount > 50) { ALOGE("Bailing on database busy retry"); throw_sqlite3_exception(env, connection->db, "retrycount exceeded"); gotException = true; } else { // Sleep to give the thread holding the lock a chance to finish usleep(1000); retryCount++; } } else { throw_sqlite3_exception(env, connection->db); gotException = true; } } LOG_WINDOW("Resetting statement %p after fetching %d rows and adding %d rows" "to the window in %d bytes", statement, totalRows, addedRows, window->size() - window->freeSpace()); sqlite3_reset(statement); // Report the total number of rows on request. if (startPos > totalRows) { ALOGE("startPos %d > actual rows %d", startPos, totalRows); } jlong result = jlong(startPos) << 32 | jlong(totalRows); return result; }
int main(int argc, char *argv[]) { CvCapture* capture = cvCreateFileCapture("/Users/Will/Desktop/MVI_5415.MOV"); int s = 2000; IplImage *framebuff = cvQueryFrame(capture); IplImage *img[s]; cvNamedWindow("Window1", CV_WINDOW_AUTOSIZE); cvMoveWindow("Window1",100,0); cvNamedWindow("Window2", CV_WINDOW_AUTOSIZE); cvMoveWindow("Window2",100,500); int i,j; int num_frames; int vid_width = 1280; int vid_height = 720; cvSetImageROI(framebuff, cvRect(0,0,vid_width,vid_height)); for(i=0; 1; i++) { framebuff = cvQueryFrame(capture); if(!framebuff) { num_frames = i-1; fprintf(stderr, "\n\nFinished loading %d frames of video\n\n", num_frames); break; } if(i>s-5) { fprintf(stderr, "\n!!!!!!!!!!!!!!!!\n!!!!!!!!!!!!!!!!\n"); fprintf(stderr, "Video over %d frames long - please update size of img[] array\n", s); return 0; } img[i] = cvCreateImage(cvSize(vid_width,vid_height),8,3); cvSetImageROI(framebuff, cvRect(0,0,vid_width,vid_height)); cvSetImageROI(img[i], cvRect(0,0,vid_width,vid_height)); if(i%100==0 && i!=0) { fprintf(stderr,"\nCopied up to image %d into memory", i); fprintf(stderr, " : width: %d, %d - height: %d, %d" , framebuff->width, img[i]->width, framebuff->height, img[i]->height); } cvCopy(framebuff, img[i], NULL); } double frames_per_sec = 25; CvSize video_track_size = cvSize(vid_width,num_frames); CvVideoWriter* writerTracker = cvCreateVideoWriter( "/Users/Will/Desktop/splitVideo5.avi", CV_FOURCC('D','I','V','X'), frames_per_sec, video_track_size, 1 ); IplImage *mainimg = cvCreateImage(cvSize(vid_width,num_frames),8,3); for(j=0; j<vid_height; j++) { for(i=0; i<num_frames; i++) { copyRow(mainimg, img[i], j, i, 1); cvSetImageROI(mainimg, cvRect(0,0,vid_width,num_frames)); } if(j%100==0 && j!=0) { fprintf(stderr, "\nWritten up to frame %d...", j); } //cvShowImage("Window1", mainimg); //cvWaitKey(0); cvWriteFrame(writerTracker, mainimg); } fprintf(stderr, "\n\nComplete!\n\n"); cvReleaseVideoWriter(&writerTracker); }
void TupleAnnexStep::executeWithOrderBy() { RGData rgDataIn; RGData rgDataOut; bool more = false; try { more = fInputDL->next(fInputIterator, &rgDataIn); if (traceOn()) dlTimes.setFirstReadTime(); while (more && !cancelled()) { fRowGroupIn.setData(&rgDataIn); fRowGroupIn.getRow(0, &fRowIn); for (uint64_t i = 0; i < fRowGroupIn.getRowCount() && !cancelled(); ++i) { fOrderBy->processRow(fRowIn); fRowIn.nextRow(); } more = fInputDL->next(fInputIterator, &rgDataIn); } fOrderBy->finalize(); if (!cancelled()) { while (fOrderBy->getData(rgDataIn)) { if (fConstant == NULL && fRowGroupOut.getColumnCount() == fRowGroupIn.getColumnCount()) { rgDataOut = rgDataIn; fRowGroupOut.setData(&rgDataOut); } else { fRowGroupIn.setData(&rgDataIn); fRowGroupIn.getRow(0, &fRowIn); rgDataOut.reinit(fRowGroupOut, fRowGroupIn.getRowCount()); fRowGroupOut.setData(&rgDataOut); fRowGroupOut.resetRowGroup(fRowGroupIn.getBaseRid()); fRowGroupOut.setDBRoot(fRowGroupIn.getDBRoot()); fRowGroupOut.getRow(0, &fRowOut); for (uint64_t i = 0; i < fRowGroupIn.getRowCount(); ++i) { if (fConstant) fConstant->fillInConstants(fRowIn, fRowOut); else copyRow(fRowIn, &fRowOut); fRowGroupOut.incRowCount(); fRowOut.nextRow(); fRowIn.nextRow(); } } if (fRowGroupOut.getRowCount() > 0) { fRowsReturned += fRowGroupOut.getRowCount(); fOutputDL->insert(rgDataOut); } } } } catch(const std::exception& ex) { catchHandler(ex.what(), fSessionId); if (status() == 0) status(ERR_IN_PROCESS); } catch(...) { catchHandler("TupleAnnexStep execute caught an unknown exception", fSessionId); if (status() == 0) status(ERR_IN_PROCESS); } while (more) more = fInputDL->next(fInputIterator, &rgDataIn); if (traceOn() && !fDelivery) { dlTimes.setLastReadTime(); dlTimes.setEndOfInputTime(); printCalTrace(); } // Bug 3136, let mini stats to be formatted if traceOn. fOutputDL->endOfInput(); }
void TupleAnnexStep::executeNoOrderByWithDistinct() { scoped_ptr<DistinctMap_t> distinctMap(new DistinctMap_t(10, TAHasher(this), TAEq(this))); vector<RGData> dataVec; RGData rgDataIn; RGData rgDataOut; bool more = false; rgDataOut.reinit(fRowGroupOut); fRowGroupOut.setData(&rgDataOut); fRowGroupOut.resetRowGroup(0); fRowGroupOut.getRow(0, &fRowOut); fRowGroupOut.initRow(&row1); fRowGroupOut.initRow(&row2); try { more = fInputDL->next(fInputIterator, &rgDataIn); if (traceOn()) dlTimes.setFirstReadTime(); while (more && !cancelled() && !fLimitHit) { fRowGroupIn.setData(&rgDataIn); fRowGroupIn.getRow(0, &fRowIn); for (uint64_t i = 0; i < fRowGroupIn.getRowCount() && !cancelled() && !fLimitHit; ++i) { pair<DistinctMap_t::iterator, bool> inserted; if (fConstant) fConstant->fillInConstants(fRowIn, fRowOut); else copyRow(fRowIn, &fRowOut); ++fRowsProcessed; fRowIn.nextRow(); inserted = distinctMap->insert(fRowOut.getPointer()); if (inserted.second) { fRowGroupOut.incRowCount(); fRowOut.nextRow(); if (UNLIKELY(++fRowsReturned >= fLimitCount)) { fLimitHit = true; fJobList->abortOnLimit((JobStep*) this); } if (UNLIKELY(fRowGroupOut.getRowCount() >= 8192)) { dataVec.push_back(rgDataOut); rgDataOut.reinit(fRowGroupOut); fRowGroupOut.setData(&rgDataOut); fRowGroupOut.resetRowGroup(0); fRowGroupOut.getRow(0, &fRowOut); } } } more = fInputDL->next(fInputIterator, &rgDataIn); } if (fRowGroupOut.getRowCount() > 0) dataVec.push_back(rgDataOut); for (vector<RGData>::iterator i = dataVec.begin(); i != dataVec.end(); i++) { rgDataOut = *i; fRowGroupOut.setData(&rgDataOut); fOutputDL->insert(rgDataOut); } } catch(const std::exception& ex) { catchHandler(ex.what(), fSessionId); if (status() == 0) status(ERR_IN_PROCESS); } catch(...) { catchHandler("TupleAnnexStep execute caught an unknown exception", fSessionId); if (status() == 0) status(ERR_IN_PROCESS); } while (more) more = fInputDL->next(fInputIterator, &rgDataIn); if (traceOn() && !fDelivery) { dlTimes.setLastReadTime(); dlTimes.setEndOfInputTime(); printCalTrace(); } // Bug 3136, let mini stats to be formatted if traceOn. fOutputDL->endOfInput(); }
void LimitedOrderBy::processRow(const rowgroup::Row& row) { // check if this is a distinct row if (fDistinct && fDistinctMap->find(row.getPointer()) != fDistinctMap->end()) return; // @bug5312, limit count is 0, do nothing. if (fCount == 0) return; // if the row count is less than the limit if (fOrderByQueue.size() < fStart+fCount) { copyRow(row, &fRow0); //memcpy(fRow0.getData(), row.getData(), row.getSize()); OrderByRow newRow(fRow0, fRule); fOrderByQueue.push(newRow); // add to the distinct map if (fDistinct) fDistinctMap->insert(fRow0.getPointer()); //fDistinctMap->insert(make_pair((fRow0.getData()+2), fRow0.getData())); fRowGroup.incRowCount(); fRow0.nextRow(); if (fRowGroup.getRowCount() >= fRowsPerRG) { fDataQueue.push(fData); uint64_t newSize = fRowsPerRG * fRowGroup.getRowSize(); if (!fRm->getMemory(newSize)) { cerr << IDBErrorInfo::instance()->errorMsg(fErrorCode) << " @" << __FILE__ << ":" << __LINE__; throw IDBExcept(fErrorCode); } fMemSize += newSize; fData.reinit(fRowGroup, fRowsPerRG); fRowGroup.setData(&fData); fRowGroup.resetRowGroup(0); fRowGroup.getRow(0, &fRow0); } } else if (fOrderByCond.size() > 0 && fRule.less(row.getPointer(), fOrderByQueue.top().fData)) { OrderByRow swapRow = fOrderByQueue.top(); row1.setData(swapRow.fData); if (!fDistinct) { copyRow(row, &row1); //memcpy(swapRow.fData, row.getData(), row.getSize()); } else { fDistinctMap->erase(row.getPointer()); copyRow(row, &row1); fDistinctMap->insert(row1.getPointer()); //fDistinctMap->erase(fDistinctMap->find(row.getData() + 2)); //memcpy(swapRow.fData, row.getData(), row.getSize()); //fDistinctMap->insert(make_pair((swapRow.fData+2), swapRow.fData)); } fOrderByQueue.pop(); fOrderByQueue.push(swapRow); } }
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(); }
void SubAdapterStep::execute() { RGData rgDataIn; RGData rgDataOut; Row rowIn; Row rowFe; Row rowOut; fRowGroupIn.initRow(&rowIn); fRowGroupOut.initRow(&rowOut); RGData rowFeData; bool usesFE = false; if (fRowGroupFe.getColumnCount() != (uint32_t) -1) { usesFE = true; fRowGroupFe.initRow(&rowFe, true); rowFeData = RGData(fRowGroupFe, 1); fRowGroupFe.setData(&rowFeData); fRowGroupFe.getRow(0, &rowFe); } bool more = false; try { 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); 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(); } // Bug 3136, let mini stats to be formatted if traceOn. fOutputDL->endOfInput(); }
void TupleAnnexStep::executeNoOrderBy() { RGData rgDataIn; RGData rgDataOut; bool more = false; try { more = fInputDL->next(fInputIterator, &rgDataIn); if (traceOn()) dlTimes.setFirstReadTime(); while (more && !cancelled() && !fLimitHit) { fRowGroupIn.setData(&rgDataIn); fRowGroupIn.getRow(0, &fRowIn); // Get a new output rowgroup for each input rowgroup to preserve the rids rgDataOut.reinit(fRowGroupOut, fRowGroupIn.getRowCount()); fRowGroupOut.setData(&rgDataOut); fRowGroupOut.resetRowGroup(fRowGroupIn.getBaseRid()); fRowGroupOut.setDBRoot(fRowGroupIn.getDBRoot()); fRowGroupOut.getRow(0, &fRowOut); for (uint64_t i = 0; i < fRowGroupIn.getRowCount() && !cancelled() && !fLimitHit; ++i) { // skip first limit-start rows if (fRowsProcessed++ < fLimitStart) { fRowIn.nextRow(); continue; } if (fConstant) fConstant->fillInConstants(fRowIn, fRowOut); else copyRow(fRowIn, &fRowOut); fRowGroupOut.incRowCount(); if (++fRowsReturned < fLimitCount) { fRowOut.nextRow(); fRowIn.nextRow(); } else { fLimitHit = true; fJobList->abortOnLimit((JobStep*) this); } } if (fRowGroupOut.getRowCount() > 0) { fOutputDL->insert(rgDataOut); } more = fInputDL->next(fInputIterator, &rgDataIn); } } catch(const std::exception& ex) { catchHandler(ex.what(), fSessionId); if (status() == 0) status(ERR_IN_PROCESS); } catch(...) { catchHandler("TupleAnnexStep execute caught an unknown exception", fSessionId); if (status() == 0) status(ERR_IN_PROCESS); } while (more) more = fInputDL->next(fInputIterator, &rgDataIn); if (traceOn() && !fDelivery) { dlTimes.setLastReadTime(); dlTimes.setEndOfInputTime(); printCalTrace(); } // Bug 3136, let mini stats to be formatted if traceOn. fOutputDL->endOfInput(); }