review changes from PR 1502, plus jenkins compGeneral crash fix

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

Branch: refs/heads/master
Commit: bad905922f8e4817b3dff0f1fd06f0e9f115de6f
Parents: 2167123
Author: Anoop Sharma <anoop.sha...@esgyn.com>
Authored: Fri Apr 6 17:42:24 2018 +0000
Committer: Anoop Sharma <anoop.sha...@esgyn.com>
Committed: Fri Apr 6 17:42:24 2018 +0000

----------------------------------------------------------------------
 core/sql/comexe/ComTdbExeUtil.h     | 14 +++++++++-----
 core/sql/common/NAType.h            |  4 ++--
 core/sql/executor/ExExeUtilGet.cpp  | 30 ++++++++++++++++--------------
 core/sql/optimizer/BindItemExpr.cpp |  4 ++++
 core/sql/optimizer/ValueDesc.cpp    |  2 +-
 5 files changed, 32 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/bad90592/core/sql/comexe/ComTdbExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbExeUtil.h b/core/sql/comexe/ComTdbExeUtil.h
index 9024afe..7275a15 100644
--- a/core/sql/comexe/ComTdbExeUtil.h
+++ b/core/sql/comexe/ComTdbExeUtil.h
@@ -3179,18 +3179,22 @@ struct HiveMDTablesColInfoStruct
   char hiveTableType[128];
 };
 
+#define HIVEMD_DATA_TYPE_LEN 32
+#define HIVEMD_DISPLAY_DATA_TYPE_LEN 96
+#define HIVEMD_CHARSET_LEN 40
+#define HIVEMD_DT_QUALIFIER_LEN 28
 static const ComTdbVirtTableColumnInfo hiveMDColumnsColInfo[] =
 {                                                                              
       
   { "CATALOG_NAME",          0, COM_USER_COLUMN, REC_BYTE_F_ASCII,    256, 
FALSE, SQLCHARSETCODE_UTF8,     0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
   { "SCHEMA_NAME",           1, COM_USER_COLUMN, REC_BYTE_F_ASCII,    256, 
FALSE, SQLCHARSETCODE_UTF8,     0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
   { "TABLE_NAME",            2, COM_USER_COLUMN, REC_BYTE_F_ASCII,    256, 
FALSE, SQLCHARSETCODE_UTF8,     0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},
   { "COLUMN_NAME",           3, COM_USER_COLUMN, REC_BYTE_F_ASCII,    256, 
FALSE, SQLCHARSETCODE_UTF8,     0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},
-  { "SQL_DATA_TYPE",         4, COM_USER_COLUMN, REC_BYTE_F_ASCII,     32, 
FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
+  { "SQL_DATA_TYPE",         4, COM_USER_COLUMN, REC_BYTE_F_ASCII,     
HIVEMD_DATA_TYPE_LEN, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, 
COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
   { "FS_DATA_TYPE",          5, COM_USER_COLUMN, REC_BIN32_SIGNED,      4, 
FALSE, SQLCHARSETCODE_UNKNOWN,  0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
-  { "DISPLAY_DATA_TYPE",     6, COM_USER_COLUMN, REC_BYTE_F_ASCII,     96, 
FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
-  { "HIVE_DATA_TYPE",        7, COM_USER_COLUMN, REC_BYTE_F_ASCII,     32, 
FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
+  { "DISPLAY_DATA_TYPE",     6, COM_USER_COLUMN, REC_BYTE_F_ASCII,     
HIVEMD_DISPLAY_DATA_TYPE_LEN, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 
0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
+  { "HIVE_DATA_TYPE",        7, COM_USER_COLUMN, REC_BYTE_F_ASCII,     
HIVEMD_DATA_TYPE_LEN, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, 
COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
   { "COLUMN_SIZE",           8, COM_USER_COLUMN, REC_BIN32_SIGNED,      4, 
FALSE, SQLCHARSETCODE_UNKNOWN,  0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
-  { "CHARACTER_SET",         9, COM_USER_COLUMN, REC_BYTE_F_ASCII,     40, 
FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, 
+  { "CHARACTER_SET",         9, COM_USER_COLUMN, REC_BYTE_F_ASCII,     
HIVEMD_CHARSET_LEN, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, 
COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, 
   { "COLUMN_PRECISION",     10, COM_USER_COLUMN, REC_BIN32_SIGNED,      4, 
FALSE, SQLCHARSETCODE_UNKNOWN,  0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
   { "COLUMN_SCALE",         11, COM_USER_COLUMN, REC_BIN32_SIGNED,      4, 
FALSE, SQLCHARSETCODE_UNKNOWN,  0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
   { "DT_CODE",              12, COM_USER_COLUMN, REC_BIN32_SIGNED,      4, 
FALSE, SQLCHARSETCODE_UNKNOWN,  0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},  
@@ -3199,7 +3203,7 @@ static const ComTdbVirtTableColumnInfo 
hiveMDColumnsColInfo[] =
   { "PART_COL_NUMBER",      15, COM_USER_COLUMN, REC_BIN32_SIGNED,      4, 
FALSE, SQLCHARSETCODE_UNKNOWN,  0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, 
   { "BUCKET_COL_NUMBER",    16, COM_USER_COLUMN, REC_BIN32_SIGNED,      4, 
FALSE, SQLCHARSETCODE_UNKNOWN,  0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, 
   { "SORT_COL_NUMBER",      17, COM_USER_COLUMN, REC_BIN32_SIGNED,      4, 
FALSE, SQLCHARSETCODE_UNKNOWN,  0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, 
-  { "DATETIME_QUALIFIER",   18, COM_USER_COLUMN, REC_BYTE_F_ASCII,     28, 
FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},
+  { "DATETIME_QUALIFIER",   18, COM_USER_COLUMN, REC_BYTE_F_ASCII,     
HIVEMD_DT_QUALIFIER_LEN, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, 
COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},
   { "DATETIME_START_FIELD", 19, COM_USER_COLUMN, REC_BIN32_SIGNED,      4, 
FALSE, SQLCHARSETCODE_UNKNOWN,  0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},
   { "DATETIME_END_FIELD",   20, COM_USER_COLUMN, REC_BIN32_SIGNED,      4, 
FALSE, SQLCHARSETCODE_UNKNOWN,  0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},
   { "DEFAULT_VALUE",        21, COM_USER_COLUMN, REC_BYTE_F_ASCII,    240, 
FALSE, SQLCHARSETCODE_UTF8,     0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" 
,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0},

http://git-wip-us.apache.org/repos/asf/trafodion/blob/bad90592/core/sql/common/NAType.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NAType.h b/core/sql/common/NAType.h
index 7b719a9..3fafd94 100644
--- a/core/sql/common/NAType.h
+++ b/core/sql/common/NAType.h
@@ -561,9 +561,9 @@ public:
                                  const char * displaydatatype,
                                 short displayCaseSpecific = 0);
 
-  short getMyTypeAsText(NAString * outputStr, 
+  short getMyTypeAsText(NAString * outputStr,  // output
                        NABoolean addNullability = TRUE,
-                        NABoolean addCollation = TRUE) const; // output
+                        NABoolean addCollation = TRUE) const;
 
   short getMyTypeAsHiveText(NAString * outputStr) const;  // output
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/bad90592/core/sql/executor/ExExeUtilGet.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilGet.cpp 
b/core/sql/executor/ExExeUtilGet.cpp
index 4428998..1dc3109 100644
--- a/core/sql/executor/ExExeUtilGet.cpp
+++ b/core/sql/executor/ExExeUtilGet.cpp
@@ -5837,9 +5837,11 @@ short ExExeUtilHiveMDaccessTcb::work()
             Lng32 length = -1;
             Lng32 precision = -1;
             Lng32 scale = -1;
-            char sqlType[50];
-            char displayType[100];
-            char charset[50];
+
+            // HIVEMD defines used below are defined in ComTdbExeUtil.h
+            char sqlType[HIVEMD_DATA_TYPE_LEN+1];
+            char displayType[HIVEMD_DISPLAY_DATA_TYPE_LEN+1];
+            char charset[HIVEMD_CHARSET_LEN+1];
             retcode = 
               getTypeAttrsFromHiveColType(hcd ? hcd->type_ : hpd->type_,
                                           htd->getSDs()->isOrcFile(),
@@ -5849,11 +5851,11 @@ short ExExeUtilHiveMDaccessTcb::work()
            if (retcode < 0)
              {
                 // add a warning and continue.
-               char strP[300];
-               sprintf(strP, "Datatype %s for column '%s' in table %s.%s.%s is 
not supported. This table will be ignored.", 
-                        (hcd ? hcd->type_ : hpd->type_),
-                        (hcd ? hcd->name_ : hpd->name_),
-                        hiveCat_, hiveSch_, htd->tblName_);
+               char strP[1001];
+               snprintf(strP, 1000, "Datatype %s for column '%s' in table 
%s.%s.%s is not supported. This table will be ignored.", 
+                         (hcd ? hcd->type_ : hpd->type_),
+                         (hcd ? hcd->name_ : hpd->name_),
+                         hiveCat_, hiveSch_, htd->tblName_);
                *diags << DgSqlCode(CLI_GET_METADATA_INFO_ERROR)
                       << DgString0(strP);
 
@@ -5863,20 +5865,20 @@ short ExExeUtilHiveMDaccessTcb::work()
            
             infoCol->fsDatatype = fstype;
 
-           str_cpy(infoCol->sqlDatatype, sqlType, 32, ' ');
+           str_cpy(infoCol->sqlDatatype, sqlType, HIVEMD_DATA_TYPE_LEN, ' ');
 
-           str_cpy(infoCol->displayDatatype, displayType, 96, ' ');
+           str_cpy(infoCol->displayDatatype, displayType, 
HIVEMD_DISPLAY_DATA_TYPE_LEN, ' ');
 
             str_cpy(infoCol->hiveDatatype, (hcd ? hcd->type_ : hpd->type_), 
-                    32, ' ');
+                    HIVEMD_DATA_TYPE_LEN, ' ');
 
             infoCol->colSize = length;
             infoCol->colPrecision = precision;
             infoCol->colScale = scale;
 
-            str_pad(infoCol->charSet, 40, ' ');
+            str_pad(infoCol->charSet, HIVEMD_CHARSET_LEN, ' ');
             if (strlen(charset) > 0)
-              str_cpy(infoCol->charSet, charset, 40, ' ');
+              str_cpy(infoCol->charSet, charset, HIVEMD_CHARSET_LEN, ' ');
 
            infoCol->nullable = 1;
 
@@ -5898,7 +5900,7 @@ short ExExeUtilHiveMDaccessTcb::work()
               {
                infoCol->dtCode = SQLDTCODE_DATE;
                infoCol->colScale = 0;
-               str_pad(infoCol->dtQualifier, 28, ' ');
+               str_pad(infoCol->dtQualifier, HIVEMD_DT_QUALIFIER_LEN, ' ');
                infoCol->dtStartField = 1;
                infoCol->dtEndField = 3;
               }

http://git-wip-us.apache.org/repos/asf/trafodion/blob/bad90592/core/sql/optimizer/BindItemExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindItemExpr.cpp 
b/core/sql/optimizer/BindItemExpr.cpp
index cc25f93..cf57706 100644
--- a/core/sql/optimizer/BindItemExpr.cpp
+++ b/core/sql/optimizer/BindItemExpr.cpp
@@ -8894,12 +8894,14 @@ ItemExpr *PositionFunc::bindNode(BindWA *bindWA)
       if (type3.getTypeQualifier() != NA_NUMERIC_TYPE) {
         // 4053 The third operand of a POSITION function must be numeric.
         *CmpCommon::diags() << DgSqlCode(-4053) << DgString0(getTextUpper());
+        bindWA->setErrStatus();
         return NULL;
       }
       
       if (((NumericType&)type3).getScale() != 0) {
         // 4047 The third operand of a POSITION function must have a scale of 
0.
         *CmpCommon::diags() << DgSqlCode(-4047) << DgString0(getTextUpper());
+        bindWA->setErrStatus();
         return NULL;
       }
 
@@ -8927,12 +8929,14 @@ ItemExpr *PositionFunc::bindNode(BindWA *bindWA)
       if (type4.getTypeQualifier() != NA_NUMERIC_TYPE) {
         // 4053 The third operand of a POSITION function must be numeric.
         *CmpCommon::diags() << DgSqlCode(-4053) << DgString0(getTextUpper());
+        bindWA->setErrStatus();
         return NULL;
       }
       
       if (((NumericType&)type4).getScale() != 0) {
         // 4047 The third operand of a POSITION function must have a scale of 
0.
         *CmpCommon::diags() << DgSqlCode(-4047) << DgString0(getTextUpper());
+        bindWA->setErrStatus();
         return NULL;
       }
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/bad90592/core/sql/optimizer/ValueDesc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ValueDesc.cpp b/core/sql/optimizer/ValueDesc.cpp
index a39040f..a1ed3ff 100644
--- a/core/sql/optimizer/ValueDesc.cpp
+++ b/core/sql/optimizer/ValueDesc.cpp
@@ -6394,7 +6394,7 @@ void ValueIdList::convertToTextKey(const ValueIdList& 
keyList, NAString& result)
                                                constType->getScale(),
                                                0);
 
-               char strval[100];
+               char strval[t+1];
                memset( strval, ' ', t );
 
                // Get the ASCII representation

Reply via email to