FunctionColumn::FunctionColumn( const FunctionColumn& rhs, const uint32_t sessionID): ReturnedColumn(rhs, sessionID), fFunctionName(rhs.functionName()), fTableAlias (rhs.tableAlias()), fData (rhs.data()), fFunctor(rhs.fFunctor) { fFunctionParms.clear(); fSimpleColumnList.clear(); fAggColumnList.clear(); fWindowFunctionColumnList.clear(); SPTP pt; for (uint32_t i = 0; i < rhs.fFunctionParms.size(); i++) { pt.reset(new ParseTree (*(rhs.fFunctionParms[i]))); fFunctionParms.push_back(pt); pt->walk(getSimpleCols, &fSimpleColumnList); pt->walk(getAggCols, &fAggColumnList); pt->walk(getWindowFunctionCols, &fWindowFunctionColumnList); } fAlias = rhs.alias(); }
void FunctionColumn::unserialize(messageqcpp::ByteStream& b) { uint32_t size, i; //SRCP rc; SPTP pt; FunctionParm::iterator it; fFunctionParms.erase(fFunctionParms.begin(), fFunctionParms.end()); fSimpleColumnList.clear(); fAggColumnList.clear(); fWindowFunctionColumnList.clear(); ObjectReader::checkType(b, ObjectReader::FUNCTIONCOLUMN); ReturnedColumn::unserialize(b); b >> fFunctionName; b >> size; for (i = 0; i < size; i++) { pt.reset(ObjectReader::createParseTree(b)); fFunctionParms.push_back(pt); pt->walk(getSimpleCols, &fSimpleColumnList); pt->walk(getAggCols, &fAggColumnList); pt->walk(getWindowFunctionCols, &fWindowFunctionColumnList); } b >> fTableAlias; b >> fData; FuncExp* funcExp = FuncExp::instance(); fFunctor = funcExp->getFunctor(fFunctionName); // @bug 3506. Special treatment for rand() function. reset the seed Func_rand* rand = dynamic_cast<Func_rand*>(fFunctor); if (rand) rand->seedSet(false); }