[ https://issues.apache.org/jira/browse/TRAFODION-3216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16649577#comment-16649577 ]
ASF GitHub Bot commented on TRAFODION-3216: ------------------------------------------- Github user robertamarton commented on a diff in the pull request: https://github.com/apache/trafodion/pull/1721#discussion_r225014987 --- Diff: core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp --- @@ -995,180 +1561,293 @@ void CmpSeabaseDDL::createSeabaseRoutine( sigBuf[0] = '\0'; if (style == COM_STYLE_JAVA_CALL) - { - // validate routine for Java call based on signature - Lng32 numJavaParam = 0; - ComFSDataType *paramType = new ComFSDataType[numParams]; - ComUInt32 *subType = new ComUInt32 [numParams]; - ComColumnDirection *direction = new ComColumnDirection[numParams]; - NAType *genericType; + { + // validate routine for Java call based on signature + Lng32 numJavaParam = 0; + ComFSDataType *paramType = new ComFSDataType[numParams]; + ComUInt32 *subType = new ComUInt32 [numParams]; + ComColumnDirection *direction = new ComColumnDirection[numParams]; + NAType *genericType; - // Gather the param attributes for LM from the paramDefArray previously - // populated and from the routineparamList generated from paramDefArray. + // Gather the param attributes for LM from the paramDefArray previously + // populated and from the routineparamList generated from paramDefArray. - for (CollIndex i = 0; (Int32)i < numParams; i++) - { - paramType[i] = (ComFSDataType)routineParamArray[i]->getParamDataType()->getFSDatatype(); - subType[i] = 0; // default - // Set subType for special cases detected by LM - switch ( paramType[i] ) - { - case COM_SIGNED_BIN8_FSDT : - case COM_UNSIGNED_BIN8_FSDT : - case COM_SIGNED_BIN16_FSDT : - case COM_SIGNED_BIN32_FSDT : - case COM_SIGNED_BIN64_FSDT : - case COM_UNSIGNED_BIN16_FSDT : - case COM_UNSIGNED_BIN32_FSDT : - case COM_UNSIGNED_BPINT_FSDT : - { - genericType = routineParamArray[i]->getParamDataType() ; - if (genericType->getTypeName() == LiteralNumeric) - subType[i] = genericType->getPrecision(); - else - subType[i] = 0 ; - - break; - } - - case COM_DATETIME_FSDT : - { - genericType = routineParamArray[i]->getParamDataType() ; - DatetimeType & datetimeType = (DatetimeType &) *genericType; - if (datetimeType.getSimpleTypeName() EQU "DATE") - subType[i] = 1 ; - else if (datetimeType.getSimpleTypeName() EQU "TIME") - subType[i] = 2; - else if (datetimeType.getSimpleTypeName() EQU "TIMESTAMP") - subType[i] = 3; - } - } // end switch paramType[i] - - direction[i] = (ComColumnDirection) routineParamArray[i]->getParamDirection(); - } + for (CollIndex i = 0; (Int32)i < numParams; i++) + { + paramType[i] = (ComFSDataType)routineParamArray[i]->getParamDataType()->getFSDatatype(); + subType[i] = 0; // default + // Set subType for special cases detected by LM + switch ( paramType[i] ) + { + case COM_SIGNED_BIN8_FSDT : + case COM_UNSIGNED_BIN8_FSDT : + case COM_SIGNED_BIN16_FSDT : + case COM_SIGNED_BIN32_FSDT : + case COM_SIGNED_BIN64_FSDT : + case COM_UNSIGNED_BIN16_FSDT : + case COM_UNSIGNED_BIN32_FSDT : + case COM_UNSIGNED_BPINT_FSDT : + { + genericType = routineParamArray[i]->getParamDataType() ; + if (genericType->getTypeName() == LiteralNumeric) + subType[i] = genericType->getPrecision(); + else + subType[i] = 0 ; + + break; + } + + case COM_DATETIME_FSDT : + { + genericType = routineParamArray[i]->getParamDataType() ; + DatetimeType & datetimeType = (DatetimeType &) *genericType; + if (datetimeType.getSimpleTypeName() EQU "DATE") + subType[i] = 1 ; + else if (datetimeType.getSimpleTypeName() EQU "TIME") + subType[i] = 2; + else if (datetimeType.getSimpleTypeName() EQU "TIMESTAMP") + subType[i] = 3; + } + } // end switch paramType[i] + + direction[i] = (ComColumnDirection) routineParamArray[i]->getParamDirection(); + } - // If the syntax specified a signature, pass that to LanguageManager. - NAString specifiedSig( createRoutineNode->getJavaSignature() ); - char* optionalSig; - if ( specifiedSig.length() == 0 ) - optionalSig = NULL; - else - optionalSig = (char *)specifiedSig.data(); + // If the syntax specified a signature, pass that to LanguageManager. + NAString specifiedSig( createRoutineNode->getJavaSignature() ); + char* optionalSig; + if ( specifiedSig.length() == 0 ) + optionalSig = NULL; + else + optionalSig = (char *)specifiedSig.data(); - ComBoolean isJavaMain = - ((str_cmp_ne(createRoutineNode->getJavaMethodName(), "main") == 0) ? TRUE : FALSE); - - LmResult createSigResult; - LmJavaSignature *lmSignature = new (STMTHEAP) LmJavaSignature(NULL, - STMTHEAP); - createSigResult = lmSignature->createSig(paramType, subType, direction, - numParams, COM_UNKNOWN_FSDT, 0, - createRoutineNode->getMaxResults(), optionalSig, isJavaMain, sigBuf, - MAX_SIGNATURE_LENGTH, - CmpCommon::diags()); - NADELETE(lmSignature, LmJavaSignature, STMTHEAP); - delete [] paramType; - delete [] subType; - delete [] direction; - - // Lm returned error. Lm fills diags area, so no need to worry about diags. - if (createSigResult == LM_ERR) - { - *CmpCommon::diags() << DgSqlCode(-1231) - << DgString0(extRoutineName); - deallocEHI(ehi); - processReturn(); - return; - } + ComBoolean isJavaMain = + ((str_cmp_ne(createRoutineNode->getJavaMethodName(), "main") == 0) ? TRUE : FALSE); + + LmResult createSigResult; + LmJavaSignature *lmSignature = new (STMTHEAP) LmJavaSignature(NULL, + STMTHEAP); + createSigResult = lmSignature->createSig(paramType, subType, direction, + numParams, COM_UNKNOWN_FSDT, 0, + createRoutineNode->getMaxResults(), optionalSig, isJavaMain, sigBuf, + MAX_SIGNATURE_LENGTH, + CmpCommon::diags()); + NADELETE(lmSignature, LmJavaSignature, STMTHEAP); + delete [] paramType; + delete [] subType; + delete [] direction; + + // Lm returned error. Lm fills diags area, so no need to worry about diags. + if (createSigResult == LM_ERR) + { + *CmpCommon::diags() << DgSqlCode(-1231) + << DgString0(extRoutineName); + deallocEHI(ehi); + processReturn(); + return; + } - numJavaParam = (isJavaMain ? 1 : numParams); + numJavaParam = (isJavaMain ? 1 : numParams); + + if( libBlobHandle[0] != '\0' ) + { + NAString dummyUser; + NAString cachedLibName, cachedLibPath; + + if(ComGenerateUdrCachedLibName(extPath,redefTime,libSchNamePart,dummyUser, cachedLibName, cachedLibPath)) + { + *CmpCommon::diags() << DgSqlCode(-1231) + << DgString0(extRoutineName); --- End diff -- There is a literal for this: CAT_UNABLE_TO_CREATE_ROUTINE. This is another error that could fail for various reasons and it could be improved to return more details. > UDR libraries need to be stored in metadata table as a blob > ----------------------------------------------------------- > > Key: TRAFODION-3216 > URL: https://issues.apache.org/jira/browse/TRAFODION-3216 > Project: Apache Trafodion > Issue Type: Improvement > Components: sql-general > Affects Versions: 2.4 > Reporter: Sandhya Sundaresan > Assignee: Sandhya Sundaresan > Priority: Major > Fix For: 2.4 > > Attachments: Support for LOB storage in metadata for UDR > libraries.docx > > > This is one of many infrastructure changes for SPJs that was planned. > * {color:#0070c0}Store UDR libraries in BLOBs {color} > * {color:#0070c0}Add BLOB column to library metadata table{color} > * {color:#0070c0}Change CREATE LIBRARY command to store library in > BLOB{color} > * {color:#0070c0}Change library file names to include the timestamp (so > updating a library changes the name){color} > * {color:#0070c0}Add a cache for libraries (a new directory, > $TRAF_HOME/udr/public/lib){color} > * {color:#0070c0}Change UDR code to read library from the metadata table > when not in cache{color} > * {color:#0070c0}Upgrade support{color} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)