[ 
https://issues.apache.org/jira/browse/TRAFODION-3216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16649578#comment-16649578
 ] 

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_r225014925
  
    --- Diff: core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp ---
    @@ -563,32 +795,332 @@ void 
CmpSeabaseDDL::dropSeabaseLibrary(StmtDDLDropLibrary * dropLibraryNode,
       processReturn();
       return;
     }
    -
    -void  CmpSeabaseDDL::alterSeabaseLibrary(StmtDDLAlterLibrary  
*alterLibraryNode,
    -                                    NAString &currCatName, 
    -                                    NAString &currSchName)
    +void CmpSeabaseDDL::dropSeabaseLibrary(StmtDDLDropLibrary * 
dropLibraryNode,
    +                                       NAString &currCatName, 
    +                                       NAString &currSchName)
     {
    -  Lng32 cliRC;
    -  Lng32 retcode;
    -  
    -  NAString libraryName = alterLibraryNode->getLibraryName();
    -  NAString libFileName = alterLibraryNode->getFilename();
    -  
    -  ComObjectName libName(libraryName, COM_TABLE_NAME);
    +  Lng32 cliRC = 0;
    +  Lng32 retcode = 0;
    +
    +  BindWA bindWA(ActiveSchemaDB(), CmpCommon::context(), FALSE/*inDDL*/);
    +  NARoutineDB *pRoutineDBCache  = ActiveSchemaDB()->getNARoutineDB();
    +  const NAString &objName = dropLibraryNode->getLibraryName();
    +
    +  ComObjectName libraryName(objName);
       ComAnsiNamePart currCatAnsiName(currCatName);
       ComAnsiNamePart currSchAnsiName(currSchName);
    -  libName.applyDefaults(currCatAnsiName, currSchAnsiName);
    -  
    -  NAString catalogNamePart = libName.getCatalogNamePartAsAnsiString();
    -  NAString schemaNamePart = libName.getSchemaNamePartAsAnsiString(TRUE);
    -  NAString libNamePart = libName.getObjectNamePartAsAnsiString(TRUE);
    -  const NAString extLibName = libName.getExternalName(TRUE);
    -  
    -  ExeCliInterface cliInterface(STMTHEAP, 0, NULL,
    -                          
CmpCommon::context()->sqlSession()->getParentQid());
    -  
    +  libraryName.applyDefaults(currCatAnsiName, currSchAnsiName);
    +
    +  const NAString catalogNamePart = libraryName.
    +    getCatalogNamePartAsAnsiString();
    +  const NAString schemaNamePart = libraryName.
    +    getSchemaNamePartAsAnsiString(TRUE);
    +  const NAString objectNamePart = libraryName.
    +    getObjectNamePartAsAnsiString(TRUE);
    +  const NAString extLibraryName = libraryName.getExternalName(TRUE);
    +
    +  ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
    +    CmpCommon::context()->sqlSession()->getParentQid());
    +
    +  ExpHbaseInterface * ehi = allocEHI();
    +  if (ehi == NULL)
    +    return;
    +
       retcode = existsInSeabaseMDTable(&cliInterface, 
    -                              catalogNamePart, schemaNamePart, libNamePart,
    +                              catalogNamePart, schemaNamePart, 
    +                                   objectNamePart,
    +                              COM_LIBRARY_OBJECT, TRUE, FALSE);
    +  if (retcode < 0)
    +    {
    +      deallocEHI(ehi); 
    +      processReturn();
    +      return;
    +    }
    +
    +  if (retcode == 0) // does not exist
    +    {
    +      *CmpCommon::diags() << DgSqlCode(-1389)
    +                     << DgString0(extLibraryName);
    +      deallocEHI(ehi); 
    +      processReturn();
    +      return;
    +    }
    +
    +  Int32 objectOwnerID = 0;
    +  Int32 schemaOwnerID = 0;
    +  Int64 objectFlags = 0;
    +  Int64 objUID = getObjectInfo(&cliInterface,
    +                         catalogNamePart.data(), schemaNamePart.data(), 
    +                         objectNamePart.data(), COM_LIBRARY_OBJECT,
    +                              objectOwnerID,schemaOwnerID,objectFlags);
    +  if (objUID < 0 || objectOwnerID == 0 || schemaOwnerID == 0)
    +    {
    +      deallocEHI(ehi); 
    +      processReturn();
    +      return;
    +    }
    +
    +  if (!isDDLOperationAuthorized(SQLOperation::DROP_LIBRARY,
    +                                objectOwnerID,
    +                                schemaOwnerID))
    +  {
    +     *CmpCommon::diags() << DgSqlCode(-CAT_NOT_AUTHORIZED);
    +     processReturn ();
    --- End diff --
    
    deallocEHI?  Probably in existing dropSeabaseLibrary2 code also.


> 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)

Reply via email to