Fix columns not fetched when using stats output.

Fixes #5015
This commit is contained in:
Michael Friedrich 2013-11-07 17:53:55 +01:00
parent 7d28e95dba
commit 46548d8e56
1 changed files with 13 additions and 1 deletions

View File

@ -428,8 +428,9 @@ void Query::ExecuteGetHelper(const Stream::Ptr& stream)
}
} else {
std::vector<double> stats(m_Aggregators.size(), 0);
int index = 0;
/* add aggregated stats */
BOOST_FOREACH(const Aggregator::Ptr aggregator, m_Aggregators) {
BOOST_FOREACH(const Value& object, objects) {
aggregator->Apply(table, object);
@ -440,6 +441,17 @@ void Query::ExecuteGetHelper(const Stream::Ptr& stream)
}
Array::Ptr row = make_shared<Array>();
/*
* add columns selected next to stats
* may not be accurate for grouping!
*/
BOOST_FOREACH(const String& columnName, columns) {
Column column = table->GetColumn(columnName);
row->Add(column.ExtractValue(objects[0])); // first object wins
}
for (size_t i = 0; i < m_Aggregators.size(); i++)
row->Add(stats[i]);