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

ASF GitHub Bot commented on TRAFODION-2137:
-------------------------------------------

Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/634#discussion_r73267635
  
    --- Diff: core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp ---
    @@ -6019,6 +6181,93 @@ short CmpSeabaseDDL::updateTextTable(ExeCliInterface 
*cliInterface,
       return 0;
     }
     
    +short CmpSeabaseDDL::updateTextTableWithBinaryData
    +(ExeCliInterface *cliInterface,
    + Int64 objUID, 
    + ComTextType textType, 
    + Lng32 subID, 
    + char * inputData,
    + Int32 inputDataLen,
    + NABoolean withDelete)
    +{
    +  Lng32 cliRC = 0;
    +  if (withDelete)
    +    {
    +      // Note: It might be tempting to try an upsert instead of a
    +      // delete followed by an insert, but this won't work. It is
    +      // possible that the metadata text could shrink and take fewer
    +      // rows in its new form than the old. So we do the simple thing
    +      // to avoid such complications.
    +      cliRC = deleteFromTextTable(cliInterface, objUID, textType, subID);
    +      if (cliRC < 0)
    +        {
    +          return -1;
    +        }
    +    }
    +
    +  // convert input data to utf8 first.
    +  ComDiagsArea * diagsArea = CmpCommon::diags();
    +  char * inputDataUTF8 = new(STMTHEAP) char[inputDataLen*4];
    +  Lng32 inputDataLenUTF8 = 0;
    +  ex_expr::exp_return_type rc =
    +    convDoIt(inputData,
    +             inputDataLen,
    +             REC_BYTE_F_ASCII,
    +             0,
    +             (Int32)CharInfo::ISO88591,
    +             inputDataUTF8,
    +             inputDataLen*4,
    +             REC_BYTE_V_ASCII,
    +             inputDataLen,
    +             (Int32)CharInfo::UTF8,
    +             (char*)&inputDataLenUTF8,
    +             sizeof(Lng32),
    +             STMTHEAP,
    +             &diagsArea,
    +             CONV_ASCII_F_V);
    +  if ((rc != ex_expr::EXPR_OK) ||
    +      (inputDataLenUTF8 <= 0))
    +    {
    +      return -1;
    +    }
    +  
    +  Int32 maxLen = TEXTLEN;
    +  char queryBuf[1000];
    +  Lng32 numRows = (inputDataLenUTF8 / maxLen) + 1;
    +  Lng32 currPos = 0;
    +  Int32 currDataLen = 0;
    +
    +  for (Lng32 i = 0; i < numRows; i++)
    +    {
    +      NAString temp;
    +
    +      if (i < numRows-1)
    +        currDataLen = maxLen;
    +      else
    +        currDataLen = inputDataLenUTF8 - currPos;
    +
    +      str_sprintf(queryBuf, "insert into %s.\"%s\".%s values (%Ld, %d, %d, 
%d, 0, cast(? as char(%d bytes) character set utf8 not null))",
    +                  getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_TEXT,
    +                  objUID,
    +                  textType,
    +                  subID,
    +                  i,
    +                  currDataLen);
    +      cliRC = cliInterface->executeImmediateCEFC
    +        (queryBuf, &inputData[currPos], currDataLen, NULL, NULL, NULL);
    --- End diff --
    
    Sorry, a better method is findStartOfChar() in the same file.


> Improve metadata access time during query compilation
> -----------------------------------------------------
>
>                 Key: TRAFODION-2137
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2137
>             Project: Apache Trafodion
>          Issue Type: Improvement
>            Reporter: Anoop Sharma
>            Assignee: Anoop Sharma
>
> When a trafodion object is accessed for the first time in a session, 
> information about it is read from metadata.
> Multiple metadata tables are read to retrieve information about the
> objects being used in the query.
> Once metadata info is read about a table, it is cached in compiler memory. 
> Another query accessing the same object gets it from compiler metadata
> cache.
> This results in the first query compile performance to be slower than the
> subsequent queries accessing the same objects.
> This JIRA is to improve performance of first access of an object in
> a query.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to