void compute() { for (int i=0; i<TUPLES; ++i) { verify[i] = 0; } q.threadInit(); #ifdef VERBOSE PrettyPrinterVisitor ppv; cout << "---------- QUERY PLAN START ----------" << endl; q.accept(&ppv); cout << "----------- QUERY PLAN END -----------" << endl; #endif Operator::Page* out; Operator::GetNextResultT result; if (q.scanStart() != Operator::Ready) { fail("Scan initialization failed."); } while(result.first == Operator::Ready) { result = q.getNext(); out = result.second; Operator::Page::Iterator it = out->createIterator(); void* tuple; while ( (tuple = it.next()) ) { #ifdef VERBOSE2 cout << q.getOutSchema().prettyprint(tuple, ' ') << endl; #endif long long v = q.getOutSchema().asLong(tuple, 0); if (v <= 0 || v > TUPLES) fail("Values that never were generated appear in the output stream."); double d1 = q.getOutSchema().asDecimal(tuple, 1); double d2 = v + 0.1; if (d1 != d2) fail("Wrong tuple detected at join output."); verify[v-1]++; } } if (q.scanStop() != Operator::Ready) { fail("Scan stop failed."); } #ifdef VERBOSE cout << "---------- QUERY PLAN START ----------" << endl; q.accept(&ppv); cout << "----------- QUERY PLAN END -----------" << endl; #endif q.threadClose(); }
void compute() { Operator::Page* out; Operator::GetNextResultT result; startTimer(&timer); if (q.scanStart() != Operator::Ready) { fail("Scan initialization failed."); } while(result.first == Operator::Ready) { result = q.getNext(); out = result.second; Operator::Page::Iterator it = out->createIterator(); void* tuple; while ( (tuple = it.next()) ) { #ifdef VERBOSE cout << q.getOutSchema().prettyprint(tuple, ' ') << endl; #endif skata1 += *(unsigned long long*)tuple; skata2 += *((double*)tuple+1); } } if (q.scanStop() != Operator::Ready) { fail("Scan stop failed."); } stopTimer(&timer); }
void compute() { unsigned long long cycles = 0; Operator::GetNextResultT result; result.first = Operator::Ready; startTimer(&cycles); if (q.scanStart() == Operator::Error) fail("Scan initialization failed."); while(result.first == Operator::Ready) { result = q.getNext(); if (result.first == Operator::Error) fail("GetNext returned error."); Operator::Page::Iterator it = result.second->createIterator(); void* tuple; while ((tuple = it.next()) ) { cout << q.getOutSchema().prettyprint(tuple, '|') << endl; } } if (q.scanStop() == Operator::Error) fail("Scan stop failed."); stopTimer(&cycles); #warning Cycles to seconds conversion is hardcoded for our prototype system cout << "ResponseTimeInSec: " << cycles/1000./1000./2000. << endl; }
void compute() { int verify[TUPLES]; for (int i=0; i<TUPLES; ++i) { verify[i] = 0; } q.threadInit(); Operator::Page* out; Operator::GetNextResultT result; if (q.scanStart() != Operator::Ready) { fail("Scan initialization failed."); } while(result.first == Operator::Ready) { result = q.getNext(); out = result.second; Operator::Page::Iterator it = out->createIterator(); void* tuple; while ( (tuple = it.next()) ) { #ifdef VERBOSE cout << q.getOutSchema().prettyprint(tuple, ' ') << endl; #endif long long v = q.getOutSchema().asLong(tuple, 0); if (v <= 0 || v > TUPLES) fail("Values that never were generated appear in the output stream."); if (verify[v-1] != 0) fail("Aggregation group appears twice."); if (lrint(q.getOutSchema().asDecimal(tuple, 1)) != (v*(v+1)/2)) fail("Aggregated value is wrong."); verify[v-1]++; } } if (q.scanStop() != Operator::Ready) { fail("Scan stop failed."); } q.threadClose(); }
void compute() { for (int i=0; i<TUPLES*TUPLES; ++i) { verify[i] = 0; } q.threadInit(); Operator::Page* out; Operator::GetNextResultT result; if (q.scanStart() != Operator::Ready) { fail("Scan initialization failed."); } while(result.first == Operator::Ready) { result = q.getNext(); out = result.second; Operator::Page::Iterator it = out->createIterator(); void* tuple; while ( (tuple = it.next()) ) { #ifdef VERBOSE cout << q.getOutSchema().prettyprint(tuple, ' ') << endl; #endif long long v = q.getOutSchema().asLong(tuple, 0); if (v <= 0 || v > TUPLES) fail("Values that never were generated appear in the output stream."); double d1 = q.getOutSchema().asDecimal(tuple, 1); int i2 = (int) lrint(d1); int idx = (v-1)*TUPLES + (i2-1); if (idx < 0 || idx >= TUPLES*TUPLES) fail("Wrong values appear in output."); verify[idx]++; } } if (q.scanStop() != Operator::Ready) { fail("Scan stop failed."); } q.threadClose(); }
void compute() { q.threadInit(); Operator::Page* out; Operator::GetNextResultT result; if (q.scanStart() != Operator::Ready) { fail("Scan initialization failed."); } while(result.first == Operator::Ready) { result = q.getNext(); out = result.second; Operator::Page::Iterator it = out->createIterator(); void* tuple; while ( (tuple = it.next()) ) { #ifdef VERBOSE cout << q.getOutSchema().prettyprint(tuple, ' ') << endl; #endif long long v = q.getOutSchema().asLong(tuple, 0); if (v <= 0 || v > TUPLES) fail("Values that never were generated appear in the output stream."); double d1 = q.getOutSchema().asDecimal(tuple, 1); double d2 = v + 0.1; if (d1 != d2) fail("Wrong tuple detected at join output."); verify.at(v)++; } } if (q.scanStop() != Operator::Ready) { fail("Scan stop failed."); } q.threadClose(); }
void compute() { q.threadInit(); Operator::Page* out; Operator::GetNextResultT result; if (q.scanStart() != Operator::Ready) { fail("Scan initialization failed."); } while(result.first == Operator::Ready) { result = q.getNext(); out = result.second; Operator::Page::Iterator it = out->createIterator(); void* tuple; while ( (tuple = it.next()) ) { #ifdef VERBOSE2 cout << q.getOutSchema().prettyprint(tuple, ' ') << endl; #endif DataT d; d.v1 = q.getOutSchema().asLong(tuple, 0); d.v2 = q.getOutSchema().asLong(tuple, 1); d.v3 = q.getOutSchema().asInt(tuple, 2); finalresult.push_back(d); } } if (q.scanStop() != Operator::Ready) { fail("Scan stop failed."); } q.threadClose(); }