following code review outcome on pull request 255:
- for all files, fix tab with white space
- ExHbaseAccess.cpp, add comment
- Initialize nac in file GenPreCode.cpp, line 11938 and 11417
- Remove checks for ITM_REFERENCE (used only in parser/binder). File 
GenPreCode.cpp
- Remove isFirstAndLayer code in recursive function generating the predicate to 
push down in RPN
- add comments in ValueDesc.cpp
- fix indentation in HTableClient.java
- Fix 4 buffer overrun vulnerability in GenExplain.cpp
- create a reusable isAddedColumnWithNonNullDefault in ValueId class. 
(ValueDesc.cpp and .h)


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/f7aaa280
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/f7aaa280
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/f7aaa280

Branch: refs/heads/master
Commit: f7aaa280a8f85c685ee6a1cfc52553f6a1ec98f6
Parents: 9079525
Author: Eric Owhadi <[email protected]>
Authored: Fri Jan 15 15:51:04 2016 +0000
Committer: Eric Owhadi <[email protected]>
Committed: Fri Jan 15 15:51:04 2016 +0000

----------------------------------------------------------------------
 core/sql/executor/ExHbaseAccess.cpp             |   67 +-
 core/sql/generator/GenExplain.cpp               |  479 ++++----
 core/sql/generator/GenPreCode.cpp               |  715 +++++-------
 core/sql/optimizer/RelScan.h                    |   12 +-
 core/sql/optimizer/ValueDesc.cpp                |   35 +-
 core/sql/optimizer/ValueDesc.h                  |    5 +
 core/sql/regress/executor/EXPECTED140           |   36 +-
 core/sql/regress/executor/FILTER140             |    2 +-
 core/sql/regress/executor/TEST140               |    6 +-
 core/sql/sqlcomp/nadefaults.cpp                 |   30 +-
 .../java/org/trafodion/sql/HTableClient.java    | 1078 +++++++++---------
 11 files changed, 1186 insertions(+), 1279 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f7aaa280/core/sql/executor/ExHbaseAccess.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExHbaseAccess.cpp 
b/core/sql/executor/ExHbaseAccess.cpp
index e229d2b..188d270 100644
--- a/core/sql/executor/ExHbaseAccess.cpp
+++ b/core/sql/executor/ExHbaseAccess.cpp
@@ -2809,49 +2809,50 @@ short ExHbaseAccessTcb::setupHbaseFilterPreds()
     return 0;
 
   if (hbaseFilterValExpr()){// with pushdown V2 it can be null if we have only 
unary operation
-                 ex_queue_entry *pentry_down = qparent_.down->getHeadEntry();
+          ex_queue_entry *pentry_down = qparent_.down->getHeadEntry();
 
-                 workAtp_->getTupp(hbaseAccessTdb().hbaseFilterValTuppIndex_)
-                       .setDataPointer(hbaseFilterValRow_);
+          workAtp_->getTupp(hbaseAccessTdb().hbaseFilterValTuppIndex_)
+            .setDataPointer(hbaseFilterValRow_);
 
-                 ex_expr::exp_return_type evalRetCode =
-                       hbaseFilterValExpr()->eval(pentry_down->getAtp(), 
workAtp_);
-                 if (evalRetCode == ex_expr::EXPR_ERROR)
-                       {
-                         return -1;
-                       }
+          ex_expr::exp_return_type evalRetCode =
+            hbaseFilterValExpr()->eval(pentry_down->getAtp(), workAtp_);
+          if (evalRetCode == ex_expr::EXPR_ERROR)
+            {
+              return -1;
+            }
 
-                 ExpTupleDesc * hfrTD =
-                       hbaseAccessTdb().workCriDesc_->getTupleDescriptor
-                       (hbaseAccessTdb().hbaseFilterValTuppIndex_);
+          ExpTupleDesc * hfrTD =
+            hbaseAccessTdb().workCriDesc_->getTupleDescriptor
+            (hbaseAccessTdb().hbaseFilterValTuppIndex_);
 
-                 hbaseFilterValues_.clear();
-                 for (Lng32 i = 0; i <  hfrTD->numAttrs(); i++)
-                       {
-                         Attributes * attr = hfrTD->getAttr(i);
+          hbaseFilterValues_.clear();
+          //for each evaluated value, populate the corresponding 
hBaseFilterValue
+          for (Lng32 i = 0; i <  hfrTD->numAttrs(); i++)
+          {
+              Attributes * attr = hfrTD->getAttr(i);
 
-                         if (attr)
-                       {
-                         NAString value(getHeap());
-                         if (attr->getNullFlag())
-                               {
-                                 char nullValChar = 0;
+            if (attr)
+                {
+                  NAString value(getHeap());
+                  if (attr->getNullFlag())
+                    {
+                      char nullValChar = 0;
 
-                                 short nullVal = 
*(short*)&hbaseFilterValRow_[attr->getNullIndOffset()];
+                      short nullVal = 
*(short*)&hbaseFilterValRow_[attr->getNullIndOffset()];
 
-                                 if (nullVal)
-                               nullValChar = -1;
-                                 value.append((char*)&nullValChar, 
sizeof(char));
-                               }
+                      if (nullVal)
+                          nullValChar = -1;
+                      value.append((char*)&nullValChar, sizeof(char));
+                    }
 
-                         char * colVal = 
&hbaseFilterValRow_[attr->getOffset()];
+                  char * colVal = &hbaseFilterValRow_[attr->getOffset()];
 
-                         value.append(colVal,
-                                          
attr->getLength(&hbaseFilterValRow_[attr->getVCLenIndOffset()]));
+                  value.append(colVal,
+                           
attr->getLength(&hbaseFilterValRow_[attr->getVCLenIndOffset()]));
 
-                         hbaseFilterValues_.insert(value);
-                       }
-                       }
+                  hbaseFilterValues_.insert(value);
+                }
+            }
   }
   setupListOfColNames(hbaseAccessTdb().listOfHbaseFilterColNames(),
                      hbaseFilterColumns_);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f7aaa280/core/sql/generator/GenExplain.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenExplain.cpp 
b/core/sql/generator/GenExplain.cpp
index e79f9fc..7f8c8b4 100644
--- a/core/sql/generator/GenExplain.cpp
+++ b/core/sql/generator/GenExplain.cpp
@@ -662,264 +662,247 @@ FileScan::addSpecificExplainInfo(ExplainTupleMaster 
*explainTuple,
 
 static void appendListOfColumns(Queue* listOfColNames,ComTdb *tdb, NAString& 
outNAString){
 
-       if (((ComTdbHbaseAccess*)tdb)->sqHbaseTable()){// if trafodion table
-         char buf[1000];
+    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++;
-               }
-             colFam[jj] = ':';
-             jj++;
-             currPos++;
-             colFam[jj] = 0;
-             colNameLen -= jj;
-
-             NABoolean withAt = FALSE;
-             char * colName = &currPtr[currPos];
-             if (colName[0] == '@')
-               {
-                 colNameLen--;
-                 colName++;
-                 withAt = TRUE;
-               }
+      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] != ':')
+          {
+            currPos++;
+            jj++;
+          }
+          jj++;
+          currPos++;
+          snprintf(colFam,sizeof(colFam),"%.*s",jj,currPtr+sizeof(short));
+          colNameLen -= jj;
+
+          NABoolean withAt = FALSE;
+          char * colName = &currPtr[currPos];
+          if (colName[0] == '@')
+        {
+          colNameLen--;
+          colName++;
+          withAt = TRUE;
+        }
 
-             Int64 v;
-             if (colNameLen == sizeof(char))
-               v = *(char*)colName;
-             else if (colNameLen == sizeof(unsigned short))
-               v = *(UInt16*)colName;
-             else if (colNameLen == sizeof(Lng32))
-               v = *(ULng32*)colName;
-             else
-               v = 0;
-             if (j==0)
-                     str_sprintf(buf, "%s%s%Ld",
-                                 colFam,
-                                 (withAt ? "@" : ""),
-                                 v);
-             else
-                         str_sprintf(buf, ",%s%s%Ld",
-                                 colFam,
-                                 (withAt ? "@" : ""),
-                                 v);
-
-             outNAString += buf;
-
-             listOfColNames->advance();
-           } // for
-       }// trafodion tables
-       else
-       {// if hbase native tables
-         char buf[1000];
-
-         listOfColNames->position();
-         for (Lng32 j = 0; j < listOfColNames->numEntries(); j++)
-           {
-             char * currPtr = (char*)listOfColNames->getCurr();
+          Int64 v;
+          if (colNameLen == sizeof(char))
+        v = *(char*)colName;
+          else if (colNameLen == sizeof(unsigned short))
+        v = *(UInt16*)colName;
+          else if (colNameLen == sizeof(Lng32))
+        v = *(ULng32*)colName;
+          else
+        v = 0;
+          if (j==0)
+              str_sprintf(buf, "%s%s%Ld",
+                  colFam,
+                  (withAt ? "@" : ""),
+                  v);
+          else
+              str_sprintf(buf, ",%s%s%Ld",
+                  colFam,
+                  (withAt ? "@" : ""),
+                  v);
 
-             char * colNamePtr = NULL;
+          outNAString += buf;
 
-                 Lng32 currPos = 0;
-                 short colNameLen = *(short*)currPtr;
-                 currPos += sizeof(short);
-                 char colName[500];
+          listOfColNames->advance();
+        } // for
+    }// trafodion tables
+    else
+    {// if hbase native tables
+      char buf[1000];
 
-                 for (Lng32 i = 0; i < colNameLen; i++)
-                   {
-                     colName[i] = currPtr[currPos];
-                     currPos++;
-                   }
+      listOfColNames->position();
+      for (Lng32 j = 0; j < listOfColNames->numEntries(); j++)
+        {
+          char * currPtr = (char*)listOfColNames->getCurr();
 
-                 colName[colNameLen] = 0;
+          char * colNamePtr = NULL;
 
-                 colNamePtr = colName;
+          Lng32 currPos = 0;
+          short colNameLen = *(short*)currPtr;
+          currPos += sizeof(short);
+          char colName[500];
+          
snprintf(colName,sizeof(colName),"%.*s",colNameLen,currPtr+sizeof(short));
+          colNamePtr = colName;
 
-                 if (j==0)
-                         str_sprintf(buf, "%s",colNamePtr);
-                 else
-                         str_sprintf(buf, ",%s",colNamePtr);
+          if (j==0)
+              str_sprintf(buf, "%s",colNamePtr);
+          else
+              str_sprintf(buf, ",%s",colNamePtr);
 
 
-                 outNAString += buf;
+          outNAString += buf;
 
-             listOfColNames->advance();
-           } // for
+          listOfColNames->advance();
+        } // for
 
-       }// hbase native table
-       outNAString +=" ";
+    }// hbase native table
+    outNAString +=" ";
 }
 
 static void appendPushedDownExpression(ComTdb *tdb, NAString& outNAString){
-       // in predicate pushdown V2, the hbaseCompareOps list contains a 
reverse polish set of operation, were operators are
-       // AND or OR, the rest are operands. this function display the column, 
operator and replace any constant with ?. it keeps reverse polish format
-       // this can be improved in the future for better readability.
-       char buf[1000];
-       Queue* reversePolishItems = ((ComTdbHbaseAccess 
*)tdb)->listOfHbaseCompareOps();
-       Queue* pushedDownColumns = ((ComTdbHbaseAccess 
*)tdb)->listOfHbaseFilterColNames();
-       reversePolishItems->position();
-       pushedDownColumns->position();
-
-       for (Lng32 j = 0; j < reversePolishItems->numEntries(); j++){
-               char * currPtr = (char*)reversePolishItems->getCurr();
-               char buf2[1000];
-               if (strcmp(currPtr,"V2")!=0 && strcmp(currPtr,"AND")!=0 && 
strcmp(currPtr,"OR")!=0){//if an operand (not an operator or V2 marker), get 
the column name
-                       if (((ComTdbHbaseAccess*)tdb)->sqHbaseTable()){// if 
trafodion table
-                               char * currPtr2 = 
(char*)pushedDownColumns->getCurr();
-                             Lng32 currPos = 0;
-                             Lng32 jj = 0;
-                             short colNameLen = *(short*)currPtr2;
-                             currPos += sizeof(short);
-                             char colFam[100];
-                             while (currPtr2[currPos] != ':')
-                               {
-                                 colFam[jj] = currPtr2[currPos];
-                                 currPos++;
-                                 jj++;
-                               }
-                             colFam[jj] = ':';
-                             jj++;
-                             currPos++;
-                             colFam[jj] = 0;
-                             colNameLen -= jj;
-
-                             NABoolean withAt = FALSE;
-                             char * colName = &currPtr2[currPos];
-                             if (colName[0] == '@')
-                               {
-                                 colNameLen--;
-                                 colName++;
-                                 withAt = TRUE;
-                               }
-                             Int64 v;
-                             if (colNameLen == sizeof(char))
-                               v = *(char*)colName;
-                             else if (colNameLen == sizeof(unsigned short))
-                               v = *(UInt16*)colName;
-                             else if (colNameLen == sizeof(Lng32))
-                               v = *(ULng32*)colName;
-                             else
-                               v = 0;
-                                 str_sprintf(buf2, "%s%s%Ld",
-                                         colFam,
-                                         (withAt ? "@" : ""),
-                                         v);
-
-                       }else{//native hbase table
-                                char * currPtr2 = 
(char*)pushedDownColumns->getCurr();
-                             char * colNamePtr1 = NULL;
-                                 Lng32 currPos = 0;
-                                 short colNameLen = *(short*)currPtr2;
-                                 currPos += sizeof(short);
-                                 char colName[500];
-                                 for (Lng32 i = 0; i < colNameLen; i++)
-                                   {
-                                     colName[i] = currPtr2[currPos];
-                                     currPos++;
-                                   }
-                                 colName[colNameLen] = 0;
-                                 colNamePtr1 = colName;
-                                 str_sprintf(buf2, "%s",colNamePtr1);
-                       }
-                       pushedDownColumns->advance();
-               }
+    // in predicate pushdown V2, the hbaseCompareOps list contains a reverse 
polish set of operation, were operators are
+    // AND or OR, the rest are operands. this function display the column, 
operator and replace any constant with ?. it keeps reverse polish format
+    // this can be improved in the future for better readability.
+    char buf[1000];
+    Queue* reversePolishItems = ((ComTdbHbaseAccess 
*)tdb)->listOfHbaseCompareOps();
+    Queue* pushedDownColumns = ((ComTdbHbaseAccess 
*)tdb)->listOfHbaseFilterColNames();
+    reversePolishItems->position();
+    pushedDownColumns->position();
+
+    for (Lng32 j = 0; j < reversePolishItems->numEntries(); j++){
+        char * currPtr = (char*)reversePolishItems->getCurr();
+        char buf2[1000];
+        if (strcmp(currPtr,"V2")!=0 && strcmp(currPtr,"AND")!=0 && 
strcmp(currPtr,"OR")!=0){//if an operand (not an operator or V2 marker), get 
the column name
+            if (((ComTdbHbaseAccess*)tdb)->sqHbaseTable()){// if trafodion 
table
+                char * currPtr2 = (char*)pushedDownColumns->getCurr();
+                  Lng32 currPos = 0;
+                  Lng32 jj = 0;
+                  short colNameLen = *(short*)currPtr2;
+                  currPos += sizeof(short);
+                  char colFam[100];
+                  while (currPtr2[currPos] != ':')
+                  {
+                    currPos++;
+                    jj++;
+                  }
+                  jj++;
+                  currPos++;
+                  
snprintf(colFam,sizeof(colFam),"%.*s",jj,currPtr2+sizeof(short));
+                  colNameLen -= jj;
+
+                  NABoolean withAt = FALSE;
+                  char * colName = &currPtr2[currPos];
+                  if (colName[0] == '@')
+                {
+                  colNameLen--;
+                  colName++;
+                  withAt = TRUE;
+                }
+                  Int64 v;
+                  if (colNameLen == sizeof(char))
+                v = *(char*)colName;
+                  else if (colNameLen == sizeof(unsigned short))
+                v = *(UInt16*)colName;
+                  else if (colNameLen == sizeof(Lng32))
+                v = *(ULng32*)colName;
+                  else
+                v = 0;
+                  str_sprintf(buf2, "%s%s%Ld",
+                      colFam,
+                      (withAt ? "@" : ""),
+                      v);
+
+            }else{//native hbase table
+                 char * currPtr2 = (char*)pushedDownColumns->getCurr();
+                  char * colNamePtr1 = NULL;
+                  Lng32 currPos = 0;
+                  short colNameLen = *(short*)currPtr2;
+                  currPos += sizeof(short);
+                  char colName[500];
+                  
snprintf(colName,sizeof(colName),"%.*s",colNameLen,currPtr2+sizeof(short));
+                  colNamePtr1 = colName;
+                  str_sprintf(buf2, "%s",colNamePtr1);
+            }
+            pushedDownColumns->advance();
+        }
 
 
-               char* colNamePtr = buf2;
-               if(strcmp(currPtr,"EQUAL")==0){
-                        str_sprintf(buf, "(%s=?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"NOT_EQUAL")==0){
-                        str_sprintf(buf, "(%s!=?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"LESS")==0){
-                        str_sprintf(buf, "(%s<?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if(strcmp(currPtr,"LESS_OR_EQUAL")==0){
-                        str_sprintf(buf, "(%s<=?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"GREATER")==0){
-                        str_sprintf(buf, "(%s>?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"GREATER_OR_EQUAL")==0){
-                        str_sprintf(buf, "(%s>=?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"NO_OP")==0){//should never happen
-                        str_sprintf(buf, "(%s??)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"EQUAL_NULL")==0){
-                        str_sprintf(buf, "(%s=.?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"NOT_EQUAL_NULL")==0){
-                        str_sprintf(buf, "(%s!=.?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"LESS_NULL")==0){
-                        str_sprintf(buf, "(%s<.?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"LESS_OR_EQUAL_NULL")==0){
-                        str_sprintf(buf, "(%s<=.?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"GREATER_NULL")==0){
-                        str_sprintf(buf, "(%s>.?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"GREATER_OR_EQUAL_NULL")==0){
-                        str_sprintf(buf, "(%s>=.?)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"NO_OP_NULL")==0){
-                        str_sprintf(buf, "(%s?.?)",colNamePtr);//should never 
happen
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"IS_NULL")==0){
-                        str_sprintf(buf, "(%s is_null)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"IS_NULL_NULL")==0){
-                        str_sprintf(buf, "(%s is_null.)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"IS_NOT_NULL")==0){
-                        str_sprintf(buf, "(%s is_not_null)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"IS_NOT_NULL_NULL")==0){
-                        str_sprintf(buf, "(%s is_not_null.)",colNamePtr);
-                        outNAString += buf;
-                }
-                else if (strcmp(currPtr,"AND")==0)
-                         outNAString += "AND";
-                else if (strcmp(currPtr,"OR")==0)
-                         outNAString += "OR";
-
-
-                 reversePolishItems->advance();
-           }
-        outNAString +=' ';
-       }
+        char* colNamePtr = buf2;
+        if(strcmp(currPtr,"EQUAL")==0){
+             str_sprintf(buf, "(%s=?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"NOT_EQUAL")==0){
+             str_sprintf(buf, "(%s!=?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"LESS")==0){
+             str_sprintf(buf, "(%s<?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if(strcmp(currPtr,"LESS_OR_EQUAL")==0){
+             str_sprintf(buf, "(%s<=?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"GREATER")==0){
+             str_sprintf(buf, "(%s>?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"GREATER_OR_EQUAL")==0){
+             str_sprintf(buf, "(%s>=?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"NO_OP")==0){//should never happen
+             str_sprintf(buf, "(%s??)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"EQUAL_NULL")==0){
+             str_sprintf(buf, "(%s=.?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"NOT_EQUAL_NULL")==0){
+             str_sprintf(buf, "(%s!=.?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"LESS_NULL")==0){
+             str_sprintf(buf, "(%s<.?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"LESS_OR_EQUAL_NULL")==0){
+             str_sprintf(buf, "(%s<=.?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"GREATER_NULL")==0){
+             str_sprintf(buf, "(%s>.?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"GREATER_OR_EQUAL_NULL")==0){
+             str_sprintf(buf, "(%s>=.?)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"NO_OP_NULL")==0){
+             str_sprintf(buf, "(%s?.?)",colNamePtr);//should never happen
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"IS_NULL")==0){
+             str_sprintf(buf, "(%s is_null)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"IS_NULL_NULL")==0){
+             str_sprintf(buf, "(%s is_null.)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"IS_NOT_NULL")==0){
+             str_sprintf(buf, "(%s is_not_null)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"IS_NOT_NULL_NULL")==0){
+             str_sprintf(buf, "(%s is_not_null.)",colNamePtr);
+             outNAString += buf;
+         }
+         else if (strcmp(currPtr,"AND")==0)
+              outNAString += "AND";
+         else if (strcmp(currPtr,"OR")==0)
+              outNAString += "OR";
+
+
+          reversePolishItems->advance();
+        }
+     outNAString +=' ';
+    }
 
 
 
@@ -1019,28 +1002,28 @@ HbaseAccess::addSpecificExplainInfo(ExplainTupleMaster 
*explainTuple,
 
   // get column retrieved
   if (((ComTdbHbaseAccess *)tdb)->listOfFetchedColNames()){
-         description += "column_retrieved: ";
-         appendListOfColumns(((ComTdbHbaseAccess 
*)tdb)->listOfFetchedColNames(),tdb,description);
+      description += "column_retrieved: ";
+      appendListOfColumns(((ComTdbHbaseAccess 
*)tdb)->listOfFetchedColNames(),tdb,description);
   }
   // get predicate pushed down in Reverse Polish Notation for the AND / OR 
operators.
   // could transform it standard notation for better readability, but good 
enough for now...
   // could also evaluate the constants instead of hard coded ?, but good 
enough for now...
   if (((ComTdbHbaseAccess *)tdb)->listOfHbaseFilterColNames()){
-         description += "pushed_down_rpn: ";
-        appendPushedDownExpression(tdb, description);
+      description += "pushed_down_rpn: ";
+     appendPushedDownExpression(tdb, description);
     }
   // get pushed down predicate
 
 
 
-/*
+  /*
   // now get columns_retrieved
   description += "columns_retrieved: ";
-  //char buf[27];
+  char buf[27];
   //sprintf(buf, "%d ", retrievedCols().entries());
   sprintf(buf, "%d ", getIndexDesc()->getIndexColumns().entries());
   description += buf;
-*/
+  */
 
   explainTuple->setDescription(description);
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f7aaa280/core/sql/generator/GenPreCode.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenPreCode.cpp 
b/core/sql/generator/GenPreCode.cpp
index 4cf0ba0..fe012b8 100644
--- a/core/sql/generator/GenPreCode.cpp
+++ b/core/sql/generator/GenPreCode.cpp
@@ -11222,7 +11222,7 @@ short HbaseAccess::extractHbaseFilterPreds(Generator * 
generator,
                                           ValueIdSet &preds, ValueIdSet 
&newExePreds)
 {
    if (CmpCommon::getDefault(HBASE_FILTER_PREDS) == DF_OFF)
-     return 0;
+       return 0;
    // cannot push preds for aligned format row
    NABoolean isAlignedFormat = 
getTableDesc()->getNATable()->isAlignedFormat(getIndexDesc());
 
@@ -11279,7 +11279,7 @@ short HbaseAccess::extractHbaseFilterPreds(Generator * 
generator,
 //  xp:=  <column>  <op>  <value-expr>
 //  xp:=  <column> is not null (no support for hbase lookup)
 //  xp:=  <column> is null (no support for hbase lookup)
-//       (xp:=<column> like <value-expr> not yet implemented)
+//    (xp:=<column> like <value-expr> not yet implemented)
 //  xp:=<xp> OR <xp> (not evaluated in isHbaseFilterPredV2, but by 
extractHbaseFilterPredV2)
 //  xp:=<xp> AND <xp>(not evaluated in isHbaseFilterPredV2, but by 
extractHbaseFilterPredV2)
 //
@@ -11289,15 +11289,16 @@ short HbaseAccess::extractHbaseFilterPreds(Generator 
* generator,
 //                            serialized: either the column doesn't need 
encoding, like
 //                                            an unsigned integer,  or the 
column
 //                                            was declared with the SERIALIZED 
option.
-//                                             it also must not be an added 
column with default non null.
+//                      it also must not be an added column with default non 
null.
 //      <op>:              eq, ne, gt, ge, lt, le
 //      <value-expr>:  an expression that only contains const or param values, 
and
 //                     <value-expr>'s datatype is not a superset of <column>'s 
datatype.
 //
+// colVID, valueID and op are output parameters.
 /////////////////////////////////////////////////////////////////////////////
 NABoolean HbaseAccess::isHbaseFilterPredV2(Generator * generator, ItemExpr * 
ie,
-                                        ValueId &colVID, ValueId &valueVID,
-                                        NAString &op)
+                     ValueId &colVID, ValueId &valueVID,
+                     NAString &op)
 {
   NABoolean foundBinary = FALSE;
   NABoolean foundUnary = FALSE;
@@ -11312,123 +11313,96 @@ NABoolean HbaseAccess::isHbaseFilterPredV2(Generator 
* generator, ItemExpr * ie,
       ItemExpr * child1 = ie->child(1)->castToItemExpr();
 
       if ((ie->child(0)->getOperatorType() == ITM_BASECOLUMN) &&
-         (NOT hasColReference(ie->child(1))))
-       {
+      (NOT hasColReference(ie->child(1))))
+    {
       foundBinary = TRUE;
-         colVID = ie->child(0)->getValueId();
-         valueVID = ie->child(1)->getValueId();
-       }
+      colVID = ie->child(0)->getValueId();
+      valueVID = ie->child(1)->getValueId();
+    }
       else if ((ie->child(1)->getOperatorType() == ITM_BASECOLUMN) &&
-              (NOT hasColReference(ie->child(0))))
-       {
+           (NOT hasColReference(ie->child(0))))
+    {
       foundBinary = TRUE;
       flipOp = TRUE;
-         colVID = ie->child(1)->getValueId();
-         valueVID = ie->child(0)->getValueId();
-       }
+      colVID = ie->child(1)->getValueId();
+      valueVID = ie->child(0)->getValueId();
+    }
       else if ((ie->child(0)->getOperatorType() == ITM_INDEXCOLUMN) &&
-              (NOT hasColReference(ie->child(1))))
-       {
+           (NOT hasColReference(ie->child(1))))
+    {
       foundBinary = TRUE;
-         colVID = ie->child(0)->getValueId();
-         valueVID = ie->child(1)->getValueId();
-       }
+      colVID = ie->child(0)->getValueId();
+      valueVID = ie->child(1)->getValueId();
+    }
       else if ((ie->child(1)->getOperatorType() == ITM_INDEXCOLUMN) &&
-              (NOT hasColReference(ie->child(0))))
-       {
-      foundBinary = TRUE;
-      flipOp = TRUE;
-         colVID = ie->child(1)->getValueId();
-         valueVID = ie->child(0)->getValueId();
-       }
-      else if ((ie->child(0)->getOperatorType() == ITM_REFERENCE) &&
-              (NOT hasColReference(ie->child(1))))
-       {
-      foundBinary = TRUE;
-         colVID = ie->child(0)->getValueId();
-         valueVID = ie->child(1)->getValueId();
-       }
-      else if ((ie->child(1)->getOperatorType() == ITM_REFERENCE) &&
-              (NOT hasColReference(ie->child(0))))
-       {
+           (NOT hasColReference(ie->child(0))))
+    {
       foundBinary = TRUE;
       flipOp = TRUE;
-         colVID = ie->child(1)->getValueId();
-         valueVID = ie->child(0)->getValueId();
-       }
+      colVID = ie->child(1)->getValueId();
+      valueVID = ie->child(0)->getValueId();
+    }
       else if ((ie->child(0)->getOperatorType() == ITM_HBASE_COLUMN_LOOKUP) &&
-              (NOT hasColReference(ie->child(1))))
-       {
-         HbaseColumnLookup * hcl = 
(HbaseColumnLookup*)ie->child(0)->castToItemExpr();
-         if (hcl->getValueId().getType().getTypeQualifier() == 
NA_CHARACTER_TYPE)
-           {
-             hbaseLookupPred = TRUE;
+           (NOT hasColReference(ie->child(1))))
+    {
+      HbaseColumnLookup * hcl = 
(HbaseColumnLookup*)ie->child(0)->castToItemExpr();
+      if (hcl->getValueId().getType().getTypeQualifier() == NA_CHARACTER_TYPE)
+        {
+          hbaseLookupPred = TRUE;
 
-             ItemExpr * newCV = new(generator->wHeap()) 
ConstValue(hcl->hbaseCol());
-             newCV = newCV->bindNode(generator->getBindWA());
-             newCV = newCV->preCodeGen(generator);
+          ItemExpr * newCV = new(generator->wHeap()) 
ConstValue(hcl->hbaseCol());
+          newCV = newCV->bindNode(generator->getBindWA());
+          newCV = newCV->preCodeGen(generator);
 
-             foundBinary = TRUE;
-             colVID = newCV->getValueId();
-             valueVID = ie->child(1)->getValueId();
-           }
-       }
+          foundBinary = TRUE;
+          colVID = newCV->getValueId();
+          valueVID = ie->child(1)->getValueId();
+        }
+    }
       else if ((ie->child(1)->getOperatorType() == ITM_HBASE_COLUMN_LOOKUP) &&
-              (NOT hasColReference(ie->child(0))))
-       {
-         HbaseColumnLookup * hcl = 
(HbaseColumnLookup*)ie->child(1)->castToItemExpr();
-         if (hcl->getValueId().getType().getTypeQualifier() == 
NA_CHARACTER_TYPE)
-           {
-             hbaseLookupPred = TRUE;
+           (NOT hasColReference(ie->child(0))))
+    {
+      HbaseColumnLookup * hcl = 
(HbaseColumnLookup*)ie->child(1)->castToItemExpr();
+      if (hcl->getValueId().getType().getTypeQualifier() == NA_CHARACTER_TYPE)
+        {
+          hbaseLookupPred = TRUE;
 
-             ItemExpr * newCV = new(generator->wHeap()) 
ConstValue(hcl->hbaseCol());
-             newCV = newCV->bindNode(generator->getBindWA());
-             newCV = newCV->preCodeGen(generator);
+          ItemExpr * newCV = new(generator->wHeap()) 
ConstValue(hcl->hbaseCol());
+          newCV = newCV->bindNode(generator->getBindWA());
+          newCV = newCV->preCodeGen(generator);
 
-             foundBinary = TRUE;
-             flipOp = TRUE;
-             colVID = newCV->getValueId();
-             valueVID = ie->child(0)->getValueId();
-           }
-       }
+          foundBinary = TRUE;
+          flipOp = TRUE;
+          colVID = newCV->getValueId();
+          valueVID = ie->child(0)->getValueId();
+        }
+    }
     }//end binary operators
   else if (ie && ((ie->getOperatorType() == 
ITM_IS_NULL)||(ie->getOperatorType() == ITM_IS_NOT_NULL))){//check for unary 
operators
-         ItemExpr * child0 = ie->child(0)->castToItemExpr();
-         if ((ie->child(0)->getOperatorType() == ITM_BASECOLUMN) ||
-                 (ie->child(0)->getOperatorType() == ITM_INDEXCOLUMN)||
-                 (ie->child(0)->getOperatorType() == ITM_REFERENCE)){
-                 foundUnary = TRUE;
-                 colVID = ie->child(0)->getValueId();
-                 valueVID = NULL_VALUE_ID;
-         }
+      ItemExpr * child0 = ie->child(0)->castToItemExpr();
+      if ((ie->child(0)->getOperatorType() == ITM_BASECOLUMN) ||
+          (ie->child(0)->getOperatorType() == ITM_INDEXCOLUMN)){
+          foundUnary = TRUE;
+          colVID = ie->child(0)->getValueId();
+          valueVID = NULL_VALUE_ID;
+      }
 
   }//end unary operators
 
   //check if found columns belong to table being scanned (so is not an input 
to the scan node)
   if (foundBinary || foundUnary){
-       ValueId dummyValueId;
-       if 
(getGroupAttr()->getCharacteristicInputs().referencesTheGivenValue(colVID,dummyValueId)){
-               foundBinary=FALSE;
-               foundUnary=FALSE;
-       }
+    ValueId dummyValueId;
+    if 
(getGroupAttr()->getCharacteristicInputs().referencesTheGivenValue(colVID,dummyValueId)){
+        foundBinary=FALSE;
+        foundUnary=FALSE;
+    }
   }
   //check if not an added column with default non null
   if ((foundBinary || foundUnary)&& (NOT hbaseLookupPred)){
-         NAColumn * nac;
-               switch (colVID.getItemExpr()->getOperatorType()){
-               case ITM_BASECOLUMN:
-                       nac = 
((BaseColumn*)colVID.getItemExpr())->getNAColumn();
-                       break;
-               case ITM_INDEXCOLUMN:
-                       nac = 
((IndexColumn*)colVID.getItemExpr())->getNAColumn();
-                       break;
-               default:
-                       break;
-               }
-               if (nac && nac->isAddedColumn() && nac->getDefaultValue()){
-                       foundBinary=FALSE;
-                       foundUnary=FALSE;
-               }
+        if (colVID.isAddedColumnWithNonNullDefault()){
+            foundBinary=FALSE;
+            foundUnary=FALSE;
+        }
   }
 
   if (foundBinary)
@@ -11438,54 +11412,54 @@ NABoolean HbaseAccess::isHbaseFilterPredV2(Generator 
* generator, ItemExpr * ie,
 
       NABoolean generateNarrow = FALSE;
       if (NOT hbaseLookupPred)
-       {
-         generateNarrow = valueType.errorsCanOccur(colType);
-         if ((generateNarrow)  || // value not a superset of column
-             (NOT columnEnabledForSerialization(colVID.getItemExpr())))
-                 foundBinary = FALSE;
-       }
+    {
+      generateNarrow = valueType.errorsCanOccur(colType);
+      if ((generateNarrow)  || // value not a superset of column
+          (NOT columnEnabledForSerialization(colVID.getItemExpr())))
+          foundBinary = FALSE;
+    }
 
       if (foundBinary)
-       {
-         if (colType.getTypeQualifier() == NA_CHARACTER_TYPE)
-           {
-             const CharType &charColType = (CharType&)colType;
-             const CharType &charValType = (CharType&)valueType;
+    {
+      if (colType.getTypeQualifier() == NA_CHARACTER_TYPE)
+        {
+          const CharType &charColType = (CharType&)colType;
+          const CharType &charValType = (CharType&)valueType;
 
-             if ((charColType.isCaseinsensitive() || 
charValType.isCaseinsensitive()) ||
-                 (charColType.isUpshifted() || charValType.isUpshifted()))
-            foundBinary = FALSE;
-           }
-         else if (colType.getTypeQualifier() == NA_NUMERIC_TYPE)
-           {
-             const NumericType &numType = (NumericType&)colType;
-             const NumericType &valType = (NumericType&)valueType;
-             if (numType.isBigNum() || valType.isBigNum())
-            foundBinary = FALSE;
-           }
-       }
+          if ((charColType.isCaseinsensitive() || 
charValType.isCaseinsensitive()) ||
+          (charColType.isUpshifted() || charValType.isUpshifted()))
+         foundBinary = FALSE;
+        }
+      else if (colType.getTypeQualifier() == NA_NUMERIC_TYPE)
+        {
+          const NumericType &numType = (NumericType&)colType;
+          const NumericType &valType = (NumericType&)valueType;
+          if (numType.isBigNum() || valType.isBigNum())
+         foundBinary = FALSE;
+        }
+    }
 
       if (foundBinary)
-       {
-         if ((ie) && (((BiRelat*)ie)->addedForLikePred()) &&
-             (valueVID.getItemExpr()->getOperatorType() == ITM_CONSTANT))
-           {
-             // remove trailing '\0' characters since this is being pushed 
down to hbase.
-             ConstValue * cv = (ConstValue*)(valueVID.getItemExpr());
-             char * cvv = (char*)cv->getConstValue();
-             Lng32 len = cv->getStorageSize() - 1;
-             while ((len > 0) && (cvv[len] == '\0'))
-               len--;
-
-             NAString newCVV(cvv, len+1);
-
-             ItemExpr * newCV = new(generator->wHeap()) ConstValue(newCVV);
-             newCV = newCV->bindNode(generator->getBindWA());
-             newCV = newCV->preCodeGen(generator);
-             valueVID = newCV->getValueId();
-           }
+    {
+      if ((ie) && (((BiRelat*)ie)->addedForLikePred()) &&
+          (valueVID.getItemExpr()->getOperatorType() == ITM_CONSTANT))
+        {
+          // remove trailing '\0' characters since this is being pushed down 
to hbase.
+          ConstValue * cv = (ConstValue*)(valueVID.getItemExpr());
+          char * cvv = (char*)cv->getConstValue();
+          Lng32 len = cv->getStorageSize() - 1;
+          while ((len > 0) && (cvv[len] == '\0'))
+            len--;
+
+          NAString newCVV(cvv, len+1);
+
+          ItemExpr * newCV = new(generator->wHeap()) ConstValue(newCVV);
+          newCV = newCV->bindNode(generator->getBindWA());
+          newCV = newCV->preCodeGen(generator);
+          valueVID = newCV->getValueId();
+        }
 
-         ItemExpr * castValue = NULL;
+      ItemExpr * castValue = NULL;
           if (NOT hbaseLookupPred)
             castValue = new(generator->wHeap()) Cast(valueVID.getItemExpr(), 
&colType);
           else
@@ -11493,237 +11467,169 @@ NABoolean 
HbaseAccess::isHbaseFilterPredV2(Generator * generator, ItemExpr * ie,
               castValue = new(generator->wHeap()) Cast(valueVID.getItemExpr(), 
&valueVID.getType());
             }
 
-         if ((NOT hbaseLookupPred) &&
-             (isEncodingNeededForSerialization(colVID.getItemExpr())))
-           {
-             castValue = new(generator->wHeap()) CompEncode
-               (castValue, FALSE, -1, CollationInfo::Sort, TRUE, FALSE);
-           }
+      if ((NOT hbaseLookupPred) &&
+          (isEncodingNeededForSerialization(colVID.getItemExpr())))
+        {
+          castValue = new(generator->wHeap()) CompEncode
+        (castValue, FALSE, -1, CollationInfo::Sort, TRUE, FALSE);
+        }
 
-         castValue = castValue->bindNode(generator->getBindWA());
-         castValue = castValue->preCodeGen(generator);
+      castValue = castValue->bindNode(generator->getBindWA());
+      castValue = castValue->preCodeGen(generator);
 
-         valueVID = castValue->getValueId();
+      valueVID = castValue->getValueId();
 
-         NAString nullType;
+      NAString nullType;
 
-         if ((colType.supportsSQLnull()) ||
-             (valueType.supportsSQLnull()))
-           {
-             nullType = "_NULL";
-           }
-         else
-           {
-             nullType = "";
-           }
+      if ((colType.supportsSQLnull()) ||
+          (valueType.supportsSQLnull()))
+        {
+          nullType = "_NULL";
+        }
+      else
+        {
+          nullType = "";
+        }
 
-         // append -NULL to the operator to signify the java code generating 
pushdown filters to handle NULL semantic logic
-         if (ie->getOperatorType() == ITM_EQUAL)
-                 op = "EQUAL"+nullType;
-         else  if (ie->getOperatorType() == ITM_NOT_EQUAL)
-           op = "NOT_EQUAL"+nullType;
-         else  if (ie->getOperatorType() == ITM_LESS){
-                 if (flipOp)
-                         op = "GREATER"+nullType;
-                 else
-                         op = "LESS"+nullType;
-         }
-         else  if (ie->getOperatorType() == ITM_LESS_EQ){
-                 if (flipOp)
-                         op = "GREATER_OR_EQUAL"+nullType;
-                 else
-                         op = "LESS_OR_EQUAL"+nullType;
-         }else  if (ie->getOperatorType() == ITM_GREATER){
-                 if (flipOp)
-                         op = "LESS"+nullType;
-                 else
-                         op = "GREATER"+nullType;
-         }else  if (ie->getOperatorType() == ITM_GREATER_EQ){
-                 if (flipOp)
-                         op = "LESS_OR_EQUAL"+nullType;
-                 else
-                         op = "GREATER_OR_EQUAL"+nullType;
-         }else
-           op = "NO_OP"+nullType;
-       }
+      // append -NULL to the operator to signify the java code generating 
pushdown filters to handle NULL semantic logic
+      if (ie->getOperatorType() == ITM_EQUAL)
+          op = "EQUAL"+nullType;
+      else  if (ie->getOperatorType() == ITM_NOT_EQUAL)
+        op = "NOT_EQUAL"+nullType;
+      else  if (ie->getOperatorType() == ITM_LESS){
+          if (flipOp)
+              op = "GREATER"+nullType;
+          else
+              op = "LESS"+nullType;
+      }
+      else  if (ie->getOperatorType() == ITM_LESS_EQ){
+          if (flipOp)
+              op = "GREATER_OR_EQUAL"+nullType;
+          else
+              op = "LESS_OR_EQUAL"+nullType;
+      }else  if (ie->getOperatorType() == ITM_GREATER){
+          if (flipOp)
+              op = "LESS"+nullType;
+          else
+              op = "GREATER"+nullType;
+      }else  if (ie->getOperatorType() == ITM_GREATER_EQ){
+          if (flipOp)
+              op = "LESS_OR_EQUAL"+nullType;
+          else
+              op = "GREATER_OR_EQUAL"+nullType;
+      }else
+        op = "NO_OP"+nullType;
+    }
     }
   if (foundUnary){
-         const NAType &colType = colVID.getType();
-         NAString nullType;
+      const NAType &colType = colVID.getType();
+      NAString nullType;
 
-         if (colType.supportsSQLnull())
-           {
-             nullType = "_NULL";
-           }
-         else
-           {
-             nullType = "";
-           }
-         if (ie->getOperatorType() == ITM_IS_NULL)
-                         op = "IS_NULL"+nullType;
-         else if (ie->getOperatorType() == ITM_IS_NOT_NULL)
-                     op = "IS_NOT_NULL"+nullType;
+      if (colType.supportsSQLnull())
+        {
+          nullType = "_NULL";
+        }
+      else
+        {
+          nullType = "";
+        }
+      if (ie->getOperatorType() == ITM_IS_NULL)
+              op = "IS_NULL"+nullType;
+      else if (ie->getOperatorType() == ITM_IS_NOT_NULL)
+              op = "IS_NOT_NULL"+nullType;
   }
 
   return foundBinary || foundUnary;
 }
 short HbaseAccess::extractHbaseFilterPredsVX(Generator * generator,
-                  ValueIdSet &preds, ValueIdSet &newExePreds){
-       //separate the code that should not belong in the recursive function
-          if (CmpCommon::getDefault(HBASE_FILTER_PREDS) == DF_OFF)
-           return 0;
-          // check if initial (version 1) implementation
-          if (CmpCommon::getDefault(HBASE_FILTER_PREDS) == DF_MINIMUM)
-           return extractHbaseFilterPreds(generator,preds,newExePreds);
-
-          // if here, we are DF_MEDIUM
-          // cannot push preds for aligned format row
-          NABoolean isAlignedFormat = 
getTableDesc()->getNATable()->isAlignedFormat(getIndexDesc());
-
-          if (isAlignedFormat)
-            return 0;
-          //recursive function call
-          opList_.insert("V2");//to instruct the java side that we are dealing 
with predicate pushdown V2 semantic, add "V2" marker
-          extractHbaseFilterPredsV2(generator,preds,newExePreds,FALSE,TRUE);
-          return 0;
+           ValueIdSet &preds, ValueIdSet &newExePreds){
+    //separate the code that should not belong in the recursive function
+       if (CmpCommon::getDefault(HBASE_FILTER_PREDS) == DF_OFF)
+        return 0;
+       // check if initial (version 1) implementation
+       if (CmpCommon::getDefault(HBASE_FILTER_PREDS) == DF_MINIMUM)
+        return extractHbaseFilterPreds(generator,preds,newExePreds);
+
+       // if here, we are DF_MEDIUM
+       // cannot push preds for aligned format row
+       NABoolean isAlignedFormat = 
getTableDesc()->getNATable()->isAlignedFormat(getIndexDesc());
+
+       if (isAlignedFormat)
+         return 0;
+       //recursive function call
+       opList_.insert("V2");//to instruct the java side that we are dealing 
with predicate pushdown V2 semantic, add "V2" marker
+       extractHbaseFilterPredsV2(generator,preds,newExePreds,FALSE);
+       return 0;
 
 }
 
 // return true if successfull push down of node
 NABoolean HbaseAccess::extractHbaseFilterPredsV2(Generator * generator,
-                                          ValueIdSet &preds, ValueIdSet 
&newExePreds, NABoolean checkOnly, NABoolean isFirstAndLayer )
+                       ValueIdSet &preds, ValueIdSet &newExePreds, NABoolean 
checkOnly)
 {
 
-       // the isFirstAndLayer is used to allow detecting top level predicate 
that can still be pushed to executor
-       int addedNode=0;
-       for (ValueId vid = preds.init();
+    // the isFirstAndLayer is used to allow detecting top level predicate that 
can still be pushed to executor
+    int addedNode=0;
+    for (ValueId vid = preds.init();
        (preds.next(vid));
        preds.advance(vid))
     {
       ItemExpr * ie = vid.getItemExpr();
 
       // if it is AND operation, recurse through left and right children
-      if (ie->getOperatorType() == ITM_AND)
-        {
+      if (ie->getOperatorType() == ITM_AND){
           ValueIdSet leftPreds;
           ValueIdSet rightPreds;
           leftPreds += ie->child(0)->castToItemExpr()->getValueId();
           rightPreds += ie->child(1)->castToItemExpr()->getValueId();
-          if (isFirstAndLayer){
-            NABoolean leftOK  = extractHbaseFilterPredsV2(generator, 
leftPreds, newExePreds,TRUE, TRUE);
-            NABoolean rightOK = extractHbaseFilterPredsV2(generator, 
rightPreds, newExePreds,TRUE, TRUE);
-            if (leftOK && rightOK){
-               if (!checkOnly){
-                                       extractHbaseFilterPredsV2(generator, 
leftPreds, newExePreds,FALSE, TRUE);//generate tree
-                                       extractHbaseFilterPredsV2(generator, 
rightPreds, newExePreds,FALSE, TRUE);//generate tree
-                                       opList_.insert("AND"); // insert an AND 
node since both side are OK to push down
-                                       if (addedNode>0)opList_.insert("AND"); 
// if it is not the first node addd to the push down, AND it with the rest
-                                       addedNode++; // we just pushed it down, 
so increase the node count pushed down.
-               }
-               if (preds.entries()==1)
-                       return TRUE;
-            } else if (leftOK){  // if only left is OK to push down
-               if(!checkOnly){
-                                       extractHbaseFilterPredsV2(generator, 
leftPreds, newExePreds,FALSE, TRUE);//generate left tree
-                                       newExePreds.insert(rightPreds); //make 
sure we add the right child to predicates that needs executor evalvaluation
-                                       if (addedNode>0)opList_.insert("AND"); 
// if it is not the first node addd to the push down, AND it with the rest
-                                       addedNode++; // we pushed down left 
side so mark it
-               }
-               if (preds.entries()==1)
-                       return TRUE;
-            } else if (rightOK){// if only right is OK to push down
-               if(!checkOnly){
-                                       extractHbaseFilterPredsV2(generator, 
rightPreds, newExePreds,FALSE, TRUE);//generate right tree
-                                       newExePreds.insert(leftPreds);//make 
sure we add the left child to predicates that needs executor evalvaluation
-                                       if (addedNode>0)opList_.insert("AND"); 
// if it is not the first node addd to the push down, AND it with the rest
-                                       addedNode++;// we pushed down right 
side so mark it
-               }
-               if (preds.entries()==1)
-                       return TRUE;
-            } else{
-               if(!checkOnly){
-                       newExePreds.insert(vid);// we pushed down nothing, make 
sure the whole node is evaluated by Executor
-               }
-               if (preds.entries()==1)
-                       return FALSE;
-
-            }
-          }
-          else{//if not first AND layer, both left and right must be pushable 
to get anything pushed
-              if(extractHbaseFilterPredsV2(generator, leftPreds, newExePreds, 
TRUE, FALSE)&&
-                 extractHbaseFilterPredsV2(generator, rightPreds, newExePreds, 
TRUE, FALSE)){// both left and right child must match
-                 if(!checkOnly){
-                                         extractHbaseFilterPredsV2(generator, 
leftPreds, newExePreds, FALSE, FALSE);//generate tree
-                                         extractHbaseFilterPredsV2(generator, 
rightPreds, newExePreds, FALSE, FALSE);//generate tree
-                                         opList_.insert("AND");
-                 }
-               if (preds.entries()==1)
-                       return TRUE;
-
+          //cannot be first AND layer, both left and right must be pushable to 
get anything pushed
+          if(extractHbaseFilterPredsV2(generator, leftPreds, newExePreds, 
TRUE)&&
+             extractHbaseFilterPredsV2(generator, rightPreds, newExePreds, 
TRUE)){// both left and right child must match
+              if(!checkOnly){
+                  extractHbaseFilterPredsV2(generator, leftPreds, newExePreds, 
FALSE);//generate tree
+                  extractHbaseFilterPredsV2(generator, rightPreds, 
newExePreds, FALSE);//generate tree
+                  opList_.insert("AND");
               }
-              else{
-                 if(!checkOnly){
-                         newExePreds.insert(vid);
-                 }
-                  if (preds.entries()==1)
-                               return FALSE;
+            if (preds.entries()==1)
+                return TRUE;
+          }
+          else{
+              if(!checkOnly){
+                  newExePreds.insert(vid);
               }
+              if (preds.entries()==1)
+                    return FALSE;
           }
           continue;
-
           // the OR case is easier, as we don t have the case of top level 
expression that can still be pushed to executor
-        }//end if AND
-        else if(ie->getOperatorType() == ITM_OR){
+      }//end if AND
+      else if(ie->getOperatorType() == ITM_OR){
           ValueIdSet leftPreds;
-                 ValueIdSet rightPreds;
-                 leftPreds += ie->child(0)->castToItemExpr()->getValueId();
-                 rightPreds += ie->child(1)->castToItemExpr()->getValueId();
-          if (isFirstAndLayer){
-            NABoolean leftOK  = extractHbaseFilterPredsV2(generator, 
leftPreds, newExePreds,TRUE, FALSE);
-            NABoolean rightOK = extractHbaseFilterPredsV2(generator, 
rightPreds, newExePreds,TRUE, FALSE);
-            if (leftOK && rightOK){
-               if (!checkOnly){
-                                       extractHbaseFilterPredsV2(generator, 
leftPreds, newExePreds,FALSE, FALSE);//generate tree
-                                       extractHbaseFilterPredsV2(generator, 
rightPreds, newExePreds,FALSE, FALSE);//generate tree
-                                       opList_.insert("OR"); // insert an OR 
node since both side are OK to push down
-                                       if (addedNode>0)opList_.insert("AND"); 
// if it is not the first node add to the push down, AND it with the rest
-                                       addedNode++; // we just pushed it down, 
so increase the node count pushed down.
-               }
-               if (preds.entries()==1)
-                       return TRUE;
-
-            } else{
-               if(!checkOnly){
-                       newExePreds.insert(vid);// we pushed down nothing, make 
sure the whole node is evaluated by Executor
-               }
-               if (preds.entries()==1)
-                       return FALSE;
-            }
-
-           }else{//if not first AND layer, both left and right must be 
pushable to get anything pushed
-                         if(extractHbaseFilterPredsV2(generator, leftPreds, 
newExePreds, TRUE, FALSE)&&
-                                extractHbaseFilterPredsV2(generator, 
rightPreds, newExePreds, TRUE, FALSE)){// both left and right child must match
-                                 if(!checkOnly){
-                                         extractHbaseFilterPredsV2(generator, 
leftPreds, newExePreds, FALSE, FALSE);//generate tree
-                                         extractHbaseFilterPredsV2(generator, 
rightPreds, newExePreds, FALSE, FALSE);//generate tree
-                                         opList_.insert("OR");
-                                 }
-                                 if (preds.entries()==1)
-                                  return TRUE;
-                         }
-                         else{// if predicate cannot be pushed down
-                                 if(!checkOnly){
-                                         newExePreds.insert(vid);
-                                 }
-                                 if (preds.entries()==1)
-                                               return FALSE;
-                         }
-            }
-
-                 continue;
-                 }//end if OR
-
-
+          ValueIdSet rightPreds;
+          leftPreds += ie->child(0)->castToItemExpr()->getValueId();
+          rightPreds += ie->child(1)->castToItemExpr()->getValueId();
+          //both left and right must be pushable to get anything pushed
+          if(extractHbaseFilterPredsV2(generator, leftPreds, newExePreds, 
TRUE)&&
+             extractHbaseFilterPredsV2(generator, rightPreds, newExePreds, 
TRUE)){// both left and right child must match
+              if(!checkOnly){
+                  extractHbaseFilterPredsV2(generator, leftPreds, newExePreds, 
FALSE);//generate tree
+                  extractHbaseFilterPredsV2(generator, rightPreds, 
newExePreds, FALSE);//generate tree
+                  opList_.insert("OR");
+                  if (addedNode>0)opList_.insert("AND"); // if it is not the 
first node add to the push down, AND it with the rest
+                  addedNode++; // we just pushed it down, so increase the node 
count pushed down.
+              }
+              if (preds.entries()==1)
+               return TRUE;
+          }
+          else{// if predicate cannot be pushed down
+              if(!checkOnly){
+                  newExePreds.insert(vid);
+              }
+              if (preds.entries()==1)
+                    return FALSE;
+          }
+          continue;
+      }//end if OR
 
       ValueId colVID;
       ValueId valueVID;
@@ -11736,15 +11642,13 @@ NABoolean 
HbaseAccess::extractHbaseFilterPredsV2(Generator * generator,
           hbaseFilterColVIDlist_.insert(colVID);
           if (valueVID != NULL_VALUE_ID) 
hbaseFilterValueVIDlist_.insert(valueVID);// don't insert valueID for unary 
operators.
           opList_.insert(op);
-          if(isFirstAndLayer){
-                       if (addedNode>0)opList_.insert("AND"); // if it is not 
the first node add to the push down, AND it with the rest
-                       addedNode++; // we just pushed it down, so increase the 
node count pushed down.
-          }
+          if (addedNode>0)opList_.insert("AND"); // if it is not the first 
node add to the push down, AND it with the rest
+          addedNode++; // we just pushed it down, so increase the node count 
pushed down.
         }else if (!checkOnly){//if not pushable, pass it for executor 
evaluation.
-               newExePreds.insert(vid);
+            newExePreds.insert(vid);
         }
       if (preds.entries()==1){
-         return isHFP; // if we are not on the first call level, where we can 
have multiple preds, exit returning the pushability
+          return isHFP; // if we are not on the first call level, where we can 
have multiple preds, exit returning the pushability
       }
 
     } // end for
@@ -11816,38 +11720,38 @@ RelExpr * HbaseAccess::preCodeGen(Generator * 
generator,
   if (! FileScan::preCodeGen(generator,externalInputs,pulledNewInputs))
     return NULL;
 
-    //compute isUnique:
-    NABoolean isUnique = FALSE;
-    if (listOfRangeRows_.entries() == 0)
-      {
-        if ((searchKey() && searchKey()->isUnique()) &&
-         (listOfUniqueRows_.entries() == 0))
-       isUnique = TRUE;
-        else if ((NOT (searchKey() && searchKey()->isUnique())) &&
-              (listOfUniqueRows_.entries() == 1) &&
-              (listOfUniqueRows_[0].rowIds_.entries() == 1))
-       isUnique = TRUE;
-      }
-
-    // executorPred() contains an ANDed list of predicates.
-    // if hbase filter preds are enabled, then extracts those preds from 
executorPred()
-    // which could be pushed down to hbase.
-    // Do this only for non-unique scan access.
-    ValueIdSet newExePreds;
-    ValueIdSet* originExePreds = new 
(generator->wHeap())ValueIdSet(executorPred()) ;//saved for futur nullable 
column check
-
-    if (CmpCommon::getDefault(HBASE_FILTER_PREDS) != DF_MINIMUM){ // the check 
for V2 and above is moved up before calculating retrieved columns
-               if ((NOT isUnique) &&
-                       (extractHbaseFilterPredsVX(generator, executorPred(), 
newExePreds)))
-                 return this;
-
-               // if some filter preds were found, then initialize executor 
preds with new exe preds.
-               // newExePreds may be empty which means that all predicates 
were changed into
-               // hbase preds. In this case, nuke existing exe preds.
-               if (hbaseFilterColVIDlist_.entries() > 0)
-                 setExecutorPredicates(newExePreds);
+  //compute isUnique:
+  NABoolean isUnique = FALSE;
+  if (listOfRangeRows_.entries() == 0)
+    {
+      if ((searchKey() && searchKey()->isUnique()) &&
+    (listOfUniqueRows_.entries() == 0))
+  isUnique = TRUE;
+      else if ((NOT (searchKey() && searchKey()->isUnique())) &&
+         (listOfUniqueRows_.entries() == 1) &&
+         (listOfUniqueRows_[0].rowIds_.entries() == 1))
+  isUnique = TRUE;
     }
 
+  // executorPred() contains an ANDed list of predicates.
+  // if hbase filter preds are enabled, then extracts those preds from 
executorPred()
+  // which could be pushed down to hbase.
+  // Do this only for non-unique scan access.
+  ValueIdSet newExePreds;
+  ValueIdSet* originExePreds = new 
(generator->wHeap())ValueIdSet(executorPred()) ;//saved for futur nullable 
column check
+
+  if (CmpCommon::getDefault(HBASE_FILTER_PREDS) != DF_MINIMUM){ // the check 
for V2 and above is moved up before calculating retrieved columns
+      if ((NOT isUnique) &&
+          (extractHbaseFilterPredsVX(generator, executorPred(), newExePreds)))
+        return this;
+
+      // if some filter preds were found, then initialize executor preds with 
new exe preds.
+      // newExePreds may be empty which means that all predicates were changed 
into
+      // hbase preds. In this case, nuke existing exe preds.
+      if (hbaseFilterColVIDlist_.entries() > 0)
+        setExecutorPredicates(newExePreds);
+  }
+
   ValueIdSet colRefSet;
 
   computeRetrievedCols();
@@ -11930,48 +11834,37 @@ RelExpr * HbaseAccess::preCodeGen(Generator * 
generator,
       //any other columns.
       if (CmpCommon::getDefault(HBASE_FILTER_PREDS) == DF_MEDIUM && 
getMdamKeyPtr() == NULL){ //only enable column retrieval optimization with 
DF_MEDIUM and not for MDAM scan
           bool needAddingNonNullableColumn = true; //assume we need to add one 
non nullable column
-                 for (ValueId vid = retColRefSet_.init();// look for each 
column in th eresult set if one match the criteria non null non added non 
nullable with default
-                                 retColRefSet_.next(vid);
-                                 retColRefSet_.advance(vid))
-                 {
-                       if (originExePreds->isNotNullable(vid)){// it is non 
nullable
-                               NAColumn * nac;
-                               switch (vid.getItemExpr()->getOperatorType()){
-                               case ITM_BASECOLUMN:
-                                       nac = 
((BaseColumn*)vid.getItemExpr())->getNAColumn();
-                                       break;
-                               case ITM_INDEXCOLUMN:
-                                       nac = 
((IndexColumn*)vid.getItemExpr())->getNAColumn();
-                                       break;
-                               default:
-                                       break;
-                               }
-                               if (nac && !(nac->isAddedColumn()  && 
nac->getDefaultValue())){//check if  added and  with default... notgood
-                                       needAddingNonNullableColumn = false; // 
we found one column meeting all criteria
-                                       break;
-                               }
-                       }
-                 }
-                 if (needAddingNonNullableColumn){ // ok now we need to add 
one key column that is not nullable
-                         bool foundAtLeastOneKeyColumnNotNullable = false;
-                         for(int i=getIndexDesc()->getIndexKey().entries()-1; 
i>=0;i--)// doing reverse search is making sure we are trying to avoid to use 
_SALT_ column
-                                                                               
                                                                 // because 
_SALT_ is physicaly the last column therefore we don't skip columns optimally 
if using _SALT_ column
-                         {
-                                 ValueId vaId = 
getIndexDesc()->getIndexKey()[i];
-                                 if ( (vaId.getItemExpr()->getOperatorType() 
== ITM_BASECOLUMN && 
!((BaseColumn*)vaId.getItemExpr())->getNAColumn()->getType()->supportsSQLnullPhysical())||
-                                                 
(vaId.getItemExpr()->getOperatorType() == ITM_INDEXCOLUMN     && 
!((IndexColumn*)vaId.getItemExpr())->getNAColumn()->getType()->supportsSQLnullPhysical())
-                                                 ){ //found good key column 
candidate?
-                                         
HbaseAccess::addReferenceFromItemExprTree(vaId.getItemExpr(),TRUE,FALSE,retColRefSet_);
 // add it
-                                         foundAtLeastOneKeyColumnNotNullable = 
true; //tag we found it
-                                         break; // no need to look further
-                                 }
-                         }
-                         if (!foundAtLeastOneKeyColumnNotNullable){//oh well, 
did not find any key column non nullable, let s add all key columns
-                                 
HbaseAccess::addColReferenceFromVIDlist(getIndexDesc()->getIndexKey(), 
retColRefSet_);
-                         }
-                 }
+          for (ValueId vid = retColRefSet_.init();// look for each column in 
th eresult set if one match the criteria non null non added non nullable with 
default
+                  retColRefSet_.next(vid);
+                  retColRefSet_.advance(vid))
+          {
+            if (originExePreds->isNotNullable(vid)){// it is non nullable
+                if (!vid.isAddedColumnWithNonNullDefault()){//check if  added 
and  with default... notgood
+                    needAddingNonNullableColumn = false; // we found one 
column meeting all criteria
+                    break;
+                }
+            }
+          }
+          if (needAddingNonNullableColumn){ // ok now we need to add one key 
column that is not nullable
+              bool foundAtLeastOneKeyColumnNotNullable = false;
+              for(int i=getIndexDesc()->getIndexKey().entries()-1; i>=0;i--)// 
doing reverse search is making sure we are trying to avoid to use _SALT_ column
+                                                                         // 
because _SALT_ is physicaly the last column therefore we don't skip columns 
optimally if using _SALT_ column
+              {
+                  ValueId vaId = getIndexDesc()->getIndexKey()[i];
+                  if ( (vaId.getItemExpr()->getOperatorType() == 
ITM_BASECOLUMN && 
!((BaseColumn*)vaId.getItemExpr())->getNAColumn()->getType()->supportsSQLnullPhysical())||
+                          (vaId.getItemExpr()->getOperatorType() == 
ITM_INDEXCOLUMN && 
!((IndexColumn*)vaId.getItemExpr())->getNAColumn()->getType()->supportsSQLnullPhysical())
+                          ){ //found good key column candidate?
+                      
HbaseAccess::addReferenceFromItemExprTree(vaId.getItemExpr(),TRUE,FALSE,retColRefSet_);
 // add it
+                      foundAtLeastOneKeyColumnNotNullable = true; //tag we 
found it
+                      break; // no need to look further
+                  }
+              }
+              if (!foundAtLeastOneKeyColumnNotNullable){//oh well, did not 
find any key column non nullable, let s add all key columns
+                  
HbaseAccess::addColReferenceFromVIDlist(getIndexDesc()->getIndexKey(), 
retColRefSet_);
+              }
+          }
       }else //end if DF_MEDIUM
-         
HbaseAccess::addColReferenceFromVIDlist(getIndexDesc()->getIndexKey(), 
retColRefSet_);
+          
HbaseAccess::addColReferenceFromVIDlist(getIndexDesc()->getIndexKey(), 
retColRefSet_);
     }
 
   if ((getMdamKeyPtr()) &&

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f7aaa280/core/sql/optimizer/RelScan.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelScan.h b/core/sql/optimizer/RelScan.h
index 45c4a53..cc69a69 100644
--- a/core/sql/optimizer/RelScan.h
+++ b/core/sql/optimizer/RelScan.h
@@ -1454,14 +1454,14 @@ public:
   short extractHbaseFilterPreds(Generator * generator, ValueIdSet &preds,
                                 ValueIdSet &newExePreds);
 
-    NABoolean isHbaseFilterPredV2(Generator * generator, ItemExpr * ie,
-                                                         ValueId &colVID, 
ValueId &valueVID,
-                                                                 NAString &op);
+  NABoolean isHbaseFilterPredV2(Generator * generator, ItemExpr * ie,
+                                ValueId &colVID, ValueId &valueVID,
+                                NAString &op);
 
-    short extractHbaseFilterPredsVX(Generator * generator,ValueIdSet &preds, 
ValueIdSet &newExePreds);
+  short extractHbaseFilterPredsVX(Generator * generator,ValueIdSet &preds, 
ValueIdSet &newExePreds);
 
-    NABoolean extractHbaseFilterPredsV2(Generator * generator, ValueIdSet 
&preds, ValueIdSet &newExePreds,
-                                                                   NABoolean 
checkOnly, NABoolean isFirstAndLayer );
+  NABoolean extractHbaseFilterPredsV2(Generator * generator, ValueIdSet 
&preds, ValueIdSet &newExePreds,
+                                      NABoolean checkOnly);
 
   NABoolean isSnapshotScanFeasible(LatestSnpSupportEnum snpNotSupported,
                                    char * tableName);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f7aaa280/core/sql/optimizer/ValueDesc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ValueDesc.cpp b/core/sql/optimizer/ValueDesc.cpp
index aa31819..891ba15 100644
--- a/core/sql/optimizer/ValueDesc.cpp
+++ b/core/sql/optimizer/ValueDesc.cpp
@@ -513,6 +513,30 @@ ValueId::getNAColumn(NABoolean okIfNotColumn) const
   return NULL;  // NT_PORT
 }
 
+
+NABoolean ValueId::isAddedColumnWithNonNullDefault() const{
+  NAColumn * nac = NULL;
+  ItemExpr *ck = getItemExpr();
+  if ( ck == NULL )
+     return FALSE;
+  switch (ck->getOperatorType()){
+  case ITM_BASECOLUMN:
+      nac = ((BaseColumn*)ck)->getNAColumn();
+      break;
+  case ITM_INDEXCOLUMN:
+      nac = ((IndexColumn*)ck)->getNAColumn();
+      break;
+  default:
+      break;
+  }
+  if (nac && nac->isAddedColumn() && nac->getDefaultValue())
+      return TRUE;
+  else
+      return FALSE;
+}
+
+
+
 // Since we *can* have an INSTANTIATE_NULL inside a VEG_REFERENCE, a loop
 // was required for the function below.
 //
@@ -3165,11 +3189,12 @@ void ValueIdSet::replaceVEGExpressions
           if (iePtr != exprId.getItemExpr())  // a replacement was done
            {
              subtractElement(exprId);        // remove existing ValueId
-             //insert new expression(s)
-             if (iePtr->getOperatorType() == ITM_AND)
-                 iePtr->convertToValueIdSet(newExpr, NULL, ITM_AND, FALSE, 
FALSE);
-             else
-                 newExpr += iePtr->getValueId(); // replace with a new one
+          //insert new expression(s)
+          if (iePtr->getOperatorType() == ITM_AND)
+              //The replacement of a RangeSpec could be an AND, convert ANDed 
predicates into additional values in newExpr.
+              iePtr->convertToValueIdSet(newExpr, NULL, ITM_AND, FALSE, FALSE);
+          else
+              newExpr += iePtr->getValueId(); // replace with a new one
            }
        }
       else // delete the ValueId of the VEGPredicate/VEGReference from the set

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f7aaa280/core/sql/optimizer/ValueDesc.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ValueDesc.h b/core/sql/optimizer/ValueDesc.h
index 50e4634..559588b 100644
--- a/core/sql/optimizer/ValueDesc.h
+++ b/core/sql/optimizer/ValueDesc.h
@@ -193,6 +193,11 @@ public:
   // get the associated base column.
   NABoolean isSaltColumn() const;
 
+  // return TRUE if I am a ValueId associated with an Index Column, or
+  // a base column , and I am an added column with a default value that is not
+  // null.
+  NABoolean isAddedColumnWithNonNullDefault() const;
+
   // ---------------------------------------------------------------------
   // change the ValueId's type to the given type
   // ---------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f7aaa280/core/sql/regress/executor/EXPECTED140
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/EXPECTED140 
b/core/sql/regress/executor/EXPECTED140
index 7af0f17..6d70ca8 100644
--- a/core/sql/regress/executor/EXPECTED140
+++ b/core/sql/regress/executor/EXPECTED140
@@ -6,11 +6,11 @@
 
 --- 1 row(s) inserted.
 >>create table t140 (uniq int not null, uniq2 int not null , a int not null, b 
 >>int not null,
-+>    c int not null, an int, bn int, cn int, d varchar(10),                   
                primary key (uniq,uniq2)) ;
++>    c int not null, an int, bn int, cn int, d varchar(10),                  
primary key (uniq,uniq2)) ;
 
 --- SQL operation complete.
 >>create table t140b (uniq int not null, uniq2 int not null , a int not null, 
 >>b int not null,
-+>    c int not null, an int, bn int, cn int, d varchar(10),                   
                primary key (uniq,uniq2)) salt using 2 partitions on 
(uniq,uniq2) ;
++>    c int not null, an int, bn int, cn int, d varchar(10),                  
primary key (uniq,uniq2)) salt using 2 partitions on (uniq,uniq2) ;
 
 --- SQL operation complete.
 >>
@@ -53,7 +53,7 @@
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212318881178144109
+PLAN_ID .................. 212319563691380188
 ROWS_OUT ................ 33
 EST_TOTAL_COST ........... 0.05
 STATEMENT ................ select a from t140 where b>500;
@@ -104,7 +104,7 @@ DESCRIPTION
   TRAF_INDEX_CREATE_OPT    ON
   SCHEMA ................. TRAFODION.SCH
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 5581172586932643718
+  ObjectUIDs ............. 364316051091596819
   select_list ............ TRAFODION.SCH.T140.A
 
 
@@ -151,7 +151,7 @@ A
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212318881179605475
+PLAN_ID .................. 212319563692704671
 ROWS_OUT ................ 33
 EST_TOTAL_COST ........... 0.05
 STATEMENT ................ select an from t140b where b<=200;
@@ -202,7 +202,7 @@ DESCRIPTION
   TRAF_INDEX_CREATE_OPT    ON
   SCHEMA ................. TRAFODION.SCH
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 5581172586932643812
+  ObjectUIDs ............. 364316051091596902
   select_list ............ TRAFODION.SCH.T140B.AN
 
 
@@ -236,7 +236,7 @@ DESCRIPTION
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212318881179745708
+PLAN_ID .................. 212319563692850447
 ROWS_OUT ................ 33
 EST_TOTAL_COST ........... 0.05
 STATEMENT ................ select an from t140 where b<=200;
@@ -287,7 +287,7 @@ DESCRIPTION
   TRAF_INDEX_CREATE_OPT    ON
   SCHEMA ................. TRAFODION.SCH
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 5581172586932643718
+  ObjectUIDs ............. 364316051091596819
   select_list ............ TRAFODION.SCH.T140.AN
 
 
@@ -332,7 +332,7 @@ AN
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212318881179866410
+PLAN_ID .................. 212319563692995878
 ROWS_OUT ................ 10
 EST_TOTAL_COST ........... 0.05
 STATEMENT ................ select an from t140 where b=200 and an is not null;
@@ -383,7 +383,7 @@ DESCRIPTION
   TRAF_INDEX_CREATE_OPT    ON
   SCHEMA ................. TRAFODION.SCH
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 5581172586932643718
+  ObjectUIDs ............. 364316051091596819
   select_list ............ TRAFODION.SCH.T140.AN
   input_variables ........ %(200)
 
@@ -426,7 +426,7 @@ AN
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212318881179985030
+PLAN_ID .................. 212319563693127204
 ROWS_OUT ................ 67
 EST_TOTAL_COST ........... 0.05
 STATEMENT ................ select an, a from t140 where b!=500;
@@ -477,7 +477,7 @@ DESCRIPTION
   TRAF_INDEX_CREATE_OPT    ON
   SCHEMA ................. TRAFODION.SCH
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 5581172586932643718
+  ObjectUIDs ............. 364316051091596819
   select_list ............ TRAFODION.SCH.T140.AN, TRAFODION.SCH.T140.A
 
 
@@ -556,7 +556,7 @@ AN
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212318881180232505
+PLAN_ID .................. 212319563693323114
 ROWS_OUT ................ 10
 EST_TOTAL_COST ........... 0.05
 STATEMENT ................ select an from t140 where bn=201 and an is not null;
@@ -607,7 +607,7 @@ DESCRIPTION
   TRAF_INDEX_CREATE_OPT    ON
   SCHEMA ................. TRAFODION.SCH
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 5581172586932643718
+  ObjectUIDs ............. 364316051091596819
   select_list ............ TRAFODION.SCH.T140.AN
   input_variables ........ %(201)
 
@@ -649,7 +649,7 @@ AN
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212318881180365492
+PLAN_ID .................. 212319563693453818
 ROWS_OUT ................ 67
 EST_TOTAL_COST ........... 0.05
 STATEMENT ................ select an, a from t140 where bn!=501;
@@ -700,7 +700,7 @@ DESCRIPTION
   TRAF_INDEX_CREATE_OPT    ON
   SCHEMA ................. TRAFODION.SCH
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 5581172586932643718
+  ObjectUIDs ............. 364316051091596819
   select_list ............ TRAFODION.SCH.T140.AN, TRAFODION.SCH.T140.A
 
 
@@ -794,7 +794,7 @@ A
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212318881180584307
+PLAN_ID .................. 212319563693669223
 ROWS_OUT ................ 11
 EST_TOTAL_COST ........... 0.05
 STATEMENT ................ select an from t140 where an between 20 and 40;
@@ -845,7 +845,7 @@ DESCRIPTION
   TRAF_INDEX_CREATE_OPT    ON
   SCHEMA ................. TRAFODION.SCH
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 5581172586932643718
+  ObjectUIDs ............. 364316051091596819
   select_list ............ TRAFODION.SCH.T140.AN
 
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f7aaa280/core/sql/regress/executor/FILTER140
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/FILTER140 
b/core/sql/regress/executor/FILTER140
index 0d32084..95a1f3f 100755
--- a/core/sql/regress/executor/FILTER140
+++ b/core/sql/regress/executor/FILTER140
@@ -39,4 +39,4 @@ s/^\([ ]*embedded_arkcmp[ ]*[\.]*\) .*/\1 removed/g
 s/^\([ ]*EST_TOTAL_COST[ ]*[\.]*\) .*/\1 removed/g
 s/^\([ ]*EST_OPER_COST[ ]*[\.]*\) .*/\1 removed/g
 s/VOLATILE_SCHEMA_MXID[0-9]*/VOLATILE_SCHEMA_00/
-" $fil
\ No newline at end of file
+" $fil

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f7aaa280/core/sql/regress/executor/TEST140
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/TEST140 
b/core/sql/regress/executor/TEST140
index 8325db8..1540522 100644
--- a/core/sql/regress/executor/TEST140
+++ b/core/sql/regress/executor/TEST140
@@ -44,14 +44,14 @@ drop table t140b;
 create table t140helper (a int not null, primary key(a));
 insert into t140helper values(1);
 create table t140 (uniq int not null, uniq2 int not null , a int not null, b 
int not null,
-    c int not null, an int, bn int, cn int, d varchar(10),                     
                primary key (uniq,uniq2)) ;
+    c int not null, an int, bn int, cn int, d varchar(10),                  
primary key (uniq,uniq2)) ;
 create table t140b (uniq int not null, uniq2 int not null , a int not null, b 
int not null,
-    c int not null, an int, bn int, cn int, d varchar(10),                     
                primary key (uniq,uniq2)) salt using 2 partitions on 
(uniq,uniq2) ;
+    c int not null, an int, bn int, cn int, d varchar(10),                  
primary key (uniq,uniq2)) salt using 2 partitions on (uniq,uniq2) ;
 
 upsert using load 
 into t140
   select  x1,x1,10*x1,100*x1,1000*x1,10*x1+1,100*x1+1, 1000*x1+1, 
'aaa'||cast(x1 as varchar(10)) 
-                
+         
   from t140helper
 transpose 0,1,2,3,4,5,6,7,8,9 as x1;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f7aaa280/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index a10a8d9..1f63cff 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -6428,14 +6428,14 @@ DefaultToken NADefaults::token(Int32 attrEnum,
          case '2':     return DF_HIGH;
          case '3':     return DF_MAXIMUM;
        }
-    // HBASE_FILTER_PREDS
-      if ((attrEnum == HBASE_FILTER_PREDS) && value.length()==1)
-    switch (*value.data()){
-      case '0': return DF_OFF;
-      case '1': return DF_MINIMUM;
-      case '2': return DF_MEDIUM;
-      // in the future add DF_HIGH and DF_MAXIMUM when we implement more 
pushdown capabilities
-    }
+      // HBASE_FILTER_PREDS
+        if ((attrEnum == HBASE_FILTER_PREDS) && value.length()==1)
+      switch (*value.data()){
+        case '0': return DF_OFF;
+        case '1': return DF_MINIMUM;
+        case '2': return DF_MEDIUM;
+        // in the future add DF_HIGH and DF_MAXIMUM when we implement more 
pushdown capabilities
+      }
     if ( attrEnum == TEMPORARY_TABLE_HASH_PARTITIONS ||
          attrEnum == MVQR_REWRITE_CANDIDATES ||
          attrEnum == MVQR_PUBLISH_TABLE_LOCATION ||
@@ -6693,13 +6693,13 @@ DefaultToken NADefaults::token(Int32 attrEnum,
       break;
 
     case HBASE_FILTER_PREDS:
-       if(tok == DF_OFF || tok == DF_ON)
-       {
-               if (tok == DF_ON)
-                       tok = DF_MINIMUM; // to keep backward compatibility
-       isValid= TRUE;
-       }
-       break;
+        if(tok == DF_OFF || tok == DF_ON)
+        {
+            if (tok == DF_ON)
+                tok = DF_MINIMUM; // to keep backward compatibility
+        isValid= TRUE;
+        }
+        break;
 
     case ROBUST_QUERY_OPTIMIZATION:
       if (tok == DF_MINIMUM || tok == DF_SYSTEM || tok == DF_MAXIMUM ||

Reply via email to