bool Column::getAggregate(AST* ast) const { /* AST type must be 'value' and aggregation string must not be empty */ if (ast->type == fbitdump::Column::AST::valueType) { if (!ast->aggregation.empty()) { return true; } /* or both sides of operation must be aggregable */ } else if (ast->type == fbitdump::Column::AST::operationType) { return getAggregate(ast->left) && getAggregate(ast->right); } /* all other cases */ return false; }
bool Column::getAggregate() const { /* Name columns are not aggregable */ if (this->ast != NULL && getAggregate(this->ast)) { return true; } return false; }
virtual void process() { IRecordSize *recordSize = helper->queryOutputMeta(); Owned<IThorRowInterfaces> rowIf = createThorRowInterfaces(queryRowManager(), helper->queryOutputMeta(), queryId(), queryCodeContext()); OwnedConstThorRow result = getAggregate(*this, container.queryJob().querySlaves(), *rowIf, *helper, mpTag); if (!result) return; CMessageBuffer msg; CMemoryRowSerializer mbs(msg); rowIf->queryRowSerializer()->serialize(mbs, (const byte *)result.get()); if (!queryJobChannel().queryJobComm().send(msg, 1, mpTag, 5000)) throw MakeThorException(0, "Failed to give result to slave"); }