trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sure...@apache.org
Subject [2/3] incubator-trafodion git commit: fix issues in previous commit
Date Wed, 10 Aug 2016 00:33:25 GMT
fix issues in previous commit


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

Branch: refs/heads/master
Commit: 7ee17b2c0f6b73f663136b8aa2787bf162f56688
Parents: a1176da
Author: Liu Ming <ming.liu@esgyn.cn>
Authored: Tue Aug 9 02:17:19 2016 +0000
Committer: Liu Ming <ming.liu@esgyn.cn>
Committed: Tue Aug 9 02:17:19 2016 +0000

----------------------------------------------------------------------
 core/sql/common/CharType.cpp           |  2 ++
 core/sql/optimizer/EncodedKeyValue.cpp | 11 ++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7ee17b2c/core/sql/common/CharType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/CharType.cpp b/core/sql/common/CharType.cpp
index aa6f209..4babc92 100644
--- a/core/sql/common/CharType.cpp
+++ b/core/sql/common/CharType.cpp
@@ -1217,6 +1217,8 @@ void CharType::minMaxRepresentableValue(void* bufPtr,
   if (stringLiteral)
     {
       NABoolean isNull = FALSE;
+      //the bufPtr passed in point to the postion after null header
+      //createSQLLiteral requires the input pointer to be the begin of the buffer
       NABoolean res = createSQLLiteral((const char *) bufPtr  - getSQLnullHdrSize(), *stringLiteral,
isNull, h);
       assert(res);
     }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7ee17b2c/core/sql/optimizer/EncodedKeyValue.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/EncodedKeyValue.cpp b/core/sql/optimizer/EncodedKeyValue.cpp
index ce1fb28..c2027ed 100644
--- a/core/sql/optimizer/EncodedKeyValue.cpp
+++ b/core/sql/optimizer/EncodedKeyValue.cpp
@@ -68,10 +68,11 @@ NAString * getMinMaxValue(TrafDesc * column,
     return NULL;
   
   Lng32 buflen = type->getTotalSize();
+  Lng32 nullHdrSize = 0;
   char * buf = new char[buflen]; // deleted at the end of this method
   if (type->supportsSQLnullPhysical())
   {
-      Lng32 nullHdrSize = type->getSQLnullHdrSize();
+      nullHdrSize = type->getSQLnullHdrSize();
       for(int i = 0; i < nullHdrSize; i++)
         buf[i] = '\0';
       buflen-= nullHdrSize;
@@ -82,7 +83,7 @@ NAString * getMinMaxValue(TrafDesc * column,
     {
       // low key needed
       if (NOT key->keysDesc()->isDescending()) // ascending
-	type->minRepresentableValue(buf, &buflen, 
+	type->minRepresentableValue(buf + nullHdrSize, &buflen, 
 				    &minMaxValue,
 				    h) ;
       else
@@ -94,7 +95,7 @@ NAString * getMinMaxValue(TrafDesc * column,
 	    }
 	  else
 	    {
-	      type->maxRepresentableValue(buf, &buflen, 
+	      type->maxRepresentableValue(buf + nullHdrSize, &buflen, 
 					  &minMaxValue,
 					  h) ;
 	    }
@@ -111,12 +112,12 @@ NAString * getMinMaxValue(TrafDesc * column,
 	      nullValue = TRUE;
 	    }
 	  else
-	    type->maxRepresentableValue(buf, &buflen, 
+	    type->maxRepresentableValue(buf + nullHdrSize, &buflen, 
 					&minMaxValue,
 					h) ;
 	}
       else
-	type->minRepresentableValue(buf, &buflen, 
+	type->minRepresentableValue(buf + nullHdrSize, &buflen, 
 				    &minMaxValue,
 				    h) ;
     }


Mime
View raw message