You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by li...@apache.org on 2018/08/17 14:16:45 UTC

[1/3] trafodion git commit: [TRAFODION-3175] enhance ExeCliInterface get interface to return null indicator

Repository: trafodion
Updated Branches:
  refs/heads/master 1ecac0ae7 -> 6bd356468


[TRAFODION-3175] enhance ExeCliInterface get interface to return null indicator


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

Branch: refs/heads/master
Commit: e2a4b805dbac396d9892fe696b1b60307f04ec1e
Parents: 5e8bfc7
Author: Liu Ming <ov...@sina.com>
Authored: Sat Aug 11 13:03:47 2018 +0000
Committer: Liu Ming <ov...@sina.com>
Committed: Sat Aug 11 13:03:47 2018 +0000

----------------------------------------------------------------------
 core/sql/executor/ExExeUtilCli.cpp | 58 ++++++++++++++++++++-------------
 1 file changed, 35 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/e2a4b805/core/sql/executor/ExExeUtilCli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilCli.cpp b/core/sql/executor/ExExeUtilCli.cpp
index 2a0b9e1..8a47f4d 100644
--- a/core/sql/executor/ExExeUtilCli.cpp
+++ b/core/sql/executor/ExExeUtilCli.cpp
@@ -46,6 +46,8 @@ OutputInfo::OutputInfo(Lng32 numEntries)
   : numEntries_(numEntries)
 {
   
+   ex_assert( numEntries <= MAX_OUTPUT_ENTRIES, "try to fetch more than max rows allowed");
+  
    for (Int32 i = 0; i < numEntries_; i++)
     {
       data_[i] = NULL;
@@ -108,7 +110,8 @@ void OutputInfo::dealloc(CollHeap * heap)
 {
   for (Int32 i = 0; i < numEntries_; i++)
     {
-      NADELETEBASIC(data_[i], heap);
+      if(data_[i] != NULL)
+        NADELETEBASIC(data_[i], heap);
     }
 }
 
@@ -1296,33 +1299,42 @@ short ExeCliInterface::fetchAllRows(Queue * &infoList,
 	
 	for (Int32 j = 0; j < numOutputEntries; j++)
 	{
-	  char * ptr;
+	  char * ptr, *r;
 	  Lng32   len;
           Lng32   type;
+          short nulind=0;
+          short *indaddr=&nulind;
+          short **ind;
           getAttributes(j+1, FALSE, type, len, NULL, NULL);
-	  getPtrAndLen(j+1, ptr, len);
-	  NABoolean nullTerminate = 
+	  getPtrAndLen(j+1, ptr, len, ind);
+          if( ((char*)*ind)[0] == -1 ) // NULL value
+          {
+            oi->insert(j, NULL, 0, type);
+          }
+          else
+          {
+	    NABoolean nullTerminate = 
 	    DFS2REC::is8bitCharacter(outputAttrs_[j].fsDatatype_);
 
-	  char * r = new(getHeap()) char
-	    [(varcharFormat ? SQL_VARCHAR_HDR_SIZE : 0) 
-	     + len + (nullTerminate ? 1 : 0)];
-	  if (varcharFormat)
-	  {
-	    *(short*)r = (short)len;
-	    str_cpy_all(&r[SQL_VARCHAR_HDR_SIZE], ptr, len);
-
-	    if (nullTerminate)
-	      r[SQL_VARCHAR_HDR_SIZE + len] = 0;
-	  }
-	  else
-	  {
-	    str_cpy_all(r, ptr, len);
-	    
-	    if (nullTerminate)
-	      r[len] = 0;
-	  }
-	  oi->insert(j, r, len, type);
+	    r = new(getHeap()) char
+	      [(varcharFormat ? SQL_VARCHAR_HDR_SIZE : 0) 
+	       + len + (nullTerminate ? 1 : 0)];
+	    if (varcharFormat)
+	    {
+	      *(short*)r = (short)len;
+	      str_cpy_all(&r[SQL_VARCHAR_HDR_SIZE], ptr, len);
+
+	      if (nullTerminate)
+	        r[SQL_VARCHAR_HDR_SIZE + len] = 0;
+	    }
+	    else
+	    {
+	      str_cpy_all(r, ptr, len);
+	      if (nullTerminate)
+	        r[len] = 0;
+	    }
+	    oi->insert(j, r, len, type);
+           }
 	}
 	
 	infoList->insert(oi);


[3/3] trafodion git commit: merge [TRAFODION-3175]

Posted by li...@apache.org.
merge [TRAFODION-3175] 


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

Branch: refs/heads/master
Commit: 6bd3564686850f0ac5d00dd70094e7f257a7f6e7
Parents: 1ecac0a 5ddd7bf
Author: Liu Ming <ov...@sina.com>
Authored: Fri Aug 17 10:16:16 2018 -0400
Committer: Liu Ming <ov...@sina.com>
Committed: Fri Aug 17 10:16:16 2018 -0400

----------------------------------------------------------------------
 core/sql/executor/ExExeUtilCli.cpp | 67 ++++++++++++++++++++++-----------
 1 file changed, 44 insertions(+), 23 deletions(-)
----------------------------------------------------------------------



[2/3] trafodion git commit: for not nullalble column bypass the indicator get to avoid core dump

Posted by li...@apache.org.
for not nullalble column bypass the indicator get to avoid core dump


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

Branch: refs/heads/master
Commit: 5ddd7bfc89c9230d14aeb4b61272036a9797830a
Parents: e2a4b80
Author: Liu Ming <ov...@sina.com>
Authored: Sat Aug 11 20:17:39 2018 +0000
Committer: Liu Ming <ov...@sina.com>
Committed: Sat Aug 11 20:17:39 2018 +0000

----------------------------------------------------------------------
 core/sql/executor/ExExeUtilCli.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/5ddd7bfc/core/sql/executor/ExExeUtilCli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilCli.cpp b/core/sql/executor/ExExeUtilCli.cpp
index 8a47f4d..1c827f6 100644
--- a/core/sql/executor/ExExeUtilCli.cpp
+++ b/core/sql/executor/ExExeUtilCli.cpp
@@ -1304,10 +1304,19 @@ short ExeCliInterface::fetchAllRows(Queue * &infoList,
           Lng32   type;
           short nulind=0;
           short *indaddr=&nulind;
-          short **ind;
+          short **ind=&indaddr;
           getAttributes(j+1, FALSE, type, len, NULL, NULL);
 	  getPtrAndLen(j+1, ptr, len, ind);
-          if( ((char*)*ind)[0] == -1 ) // NULL value
+          NABoolean  nullableCol = TRUE, isNullVal = FALSE;
+          if(*ind == NULL) // It is not a nullable value
+            isNullVal = FALSE; 
+          else
+          {
+            if( ((char*)*ind)[0] == -1 ) // NULL value
+              isNullVal = TRUE;
+          }
+  
+          if(isNullVal) 
           {
             oi->insert(j, NULL, 0, type);
           }