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

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

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

    https://github.com/apache/incubator-trafodion/pull/60#discussion_r37247350
  
    --- Diff: core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp ---
    @@ -6137,53 +6138,82 @@ short 
CmpSeabaseDDL::validateDivisionByExprForDDL(ItemExpr *divExpr)
     }
     
     short CmpSeabaseDDL::createEncodedKeysBuffer(char** &encodedKeysBuffer,
    +                                             int &numSplits,
                                                  desc_struct * colDescs, 
                                                  desc_struct * keyDescs,
    -                                             Lng32 numSplits, Lng32 
numKeys, 
    -                                             Lng32 keyLength, NABoolean 
isIndex)
    +                                             int numSaltPartitions,
    +                                             Lng32 numSaltSplits,
    +                                             NAString *splitByClause,
    +                                             Lng32 numKeys, 
    +                                             Lng32 keyLength,
    +                                             NABoolean isIndex)
     {
       encodedKeysBuffer = NULL;
    -  
    -  if (numSplits <= 0)
    +  numSplits = 0;
    +
    +  if (numSaltSplits <= 0)
         return 0;
     
    -    NAString ** inArray = createInArrayForLowOrHighKeys(colDescs, 
    -                                                        keyDescs,
    -                                                        numKeys,
    -                                                        FALSE,
    -                                                        isIndex,
    -                                                        STMTHEAP ); 
    -
    -    char splitNumCharStr[5];
    -    NAString splitNumString;
    -
    -    /* HBase creates 1 more split than
    -       the number of rows in the split array. In the example below we have 
a 
    -       salt column and an integer column as the key. KeyLength is 4 + 4 = 
8.
    -       encodedKeysBuffer will have 4 elements, each of length 8. When this
    -       buffer is given to HBase through the Java API we get a table with 5 
    -       splits and begin/end keys as shown below
    -       
    -       Start Key                                                     End 
Key
    -       \x00\x00\x00\x01\x00\x00\x00\x00
    -       \x00\x00\x00\x01\x00\x00\x00\x00      
\x00\x00\x00\x02\x00\x00\x00\x00   
    -       \x00\x00\x00\x02\x00\x00\x00\x00      
\x00\x00\x00\x03\x00\x00\x00\x00
    -       \x00\x00\x00\x03\x00\x00\x00\x00      
\x00\x00\x00\x04\x00\x00\x00\x00   
    -       \x00\x00\x00\x04\x00\x00\x00\x00 
    -    */
    -    encodedKeysBuffer = new (STMTHEAP) char*[numSplits];
    -    for(int i =0; i < numSplits; i++)
    -      encodedKeysBuffer[i] = new (STMTHEAP) char[keyLength];
    -
    -    inArray[0] = &splitNumString;
    -    short retVal = 0;
    -    
    -    for(Int32 i =0; i < numSplits; i++) {
    -      sprintf(splitNumCharStr, "%d", i+1);
    -      splitNumString = splitNumCharStr;
    +  // make a list of NAStrings with the default values for start keys
    +  NAString ** defaultSplits = createInArrayForLowOrHighKeys(
    +       colDescs,
    +       keyDescs,
    +       numKeys,
    +       FALSE,
    +       isIndex,
    +       STMTHEAP );
    +  NAString **splitValuesAsText = new(STMTHEAP) NAString *[numKeys];
    +  ElemDDLPartitionList * pPartitionList = NULL;
    +  ElemDDLPartitionRange *pPartitionRange = NULL;
    +
    +      numSplits = numSaltSplits;
    +
    +      // for salt splits, only the first key column value
    +      // is variable, the rest use the default values
    +      for (int k=1; k<numKeys; k++)
    +        splitValuesAsText[k] = defaultSplits[k];
    +
    --- End diff --
    
    Indentation is inconsistent (if you happen to fix something else perhaps 
you could fix this too)


> Fix a collection of issues related to decoding HBase region keys and updating 
> the TEXT metadata table
> -----------------------------------------------------------------------------------------------------
>
>                 Key: TRAFODION-1457
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-1457
>             Project: Apache Trafodion
>          Issue Type: Bug
>         Environment: any
>            Reporter: Hans Zeller
>            Assignee: Hans Zeller
>
> The code I wrote a while ago for handling incomplete HBase region keys needs 
> some more improvement, which caused me to clean up a few related areas. One 
> of them is generation of min/max values for key building. Also, I would like 
> to change the methods we use to read and update the "_MD_".TEXT table. 
> Changing quotes to double quotes should happen inside this method, not last 
> because it should only happen on the individual chunks to be inserted.



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

Reply via email to