// append an ascii-version of UDFunction into cachewa.qryText_ void UDFunction::generateCacheKey(CacheWA& cwa) const { NARoutine *routine = NULL; NARoutine *action = NULL; cwa += " nam:"; cwa += functionName_.getExternalName().data(); if (cwa.getPhase() >= CmpMain::BIND && getRoutineDesc() && (routine=getRoutineDesc()->getNARoutine()) != NULL) { char redefTime[40]; convertInt64ToAscii(routine->getRedefTime(), redefTime); cwa += " redef:"; cwa += redefTime; if ((routine->getSchemaLabelFileName()) && (str_len(routine->getSchemaLabelFileName()) > 0)) { char schRedefTime[40]; convertInt64ToAscii(routine->getSchemaRedefTime(), schRedefTime); cwa += " schredef:"; cwa += schRedefTime; } } if (getRoutineDesc() && getRoutineDesc()->getActionNameAsGiven().length() != 0) { cwa += " actnam:"; cwa += getRoutineDesc()->getActionNameAsGiven(); if (cwa.getPhase() >= CmpMain::BIND && getRoutineDesc() && (action=getRoutineDesc()->getActionNARoutine()) != NULL) { char redefTime[40]; convertInt64ToAscii(action->getRedefTime(), redefTime); cwa += " actredef:"; cwa += redefTime; } } cwa += "("; Lng32 arity = (Lng32) getArity(); for (Lng32 i = 0; i < arity; i++) { if (i > 0) { cwa += ", "; } child(i)->generateCacheKey(cwa); } if (getRoutineDesc()->getLocale() != 0 ) { cwa += ", LOCALE: "; char dFmt[20]; str_itoa(getRoutineDesc()->getLocale(), dFmt); cwa += dFmt; } cwa += ")"; }
short IsolatedScalarUDF::generateShape(CollHeap * c, char * buf, NAString * shapeStr) { Space *space = (Space *)c; char mybuf[100]; sprintf (mybuf, "isolated_scalar_udf"); outputBuffer (space, buf, mybuf, shapeStr); if (getRoutineDesc() && getRoutineDesc()->getNARoutine() && getRoutineDesc()->getNARoutine()->getRoutineName()) { NAString fmtdStr; ToQuotedString(fmtdStr, getRoutineDesc()->getNARoutine()-> getRoutineName()->getQualifiedNameObj(). getQualifiedNameAsAnsiString().data()); snprintf (mybuf, 100, "(scalar_udf %s", fmtdStr.data()); outputBuffer (space, buf, mybuf, shapeStr); if (getRoutineDesc()->isUUDFRoutine() && getRoutineDesc()->getActionNARoutine() && getRoutineDesc()->getActionNARoutine()->getActionName()) { ToQuotedString(fmtdStr, getRoutineDesc()->getActionNARoutine()-> getActionName()->data()); snprintf (mybuf, 100, ", udf_action %s", fmtdStr.data()); outputBuffer (space, buf, mybuf, shapeStr); } strcpy(mybuf, ")"); outputBuffer (space, buf, mybuf, shapeStr); } return 0; }
// append an ascii-version of IsolatedScalarUDF into cachewa.qryText_ void IsolatedScalarUDF::generateCacheKey(CacheWA &cwa) const { NARoutine *routine = NULL; NARoutine *action = NULL; RelExpr::generateCacheKey(cwa); cwa += " UDFname:"; cwa += getRoutineName().getQualifiedNameAsAnsiString().data(); if (cwa.getPhase() >= CmpMain::BIND && getRoutineDesc() && (routine=getRoutineDesc()->getNARoutine()) != NULL) { char redefTime[40]; convertInt64ToAscii(routine->getRedefTime(), redefTime); cwa += " redef:"; cwa += redefTime; } if (getRoutineDesc() != NULL && getRoutineDesc()->isUUDFRoutine()) { cwa += " action:"; cwa += getRoutineDesc()->getActionNameAsGiven(); if (cwa.getPhase() >= CmpMain::BIND && getRoutineDesc() && (action=getRoutineDesc()->getActionNARoutine()) != NULL) { char redefTime[40]; convertInt64ToAscii(action->getRedefTime(), redefTime); cwa += " actredef:"; cwa += redefTime; } } const ItemExpr *paramExpr = (getProcAllParamsTree() == NULL) ? getProcInputParamsVids().rebuildExprTree(ITM_ITEM_LIST) : getProcAllParamsTree(); if (paramExpr) { cwa += " arg:("; paramExpr->generateCacheKey(cwa); cwa += ")"; } }