You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by hz...@apache.org on 2017/07/03 17:31:35 UTC

[1/2] incubator-trafodion git commit: [TRAFODION-2675] Fix sqlci core dump issue.

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 3e5dd571c -> e1edb7de5


[TRAFODION-2675] Fix sqlci core dump issue.


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

Branch: refs/heads/master
Commit: 344fd865915e0f39810ad8e4b3c3c753bcb36c3d
Parents: bfd4de2
Author: Andy Yang <yo...@esgyn.cn>
Authored: Fri Jun 30 10:00:53 2017 +0800
Committer: Andy Yang <yo...@esgyn.cn>
Committed: Fri Jun 30 10:00:53 2017 +0800

----------------------------------------------------------------------
 core/sql/optimizer/HbaseSearchSpec.cpp | 61 ++++++++++++++++++-----------
 1 file changed, 38 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/344fd865/core/sql/optimizer/HbaseSearchSpec.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/HbaseSearchSpec.cpp b/core/sql/optimizer/HbaseSearchSpec.cpp
index 6202e46..66598ca 100644
--- a/core/sql/optimizer/HbaseSearchSpec.cpp
+++ b/core/sql/optimizer/HbaseSearchSpec.cpp
@@ -88,30 +88,45 @@ const NAString HbaseUniqueRows::getText() const
 //     the total length of the source and the length of each pair.
 //
 static NABoolean extractKeyValuePairs(const NAString& source, NAString& result) 
-{
-   char buf[1024];
-
-   const char* data = source.data();
-   const char* end = data + source.length();
-
-   NABoolean hasData = ( data < end);
-
-   while ( data < end ) {
-       UInt16 len = 0;
-       memcpy((char*)&len, data, sizeof(len));
-
-       memcpy(buf, data+sizeof(len), len);
-       buf[len] = NULL;
-
-       result.append(buf);
-
-       data += sizeof(len) + len;
-
-       if ( data < end )
+  {
+    UInt16 typeLen = sizeof(UInt16);
+    size_t header = 0;
+    size_t tail = source.length();
+    NABoolean hasData = ( tail > 0 );
+  
+    const char* data = source.data();
+  
+    while ( header < tail ){
+      // get the length of the string
+      size_t begin = header;
+      size_t end = begin + typeLen;
+      // error, do not have enough buffer to read
+      if ( end > tail )
+        break;
+      NAString len;
+      source.extract(begin, end-1, len);
+  
+      // get the string
+      begin = end;
+      end = begin + (*(UInt16 *)(len.data()));
+      // if the string lengh is 0, continue
+      if ( end == begin) {
+        header = end;
+        if ( header < tail )
           result.append(",");
-   }
-   return hasData;
-}
+        continue;
+      } 
+      // error, do not have enough buffer to read
+      else if ( end > tail )
+        break;
+      source.extract(begin, end-1, result);
+      header = end;
+      if ( header < tail )
+        result.append(",");
+    }
+  
+    return hasData;
+  }
 
 const NAString HbaseRangeRows::getText() const
 {


[2/2] incubator-trafodion git commit: Merge [TRAFODION-2675] Fix sqlci core dump issue. PR-1157

Posted by hz...@apache.org.
Merge [TRAFODION-2675] Fix sqlci core dump issue. PR-1157


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

Branch: refs/heads/master
Commit: e1edb7de5a5f396e5c8334954c118cbbaeccb5f1
Parents: 3e5dd57 344fd86
Author: Hans Zeller <hz...@apache.org>
Authored: Mon Jul 3 17:31:13 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Mon Jul 3 17:31:13 2017 +0000

----------------------------------------------------------------------
 core/sql/optimizer/HbaseSearchSpec.cpp | 61 ++++++++++++++++++-----------
 1 file changed, 38 insertions(+), 23 deletions(-)
----------------------------------------------------------------------