[2/3] incubator-trafodion git commit: fix review comments. (cherry picked from commit 429f42604459874a1190d833fe9ec0e3666856d7)

2017-03-13 Thread dbirdsall
fix review comments.
(cherry picked from commit 429f42604459874a1190d833fe9ec0e3666856d7)


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

Branch: refs/heads/master
Commit: aff0f4991583e6cc663dc283ab58a0750c8b7c22
Parents: b281c92
Author: Prashant Vasudev 
Authored: Sat Mar 4 12:45:36 2017 +
Committer: Prashant Vasudev 
Committed: Mon Mar 13 07:17:17 2017 +

--
 core/sql/cli/Cli.cpp| 2 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/aff0f499/core/sql/cli/Cli.cpp
--
diff --git a/core/sql/cli/Cli.cpp b/core/sql/cli/Cli.cpp
index ce40fae..27e6b1e 100644
--- a/core/sql/cli/Cli.cpp
+++ b/core/sql/cli/Cli.cpp
@@ -9717,7 +9717,7 @@ Lng32 SQLCLI_LOBcliInterface
// set parserflags to allow ghost table
currContext.setSqlParserFlags(0x1);

-   Int64 numChunks = 0;
+   Lng32 numChunks = 0;
Lng32 len;
cliRC = cliInterface->executeImmediate(query, (char*)&numChunks, &len, 
FALSE);
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/aff0f499/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
--
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp 
b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 51cbef3..a15b11c 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -7791,7 +7791,7 @@ void CmpSeabaseDDL::alterSeabaseTableAddPKeyConstraint(
   // this new primary key.
   // Do this optimization in mode_special_4 only.
   Lng32 len = 0;
-  Int64 rowCount = 0;
+  Lng32 rowCount = 0;
   NABoolean ms4 = FALSE;
   if (CmpCommon::getDefault(MODE_SPECIAL_4) == DF_ON)
 {



[2/3] incubator-trafodion git commit: fix review comments

2016-09-17 Thread liuming
fix review comments


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

Branch: refs/heads/master
Commit: 2e70db6b1b990beac4ebe4dcc73233209529b133
Parents: ba17bd3
Author: Liu Ming 
Authored: Thu Sep 15 11:22:44 2016 +
Committer: Liu Ming 
Committed: Thu Sep 15 11:22:44 2016 +

--
 core/sql/exp/exp_function.cpp| 30 +-
 core/sql/exp/exp_math_func.cpp   |  2 +-
 core/sql/optimizer/SynthType.cpp |  2 +-
 3 files changed, 11 insertions(+), 23 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e70db6b/core/sql/exp/exp_function.cpp
--
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index 21d3351..e0134de 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -45,11 +45,6 @@
 #include 
 #include 
 #include 
-/*
-#include 
-#include 
-#include 
-*/
 
 #include "NLSConversion.h"
 #include "nawstring.h"
@@ -7768,11 +7763,11 @@ static Lng32 string2ipv4(char *srcData, Lng32 slen, 
unsigned int *inet_addr)
 
if(srcData[0] == ' ')
{ 
- leadingspace++;
- for(i=1; i< slen; i++)
+ char * next = srcData;
+ while (*next == ' ')
  {
-   if(srcData[i] == ' ') leadingspace++;
-   else break; 
+   leadingspace++;
+   next++;
  }
}

@@ -7889,14 +7884,10 @@ ex_expr::exp_return_type ExFunctionInetNtoa::eval(char 
* op_data[],
Attributes *resultAttr = getOperand(0);
const unsigned char *ipv4_bytes= (const unsigned char *) &addr;
 
-   if( ipv4_bytes[0] > 255 || 
-   ipv4_bytes[1] > 255 ||
-   ipv4_bytes[2] > 255 ||
-   ipv4_bytes[3] > 255 ||
-   addr > 4294967295 )
+   if( addr > 4294967295 ) 
{
-  ExRaiseSqlError(heap, diags, EXE_INVALID_CHARACTER);
-  *(*diags) << DgString0("IP value") << DgString1("INET_NTOA FUNCTION"); 
+  ExRaiseSqlError(heap, diags, EXE_BAD_ARG_TO_MATH_FUNC);
+  *(*diags) << DgString0("INET_NTOA"); 
   return ex_expr::EXPR_ERROR;
}
 
@@ -7955,16 +7946,13 @@ ex_expr::exp_return_type ExFunctionIsIP::eval(char * 
op_data[],
 //cannot start with single :
 if (*ptr == ':')
 {
-  ++ptr;
-
-  if (*ptr != ':')
+  if (*(ptr+1) != ':')
   {
 *(Int16 *)op_data[0] = 0;
 return ex_expr::EXPR_OK;
   }
 }
-
-if (*ptr == ' ')
+else if (*ptr == ' ')
 {
   while(*ptr==' ') ptr++;
 } 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e70db6b/core/sql/exp/exp_math_func.cpp
--
diff --git a/core/sql/exp/exp_math_func.cpp b/core/sql/exp/exp_math_func.cpp
index 0ed9251..c5209fd 100644
--- a/core/sql/exp/exp_math_func.cpp
+++ b/core/sql/exp/exp_math_func.cpp
@@ -349,7 +349,7 @@ ex_expr::exp_return_type ExFunctionMath::eval(char 
*op_data[],
  return ex_expr::EXPR_ERROR;
}
   
-  *(double *)op_data[0] = MathLog2(*(double *)op_data[1], err);
+  *(double *)op_data[0] = MathLog10(*(double *)op_data[1], err);
   break;
 
 case ITM_LOG2:

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e70db6b/core/sql/optimizer/SynthType.cpp
--
diff --git a/core/sql/optimizer/SynthType.cpp b/core/sql/optimizer/SynthType.cpp
index e4ee01e..48c2c22 100644
--- a/core/sql/optimizer/SynthType.cpp
+++ b/core/sql/optimizer/SynthType.cpp
@@ -1078,7 +1078,7 @@ const NAType *BuiltinFunction::synthesizeType()
 
retType = new HEAP
  SQLVarChar(15, FALSE);
-   SQLInt(FALSE, FALSE);
+
if (typ1.supportsSQLnull())
  {
retType->setNullable(TRUE);