trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request: TRAFODION-1457 Issues related to...
Date Mon, 17 Aug 2015 23:00:58 GMT
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)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message