本文整理汇总了C++中Query::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ Query::getNext方法的具体用法?C++ Query::getNext怎么用?C++ Query::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query::getNext方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compute
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);
}
示例2: compute
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;
}
示例3: compute
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();
}
示例4: compute
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();
}
示例5: compute
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();
}
示例6: compute
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();
}
示例7: compute
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();
}