当前位置: 首页>>代码示例>>C++>>正文


C++ Query::getNext方法代码示例

本文整理汇总了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);
}
开发者ID:aveek0218,项目名称:ImpalaPythia,代码行数:31,代码来源:query1.cpp

示例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;
}
开发者ID:aveek0218,项目名称:pythia,代码行数:32,代码来源:executequery.cpp

示例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();
}
开发者ID:aveek0218,项目名称:ImpalaPythia,代码行数:56,代码来源:querympsmjoin.cpp

示例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();
}
开发者ID:aveek0218,项目名称:ImpalaPythia,代码行数:46,代码来源:queryaggsum.cpp

示例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();
}
开发者ID:feilongliu,项目名称:pythia,代码行数:44,代码来源:querypreprejoincartesianprod.cpp

示例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();
}
开发者ID:feilongliu,项目名称:pythia,代码行数:39,代码来源:querympsmpartitionedjoin.cpp

示例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();
}
开发者ID:aveek0218,项目名称:ImpalaPythia,代码行数:39,代码来源:queryhdf5.cpp


注:本文中的Query::getNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。