Github user nonstop-qfchen commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/255#discussion_r49485376
  
    --- Diff: core/sql/generator/GenExplain.cpp ---
    @@ -660,6 +660,269 @@ FileScan::addSpecificExplainInfo(ExplainTupleMaster 
*explainTuple,
       return(explainTuple);
     }
     
    +static void appendListOfColumns(Queue* listOfColNames,ComTdb *tdb, 
NAString& outNAString){
    +
    +   if (((ComTdbHbaseAccess*)tdb)->sqHbaseTable()){// if trafodion table
    +     char buf[1000];
    +
    +     listOfColNames->position();
    +     for (Lng32 j = 0; j < listOfColNames->numEntries(); j++)
    +       {
    +         char * currPtr = (char*)listOfColNames->getCurr();
    +
    +         Lng32 currPos = 0;
    +         Lng32 jj = 0;
    +         short colNameLen = *(short*)currPtr;
    +         currPos += sizeof(short);
    +         char colFam[100];
    +         while (currPtr[currPos] != ':')
    +           {
    +             colFam[jj] = currPtr[currPos];
    +             currPos++;
    +             jj++;
    +           }
    --- End diff --
    
    I think the following is always better. No?
    
    for (Lng32 i = 0; i < colNameLen; i++)
    {
    colName[i] = currPtr[currPos++];
    }
    
    On Tue, Jan 12, 2016 at 11:06 AM, Eric Owhadi <[email protected]>
    wrote:
    
    > In core/sql/generator/GenExplain.cpp
    > 
<https://github.com/apache/incubator-trafodion/pull/255#discussion_r49482410>
    > :
    >
    > > +         listOfColNames->position();
    > > +         for (Lng32 j = 0; j < listOfColNames->numEntries(); j++)
    > > +           {
    > > +             char * currPtr = (char*)listOfColNames->getCurr();
    > > +
    > > +             Lng32 currPos = 0;
    > > +             Lng32 jj = 0;
    > > +             short colNameLen = *(short*)currPtr;
    > > +             currPos += sizeof(short);
    > > +             char colFam[100];
    > > +             while (currPtr[currPos] != ':')
    > > +               {
    > > +                 colFam[jj] = currPtr[currPos];
    > > +                 currPos++;
    > > +                 jj++;
    > > +               }
    >
    > code compaction vs readability is a long debated topic and end up being
    > developer taste specific. I personally prefer compaction too, but wanted 
to
    > respect the model I followed to favor consistancy over my personal taste.
    > see the code I refer too:
    > for (Lng32 i = 0; i < colNameLen; i++)
    > {
    > colName[i] = currPtr[currPos];
    > currPos++;
    > }
    >
    > —
    > Reply to this email directly or view it on GitHub
    > <https://github.com/apache/incubator-trafodion/pull/255/files#r49482410>.
    >
    
    
    
    -- 
    Regards, --Qifan



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to