You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2016/02/08 17:41:47 UTC

[1/3] incubator-trafodion git commit: JIRA 1807, 1808, 1793

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master d4a125be9 -> 3aef62173


JIRA 1807, 1808, 1793

1807: timezone specification support in datetime values
1808: query cache bug fix with time/timestamp values with fraction
1793: get stmt with views now include schema names


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

Branch: refs/heads/master
Commit: 0c872245d5bd85446d332f684721e4d9f2fbf4b5
Parents: 7a63602
Author: Cloud User <ce...@ansharma-1.novalocal>
Authored: Fri Feb 5 18:56:45 2016 +0000
Committer: Cloud User <ce...@ansharma-1.novalocal>
Committed: Fri Feb 5 18:56:45 2016 +0000

----------------------------------------------------------------------
 core/sql/common/DateTimeType.cpp            |  69 +++-
 core/sql/common/DatetimeType.h              |   8 +-
 core/sql/executor/ExExeUtilGet.cpp          |  32 +-
 core/sql/exp/exp_clause_derived.h           |   8 +-
 core/sql/exp/exp_conv.cpp                   |  55 +--
 core/sql/exp/exp_datetime.cpp               | 456 +++++++++------------
 core/sql/exp/exp_datetime.h                 |  43 +-
 core/sql/exp/exp_function.cpp               |  16 +-
 core/sql/parser/SqlParserAux.cpp            |  18 +-
 core/sql/parser/sqlparser.y                 |   4 +-
 core/sql/regress/executor/EXPECTED022.LINUX | 488 ++++++++++++++++++++++-
 core/sql/regress/executor/TEST022           |  38 ++
 core/sql/regress/seabase/EXPECTED012        |  53 ++-
 core/sql/regress/seabase/EXPECTED013        |  40 +-
 core/sql/regress/seabase/TEST012            |  18 +
 core/sql/regress/seabase/TEST013            |  20 +-
 core/sql/sqlcomp/DefaultConstants.h         |   5 +
 core/sql/sqlcomp/QCache.cpp                 |  30 +-
 core/sql/sqlcomp/nadefaults.cpp             |   3 +
 19 files changed, 967 insertions(+), 437 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/common/DateTimeType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/DateTimeType.cpp b/core/sql/common/DateTimeType.cpp
index cda0902..771811c 100644
--- a/core/sql/common/DateTimeType.cpp
+++ b/core/sql/common/DateTimeType.cpp
@@ -41,6 +41,7 @@
 #include "NumericType.h"
 #include "str.h"
 #include "exp_clause_derived.h"
+#include "exp_datetime.h"
 
 #include <cextdecs/cextdecs.h>
 
@@ -171,6 +172,8 @@ NABoolean DatetimeType::isEncodingNeeded() const
 
 NABoolean DatetimeType::operator==(const NAType& other) const
 {
+  DatetimeType &otherDT = (DatetimeType&)other;
+
   return NAType::operator==(other) &&
     getStartField()	  == ((DatetimeType&) other).getStartField() &&
     getEndField()	  == ((DatetimeType&) other).getEndField() &&
@@ -744,7 +747,8 @@ void DatetimeType::getRepresentableValue(const char* inValueString,
   char valueString[valueStringLen];
   str_cpy_all(valueString, &inValueString[startOff], i /*length*/);
   valueString[i] = '\0';
-  DatetimeValue dtValue(valueString, getStartField(), getEndField(), fracPrec);
+  DatetimeValue dtValue(valueString, getStartField(), getEndField(), fracPrec,
+                        FALSE);
 
   assert(*bufLen >= dtValue.getValueLen() && dtValue.isValid());
   *bufLen = dtValue.getValueLen();
@@ -1399,18 +1403,69 @@ NABoolean SQLMPDatetime::isCompatible(const NAType& other, UInt32 * flags) const
 //  DatetimeValue : A datetime value
 //
 // ***********************************************************************
-
 DatetimeValue::DatetimeValue
 ( const char* strValue
 , rec_datetime_field startField
 , rec_datetime_field endField
 , UInt32& fractionPrecision   /* IN - OUT */
+, NABoolean useOldConstructor
 )
 : value_(NULL)
 , valueLen_(0)
 , startField_(startField)
 , endField_  (endField)
 {
+  if (useOldConstructor)
+    {
+      oldConstructor(strValue, startField, endField, fractionPrecision);
+      return;
+    }
+
+  char dstValue[101];
+
+  ComDiagsArea *diags = NULL;
+
+  Lng32 trueFP = 6;
+  ULng32 flags = 0;
+  flags |= CONV_NO_HADOOP_DATE_FIX;
+  short rc = 
+    ExpDatetime::convAsciiToDatetime((char*)strValue, strlen(strValue), 
+                                     dstValue, 100,
+                                     startField, endField, 
+                                     ExpDatetime::DATETIME_FORMAT_NONE,
+                                     trueFP,
+                                     NULL, &diags, flags);
+  if (rc)
+    return;
+
+  if (endField == REC_DATE_SECOND)
+    {
+      Lng32 fp = trueFP;
+      for (; fp < 6; fp++)
+        {
+          if (startField == REC_DATE_YEAR)
+            *(Lng32*)&dstValue[7] /= 10;
+          else
+            *(Lng32*)&dstValue[3] /= 10;
+        }
+    }
+  else
+    trueFP = 0;
+
+  fractionPrecision = trueFP;
+  valueLen_ = (unsigned short) DatetimeType::getStorageSize(
+		startField, endField, trueFP);
+  unsigned char *value = value_ = new unsigned char[valueLen_];
+
+  memcpy(value, dstValue, valueLen_);
+
+} // DatetimeValue::DatetimeValue ctor
+
+void DatetimeValue::oldConstructor(const char* strValue,
+                                   rec_datetime_field startField,
+                                   rec_datetime_field endField,
+                                   UInt32& fractionPrecision /* OUT */)
+{
   UInt32 saveMPPrecision = fractionPrecision;
 
   fractionPrecision = 0;
@@ -1438,12 +1493,10 @@ DatetimeValue::DatetimeValue
 		 )))
   {				      // restore original specified precision
 
-//LCOV_EXCL_START : cnu -- SQ does not support old SQLMP stuff
     if (subtype == DatetimeType::SUBTYPE_SQLMPDatetime)
     {
      fractionPrecision = saveMPPrecision;
     }
-//LCOV_EXCL_STOP : cnu
 
     return;
   }
@@ -1464,13 +1517,10 @@ DatetimeValue::DatetimeValue
 		 ,fractionPrecision   /* OUT */
 		 )))
   {				      // restore original specified precision
-
-//LCOV_EXCL_START : cnu -- SQ does not support old SQLMP stuff
     if (subtype == DatetimeType::SUBTYPE_SQLMPDatetime)
     {
      fractionPrecision = saveMPPrecision;
     }
-//LCOV_EXCL_STOP : cnu
 
     return;
   }
@@ -1485,10 +1535,8 @@ DatetimeValue::DatetimeValue
   {
     if (fractionPrecision > saveMPPrecision)
      {
-//LCOV_EXCL_START : cnu -- SQ does not support old SQLMP stuff
       fractionPrecision = saveMPPrecision;
       return;
-//LCOV_EXCL_STOP : cnu
      }
     else
     {			// adjust the fractional value based on fractional precision.
@@ -1503,8 +1551,7 @@ DatetimeValue::DatetimeValue
   //
   if (*strValue == '\0')
     setValue(startField, endField, fractionPrecision, values);
-
-} // DatetimeValue::DatetimeValue ctor
+}
 
 DatetimeValue::DatetimeValue
 ( const char* value

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/common/DatetimeType.h
----------------------------------------------------------------------
diff --git a/core/sql/common/DatetimeType.h b/core/sql/common/DatetimeType.h
index 758f95d..0a1ea26 100644
--- a/core/sql/common/DatetimeType.h
+++ b/core/sql/common/DatetimeType.h
@@ -551,11 +551,17 @@ public:
   DatetimeValue (const char* strValue,
                  rec_datetime_field startField,
                  rec_datetime_field endField,
-                 UInt32& fractionPrecision /* OUT */ );
+                 UInt32& fractionPrecision /* OUT */,
+                 NABoolean useOldConstructor);
 
   DatetimeValue (const char* value,
                  Lng32 storageSize);
 
+  void oldConstructor(const char* strValue,
+                      rec_datetime_field startField,
+                      rec_datetime_field endField,
+                      UInt32& fractionPrecision /* OUT */);
+
   // ---------------------------------------------------------------------
   // Destructor functions 
   // ---------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/executor/ExExeUtilGet.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilGet.cpp b/core/sql/executor/ExExeUtilGet.cpp
index a51bbb6..34ccc75 100644
--- a/core/sql/executor/ExExeUtilGet.cpp
+++ b/core/sql/executor/ExExeUtilGet.cpp
@@ -377,7 +377,7 @@ static const QueryString getTrafViewsInSchemaQuery[] =
 
 static const QueryString getTrafObjectsInViewQuery[] =
 {
-  {" select T.object_name from "},
+  {" select trim(T.schema_name) || '.' || trim(T.object_name) from "},
   {"   %s.\"%s\".%s VU,  %s.\"%s\".%s T "},
   {"  where VU.using_view_uid = "},
   {"     (select T2.object_uid from  %s.\"%s\".%s T2 "},
@@ -392,7 +392,7 @@ static const QueryString getTrafObjectsInViewQuery[] =
 
 static const QueryString getTrafViewsOnObjectQuery[] =
 {
-  {" select %sT.object_name %s  from "},
+  {" select trim(T.schema_name) || '.' || trim(T.object_name) from "},
   {"   %s.\"%s\".%s T "},
   {"   where T.object_uid in "},
   {"   (select using_view_uid from  %s.\"%s\".%s VU "},
@@ -1835,24 +1835,22 @@ short ExExeUtilGetMetadataInfoTcb::work()
 		  qs = getTrafViewsOnObjectQuery;
 		  sizeOfqs = sizeof(getTrafViewsOnObjectQuery);
 
-		  param_[0] = catSchValue;
-		  param_[1] = endQuote;
-		  param_[2] = cat;
-		  param_[3] = sch;
-		  param_[4] = tab;
-		  param_[5] = cat;
-		  param_[6] = sch;
-		  param_[7] = view_usage;
-		  param_[8] = cat;
-		  param_[9] = sch;
-		  param_[10] = tab;
-		  param_[11] = getMItdb().cat_;
-		  param_[12] = getMItdb().sch_;
-		  param_[13] = getMItdb().obj_;
+		  param_[0] = cat;
+		  param_[1] = sch;
+		  param_[2] = tab;
+		  param_[3] = cat;
+		  param_[4] = sch;
+		  param_[5] = view_usage;
+		  param_[6] = cat;
+		  param_[7] = sch;
+		  param_[8] = tab;
+		  param_[9] = getMItdb().cat_;
+		  param_[10] = getMItdb().sch_;
+		  param_[11] = getMItdb().obj_;
 
 		  if (getMItdb().queryType_ == ComTdbExeUtilGetMetadataInfo::VIEWS_ON_TABLE_)
 		    strcpy(ausStr, " and T1.object_type = 'BT' ");
-		  param_[14] = ausStr;
+		  param_[12] = ausStr;
 		}
 	      break;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/exp/exp_clause_derived.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_clause_derived.h b/core/sql/exp/exp_clause_derived.h
index fc6ecfe..54c7888 100644
--- a/core/sql/exp/exp_clause_derived.h
+++ b/core/sql/exp/exp_clause_derived.h
@@ -1773,7 +1773,13 @@ enum ConvDoItFlags
   //The following flag is set when performing intermediate conversions so
   //that if the conversion fails, error report would specify it as a failure
   //of an intermediate conversion.
-  CONV_INTERMEDIATE_CONVERSION = 0x0080
+  CONV_INTERMEDIATE_CONVERSION = 0x0080,
+
+  // during CAST from string to timestamp, a date value is extended with
+  // zeroed out time part. This flag, if set, disables it.
+  // Used when a TIMESTAMP literal is being created which requires the value
+  // to exactly match the specified type. 
+  CONV_NO_HADOOP_DATE_FIX  = 0x0010
 };
 
 // helper function for convDoIt and ex_conv_clause::pCodeGenerate:

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/exp/exp_conv.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_conv.cpp b/core/sql/exp/exp_conv.cpp
index 8c31efc..8bdfc06 100644
--- a/core/sql/exp/exp_conv.cpp
+++ b/core/sql/exp/exp_conv.cpp
@@ -1325,53 +1325,24 @@ ex_expr::exp_return_type convAsciiToDatetime(char *target,
   // Setup attribute for the destination.
   //
   dstOpType.setPrecision(code);
-
-  switch (code) {
-  case REC_DTCODE_DATE :
-  case REC_DTCODE_YEAR_DAY :
-    {
-    ret = dstOpType.convAsciiToDate(source,
-                                    sourceLen,
-                                    target,
-                                    targetLen,
-				    ExpDatetime::DATETIME_FORMAT_NONE,
-                                    heap,
-                                    diagsArea,
-				    flags);
-    }
-    break;
-  case REC_DTCODE_TIME :
-  case REC_DTCODE_HOUR_SECOND :
-    {
-    dstOpType.setScale(fractionPrecision);
-    ret = dstOpType.convAsciiToTime(source,
-                                    sourceLen,
-                                    target,
-                                    targetLen,
-                                    heap,
-                                    diagsArea,
-				    flags);
-    }
-    break;
-  default :
-    {
-    dstOpType.setScale(fractionPrecision);
-    ret = dstOpType.convAsciiToDatetime(source,
-                                        sourceLen,
-                                        target,
-                                        targetLen,
-                                        heap,
-                                        diagsArea,
-					flags);
-    }
-  }
-
+  dstOpType.setScale(fractionPrecision);
+
+  ret = dstOpType.convAsciiToDatetime(source,
+                                      sourceLen,
+                                      target,
+                                      targetLen,
+                                      ExpDatetime::DATETIME_FORMAT_NONE,
+                                      heap,
+                                      diagsArea,
+                                      flags);
+  
   if (ret < 0)
     return ex_expr::EXPR_ERROR;
-
+  
   return ex_expr::EXPR_OK;
   
 }
+
 // LCOV_EXCL_START
 NA_EIDPROC
 ex_expr::exp_return_type convUnicodeToDatetime(char *target,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/exp/exp_datetime.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_datetime.cpp b/core/sql/exp/exp_datetime.cpp
index 4d9207b..a1cff3c 100644
--- a/core/sql/exp/exp_datetime.cpp
+++ b/core/sql/exp/exp_datetime.cpp
@@ -73,6 +73,12 @@ Section missing, generate compiler error
 Section missing, generate compiler error
 #endif
 
+#define ptimez_h_computetimestamp
+#define ptimez_h_including_section
+#include "guardian/ptimez.h"
+#ifdef ptimez_h_computetimestamp
+Section missing, generate compiler error
+#endif
 
 // Forword declaration of static helper function.
 //
@@ -1144,7 +1150,7 @@ scaleFraction(Int32 srcFractPrec,
   // fraction value in the source, scale the fraction to the
   // destination precision.
   //
-  if (dstFractPrec > 0 && srcFractPrec > 0) {
+  if (dstFractPrec >= 0 && srcFractPrec > 0) {
 
     fraction = srcFraction;
 
@@ -1338,7 +1344,7 @@ copyDatetimeFields(rec_datetime_field startField,
   // If there is a fractional precision in the destination,
   // copy and scale the fraction from the source.
   //
-  if (endField == REC_DATE_SECOND && dstFractPrec > 0) {
+  if (endField == REC_DATE_SECOND && dstFractPrec >= 0) {
     Lng32 fraction = 0;
 
     // If there is a fraction precision in the source datetime
@@ -1746,7 +1752,7 @@ scanField(char *&src,
           char *srcEnd,
           rec_datetime_field field,
           char exptDelim,
-          short fractPrec,
+          Lng32 &fractPrec,
           Lng32 &value,
           CollHeap *heap,
           ComDiagsArea** diagsArea,
@@ -1832,6 +1838,7 @@ scanField(char *&src,
   //
   if (field == REC_DATE_FRACTION_MP) {
     value = scaleFraction(len, value, fractPrec);
+    fractPrec = len;
   }
 
   // For all but the FRACTION field, datetime fields are required to
@@ -1857,46 +1864,22 @@ scanField(char *&src,
   return TRUE;
 }
 
-// ExpDatetime::convAsciiToDatetime() ================================
-// This method is used to convert the given ASCII string to a datetime
-// value.
-//
-// The result is returned in the buffer pointed to by the parameter
-// 'dstData'.  This buffer must be allocated by the caller and it
-// must be large enough to hold the result.
-//
-// The ASCII string can be in one of three formats:
-//
-//  Default : yyyy-mm-dd hh:mm:ss.msssss
-//  USA     : mm/dd/yyyy hh:mm:ss.msssss [am|pm]
-//  European: dd.mm.yyyy hh.mm.ss.msssss
-//
-// There are some variations on the formats above:
-//   - the delimiter between the date and the time portion
-//     can be either a ' ' (space) or a ':'
-//   - the [am|pm] in the USA format is case insensitive.
-//   - any range of consectutive (YEAR to SECOND) fields may
-//     be present.
-//
-// Parsing the Date portion of a datetime is challenging since the
-// fields appear in different orders depending on the format and we do
-// not know ahead of time which one is being used.
-//
-// This method was added as part of the MP Datetime Compatibility
-// project.
-// =====================================================================
-//
 short
 ExpDatetime::convAsciiToDatetime(char *srcData,
                                  Lng32 srcLen,
                                  char *dstData,
                                  Lng32 dstLen,
+                                 rec_datetime_field dstStartField,
+                                 rec_datetime_field dstEndField,
+                                 Lng32 format,
+                                 Lng32 &scale,
                                  CollHeap *heap,
                                  ComDiagsArea** diagsArea,
 				 ULng32 flags)
 {
 
   NABoolean noDatetimeValidation = (flags & CONV_NO_DATETIME_VALIDATION) != 0;
+  NABoolean noHadoopDateFix = (flags & CONV_NO_HADOOP_DATE_FIX) != 0;
 
   // skip leading and trailing blanks and adjust srcData and srcLen
   // accordingly
@@ -1925,14 +1908,17 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
     srcLen--;
   }
 
-    char hadoopDateFix[20];
-  if (srcLen == 10)
+  char hadoopDateFix[20];
+  if ((srcLen == 10) &&
+      (NOT noHadoopDateFix))
   {
     memcpy(hadoopDateFix, srcData, 10);
     hadoopDateFix[10] = '\0';
     strcat(hadoopDateFix, " 00:00:00");
     srcLen = 19;
     srcData = hadoopDateFix;
+
+    dstEndField = REC_DATE_SECOND;
   }
 
   // Indicates if an " AM" or " PM" strings appears at the end of the
@@ -1975,23 +1961,13 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
     srcLen -= 1;
   } 
 
-  // Get the start and end fields for the destination datetime type.
-  //
-  rec_datetime_field dstStartField;
-  rec_datetime_field dstEndField;
-
-  if (getDatetimeFields(getPrecision(),
-                        dstStartField,
-                        dstEndField) != 0) {
-    return -1;
-  }
-
   char *src = srcData;
   char *srcEnd = srcData + srcLen;
 
   // Determine the format of the source string.
   //
-  Lng32 format = determineFormat(src, dstStartField, dstEndField);
+  if (format == DATETIME_FORMAT_NONE)
+    format = determineFormat(src, dstStartField, dstEndField);
   
   // If the format could not be determined, issue an error.
   //
@@ -2000,6 +1976,42 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
     return -1;
   }
 
+  // check to see if they are timezone adjustment designator
+  // as per ISO8601 datetime format.
+  // TZD is of the form: +HH:MM pr -HH:MM
+  //
+  NABoolean TZD = FALSE;
+  NABoolean isAdd = FALSE;
+  Lng32 hh = 0;
+  Lng32 mm = 0;
+  Lng32 tzdSize = strlen("+HH:MM");
+  char * tzd = NULL;
+  if ((srcLen > tzdSize) &&
+      (tzd = (srcEnd - tzdSize)) &&
+      ((tzd[0] == '+') ||
+       (tzd[0] == '-')) &&
+      (tzd[3] == ':')) {
+    hh = str_atoi(&tzd[1], strlen("HH"));
+    mm = str_atoi(&tzd[4], strlen("MM"));
+    
+    if (tzd[0] == '+')
+      isAdd = FALSE;
+    else
+      isAdd = TRUE;
+    
+    TZD = TRUE;
+    
+    srcLen -= tzdSize;
+    srcEnd -= tzdSize;
+  } // tzd specified
+
+  // if timezone is specified and end field is not DAY, return error.
+  if ((defZ || TZD) && (dstEndField == REC_DATE_DAY))
+    {
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+      return -1;
+    }
+
   //  The order of the fields for the various formats.
   //
   static const rec_datetime_field realFields[][DATETIME_MAX_NUM_FIELDS] = {
@@ -2057,6 +2069,7 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
   // Only fields the should be present are actually scanned.
   //
   Int32 field;
+  Lng32 trueScale = scale;
   for (field = 0; field < DATETIME_MAX_NUM_FIELDS; field++) {
     
     // Determine the field expected for this format.
@@ -2086,7 +2099,7 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
                      srcEnd,
                      realField,
                      delim,
-                     getScale(),
+                     trueScale,
                      datetimeValues[realField],
                      heap,
                      diagsArea,
@@ -2098,10 +2111,9 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
   }
 
   // If there are any remaining characters in the input string.
-  //
   if (src != srcEnd) {
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    return -1;
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+      return -1;
   }
 
   // Adjust the value of the hour field if an "AM" or "PM" was
@@ -2135,6 +2147,14 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
     return -1;
   }
     
+  short year = 1900;
+  char month = 1;
+  char day = 1;
+  char hour = 0;
+  char minute = 0;
+  char second = 0;
+  Lng32 fraction = 0;
+  
   // Copy the parsed values to the destination.
   //
   char *dst = dstData;
@@ -2142,21 +2162,32 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
     switch (field) {
     case REC_DATE_YEAR:
       {
-        short year = (short)datetimeValues[field];
+        year = (short)datetimeValues[field];
         str_cpy_all(dst, (char *)&year, sizeof(year));
         dst += sizeof(year);
       }
       break;
     case REC_DATE_MONTH:
+      month = (char)datetimeValues[field];
+      *dst++ = month;
+      break;
     case REC_DATE_DAY:
+      day = (char)datetimeValues[field];
+      *dst++ = day;
+      break;
     case REC_DATE_HOUR:
+      hour = (char)datetimeValues[field];
+      *dst++ = hour;
+      break;
     case REC_DATE_MINUTE:
-      *dst++ = (char)datetimeValues[field];
+      minute = (char)datetimeValues[field];
+      *dst++ = minute;
       break;
     case REC_DATE_SECOND:
-      *dst++ = (char)datetimeValues[field];
-      if (getScale()) {
-        Lng32 fraction = datetimeValues[field + 1];
+      second = (char)datetimeValues[field];
+      *dst++ = second;
+      if (scale) {
+        fraction = datetimeValues[field + 1];
         str_cpy_all(dst, (char *)&fraction, sizeof(fraction));
         dst += sizeof(fraction);
       }
@@ -2167,6 +2198,8 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
     }
   }
 
+  scale = trueScale;
+
   // Validate the date fields of the result.
   //
   if (NOT noDatetimeValidation)
@@ -2177,12 +2210,104 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
       return -1;
     };
 
+  if (TZD) {
+    // timezone specified. Compute the new datetime value.
+
+    // first, convert current datetime value to juliantimestamp
+    short timestamp[] = {
+      year, month, day, hour, minute, second, 
+      (short)(fraction / 1000), (short)(fraction % 1000)
+    };
+    
+    short error;
+    Int64 juliantimestamp = COMPUTETIMESTAMP(timestamp, &error);
+    if (error) {
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+      return -1;
+    }
+
+    Int64 msec = (hh*60L + mm) * 60L * 1000000L;
+    if (isAdd)
+      juliantimestamp += msec;
+    else
+      juliantimestamp -= msec;
+
+    INTERPRETTIMESTAMP(juliantimestamp, timestamp);
+    
+    char *dst = dstData;
+    for (field = dstStartField; field <= dstEndField ; field++) {
+      switch (field) {
+      case REC_DATE_YEAR:
+        {
+          year = timestamp[0];
+          str_cpy_all(dst, (char *)&year, sizeof(year));
+          dst += sizeof(year);
+        }
+        break;
+      case REC_DATE_MONTH:
+        month = (char) timestamp[1];
+        *dst++ = month;
+        break;
+      case REC_DATE_DAY:
+        day = (char) timestamp[2];
+        *dst++ = day;
+        break;
+      case REC_DATE_HOUR:
+        hour = (char) timestamp[3];
+        *dst++ = hour;
+        break;
+      case REC_DATE_MINUTE:
+        minute = (char) timestamp[4];
+        *dst++ = minute;
+        break;
+      case REC_DATE_SECOND:
+        second = (char) timestamp[5];
+        *dst++ = second;
+        if (scale) {
+          fraction = timestamp[6] * 1000 + timestamp[7];
+          str_cpy_all(dst, (char *)&fraction, sizeof(fraction));
+          dst += sizeof(fraction);
+        }
+        break;
+      default:
+        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+        return -1;
+      }
+    }
+    
+  } // TZD
+  
   // Success
   //
   return 0;
     
 }
 
+short
+ExpDatetime::convAsciiToDatetime(char *srcData,
+                                 Lng32 srcLen,
+                                 char *dstData,
+                                 Lng32 dstLen,
+                                 Lng32 format,
+                                 CollHeap *heap,
+                                 ComDiagsArea** diagsArea,
+				 ULng32 flags)
+{
+  rec_datetime_field dstStartField;
+  rec_datetime_field dstEndField;
+
+  if (getDatetimeFields(getPrecision(),
+                        dstStartField,
+                        dstEndField) != 0) {
+    return -1;
+  }
+
+  Lng32 scale = getScale();
+  return convAsciiToDatetime(srcData, srcLen, dstData, dstLen,
+                             dstStartField, dstEndField, format, scale,
+                             heap, diagsArea, flags);
+}
+
 NA_EIDPROC
 static NABoolean 
 convertStrToMonth(char * value, char *result)
@@ -3102,225 +3227,6 @@ ExpDatetime::convAsciiToDate(char *srcData,
   return 0;
 }
 
-// ExpDatetime::convAsciiToTime() ================================
-// This method is used to convert the given ASCII string
-// to a datetime time value.
-//
-// The result is returned in the buffer pointed to by the parameter
-// 'dstData'. This buffer must be allocated by the caller and it
-// must be large enough to hold the result.
-//
-// The ASCII string can be in one of three formats:
-//
-//  Default : hh:mm:ss.msssss
-//  USA     : hh:mm:ss.msssss [am|pm]
-//  European: hh.mm.ss.msssss
-//
-// This method is called assuming the correct source format. The source
-// string must contain time in one of above format and, possibly, leading
-// and trailing blanks only. The size of destination buffer should enough
-// to hold internal representation of the time value, i.e. 3 bytes without
-// fraction or 7 bytes with fraction.
-//
-// This method was added as part of the IMPORT performance improvement
-// project.
-// =====================================================================
-//
-short
-ExpDatetime::convAsciiToTime(char *srcData,
-                             Lng32 srcLen,
-                             char *dstData,
-                             Lng32 dstLen,
-                             CollHeap *heap,
-                             ComDiagsArea** diagsArea,
-			     ULng32 flags)
-{
-  NABoolean noDatetimeValidation = (flags & CONV_NO_DATETIME_VALIDATION) != 0;
-
-  Lng32 fraction = 0, i;
-  Lng32 usaAmPm;
-
-  if (*srcData == ' ') {
-    // skip leading blanks and adjust srcData and srcLen accordingly
-    //
-    for (i = 0; i < srcLen && *srcData == ' '; i++) {
-      srcData++;
-    }
-
-    if (i == srcLen) {
-      // string contains only blanks.
-      //
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      return -1;
-    };
-
-    srcLen -= i;
-  };
-
-  if (srcLen < 8) {
-    // string doesn't seem to contain all time fields.
-    //
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    return -1;
-  }
-
-  // the delimiters have to be the right one and consistant
-  //
-  if (!((srcData[2] == ':' && srcData[5] == ':') ||
-        (srcData[2] == '.' && srcData[5] == '.'))) {
-    // string contains invalid delimiter
-    //
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    return -1;
-  } else {
-    if (srcData[2] == ':')
-      usaAmPm = 1;  // AM/PM allowed and assume AM
-    else
-      usaAmPm = 0;
-  }
-
-  // first, the hour
-  //
-  if (isDigit8859_1(srcData[0]) && isDigit8859_1(srcData[1])) {
-#pragma nowarn(1506)   // warning elimination 
-    dstData[0] = char (srcData[0] - '0') * 10 + (srcData[1] - '0');
-#pragma warn(1506)  // warning elimination 
-  } else {
-    // string contains non-digit charecter(s)
-    //
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    return -1;
-  }
-
-  // then, the minute
-  //
-  if (isDigit8859_1(srcData[3]) && isDigit8859_1(srcData[4])) {
-#pragma nowarn(1506)   // warning elimination 
-    dstData[1] = char (srcData[3] - '0') * 10 + (srcData[4] - '0');
-#pragma warn(1506)  // warning elimination 
-  } else {
-    // string contains non-digit charecter(s)
-    //
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    return -1;
-  }
-
-  // then, the second
-  //
-  if (isDigit8859_1(srcData[6]) && isDigit8859_1(srcData[7])) {
-#pragma nowarn(1506)   // warning elimination 
-    dstData[2] = char (srcData[6] - '0') * 10 + (srcData[7] - '0');
-#pragma warn(1506)  // warning elimination 
-  } else {
-    // string contains non-digit charecter(s)
-    //
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    return -1;
-  }
-
-  // Now the fraction part, if any
-  //
-  if (srcLen > 8 && srcData[8] == '.') {
-
-    fraction = 0;
-    srcLen -= 9;
-    srcData += 9;
-
-    // The fraction part, which is maximum 6 digit long.
-    // Please note here, unlike to other field, it is ok to have the
-    // fraction part in the source string even though the target type
-    // may or may not take any. This came from the original method,
-    // convAsciiToDatetime().
-    //
-    for (i = 0; i < srcLen && i < 6 && isDigit8859_1(*srcData); i++) {
-      fraction = (fraction * 10) + (*srcData++ - '0');
-    }
-
-    // Scale the fraction, this is OK even though fraction is still 0
-    //
-    if (getScale()) {
-#pragma warning (disable : 4244)  //warning elimination
-#pragma nowarn(1506)   // warning elimination 
-      fraction = scaleFraction(i, fraction, getScale());
-#pragma warn(1506)  // warning elimination 
-#pragma warning (default : 4244)  //warning elimination
-      str_cpy_all(&dstData[3], (char *)&fraction, sizeof(fraction));
-    }
-    srcLen -= i;
-  } else {
-    srcLen -= 8;
-    srcData += 8;
-    // BEGIN 10-050208-4538 
-    // The changes are made to fix copying of junk values into
-    // fraction part of time.The destination length is more than 3
-    // if the target has fractional precision.
-     if (dstLen > 3)  // source has no fraction part but the target has
-        str_cpy_all(&dstData[3], (char *)&fraction, sizeof(fraction));
-
-    // END 10-050208-4538 
-  }
-
-  if (srcLen) {
-    // skip the trailing blanks
-    //
-    for (i = 0; i < srcLen && *srcData == ' '; i++)
-      srcData++;
-
-    srcLen -= i;
-    if (srcLen == 0)
-      ;  // Done
-    else if (2 <= srcLen && usaAmPm > 0) {
-      // now check if we see "am" or "pm" here
-      //
-      if (srcData[1] != 'm' && srcData[1] != 'M') {
-        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-        return -1;
-      }
-
-      if (srcData[0] == 'a' || srcData[0] == 'A') {
-        if (dstData[0] > 12) {
-          // the hour value can not be greater than 12
-          ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-          return -1;
-        } else if (dstData[0] == 12)
-          dstData[0] = 0;  // 12 am is 00
-      } else if (srcData[0] == 'p' || srcData[0] == 'P')
-        dstData[0] += 12;  // adjust hour value
-      else {
-        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-        return -1;
-      }
-      srcData += 2;
-      srcLen  -= 2;
-
-      // found AM/PM, the rest has to be space at most
-      for (i = 0; i < srcLen && *srcData == ' '; i++)
-        srcData++;
-      if (i < srcLen) {
-        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-        return -1;
-
-      }
-    } else {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      return -1;
-    }
-  }
-     
-  // validate time
-  //
-  if (NOT noDatetimeValidation)
-    if (dstData[0] > 23 || dstData[1] > 59 || dstData[2] > 59) {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      return -1;
-    }
-  
-  return 0;
-}
-
 // convertToAscii() ==============================================
 // This static helper function of the ExpDatetime class is used by
 // convDatetimeToASCII() to convert a numeric value to a string of the
@@ -3961,7 +3867,7 @@ short ExpDatetime::convAsciiDatetimeToASCII(char *srcData,
   ExpDatetime &tempDT = (ExpDatetime&)tempST;
   rc = 
     tempDT.convAsciiToDatetime
-    (srcData, srcLen, tempDTBuf, 12, heap, diagsArea, 0);
+    (srcData, srcLen, tempDTBuf, 12, DATETIME_FORMAT_NONE, heap, diagsArea, 0);
   if (rc)
     return rc;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/exp/exp_datetime.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_datetime.h b/core/sql/exp/exp_datetime.h
index f814105..28ec909 100644
--- a/core/sql/exp/exp_datetime.h
+++ b/core/sql/exp/exp_datetime.h
@@ -240,16 +240,28 @@ NA_EIDPROC
                         char *srcData,
                         char *dstData);
 
-NA_EIDPROC
-  short convAsciiToDatetime(char *target,
-                            Lng32 targetLen,
-                            char *source,
+
+  static short convAsciiToDatetime(char *source,
+                                   Lng32 sourceLen,
+                                   char *target,
+                                   Lng32 targetLen,
+                                   rec_datetime_field dstStartField,
+                                   rec_datetime_field dstEndField,
+                                   Lng32 format,
+                                   Lng32 &scale,
+                                   CollHeap *heap,
+                                   ComDiagsArea** diagsArea,
+                                   ULng32 flags);
+  
+  short convAsciiToDatetime(char *source,
                             Lng32 sourceLen,
+                            char *target,
+                            Lng32 targetLen,
+                            Lng32 format,
                             CollHeap *heap,
                             ComDiagsArea** diagsArea,
                             ULng32 flags);
 
-
 NA_EIDPROC
   short convAsciiToDate(char *target,
                         Lng32 targetLen,
@@ -260,27 +272,6 @@ NA_EIDPROC
                         ComDiagsArea** diagsArea,
                         ULng32 flags);
 
-
-NA_EIDPROC
-  short convAsciiToTime(char *target,
-                        Lng32 targetLen,
-                        char *source,
-                        Lng32 sourceLen,
-                        CollHeap *heap,
-                        ComDiagsArea** diagsArea,
-                        ULng32 flags);
-
-
-NA_EIDPROC
-  short convAsciiToTimestamp(char *target,
-                             Lng32 targetLen,
-                             char *source,
-                             Lng32 sourceLen,
-                             CollHeap *heap,
-                             ComDiagsArea** diagsArea,
-                             ULng32 flags);
-
-
 NA_EIDPROC
   Lng32 convDatetimeToASCII(char *srcData,
                            char *dstData,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index 402fa17..97be8c5 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -2565,14 +2565,14 @@ ex_expr::exp_return_type ex_function_dateformat::eval(char *op_data[],
 	{
 	  ExpDatetime *datetimeOpType = (ExpDatetime *) getOperand(0);
 	  if(datetimeOpType->convAsciiToDate(opData, 
-					     getOperand(1)->getLength(),
-					     result,
-					     getOperand(0)->getLength(),
-					     getDateFormat(),
-					     heap,
-					     diagsArea,
-                                	     0) < 0) {
-	
+                                             getOperand(1)->getLength(),
+                                             result,
+                                             getOperand(0)->getLength(),
+                                             getDateFormat(),
+                                             heap,
+                                             diagsArea,
+                                             0) < 0) {
+            
 	    ExRaiseFunctionSqlError(heap, diagsArea, EXE_INTERNAL_ERROR,
 				    derivedFunction(),
 				    origFunctionOperType());

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/parser/SqlParserAux.cpp
----------------------------------------------------------------------
diff --git a/core/sql/parser/SqlParserAux.cpp b/core/sql/parser/SqlParserAux.cpp
index 6044ec5..94bbc85 100644
--- a/core/sql/parser/SqlParserAux.cpp
+++ b/core/sql/parser/SqlParserAux.cpp
@@ -1228,7 +1228,8 @@ ItemExpr *literalOfDate(NAString *strptr, NABoolean noDealloc)
 {
   ItemExpr *returnValue = NULL;
   UInt32 fractionPrec;
-  DatetimeValue dtValue(*strptr, REC_DATE_YEAR, REC_DATE_DAY, fractionPrec);
+  DatetimeValue dtValue(*strptr, REC_DATE_YEAR, REC_DATE_DAY, fractionPrec,
+                        (CmpCommon::getDefault(USE_OLD_DT_CONSTRUCTOR) == DF_ON));
   if ((! dtValue.isValid()) &&
       (CmpCommon::getDefault(MARIAQUEST_PROCESS) == DF_OFF))
      *SqlParser_Diags << DgSqlCode(-3045) << DgString0(*strptr);
@@ -1249,7 +1250,8 @@ ItemExpr *literalOfTime(NAString *strptr)
 {
   ItemExpr *returnValue = NULL;
   UInt32 fractionPrec;
-  DatetimeValue dtValue(*strptr, REC_DATE_HOUR, REC_DATE_SECOND, fractionPrec);
+  DatetimeValue dtValue(*strptr, REC_DATE_HOUR, REC_DATE_SECOND, fractionPrec,
+                        (CmpCommon::getDefault(USE_OLD_DT_CONSTRUCTOR) == DF_ON));
   if ((! dtValue.isValid()) &&
       (CmpCommon::getDefault(MARIAQUEST_PROCESS) == DF_OFF))
       *SqlParser_Diags << DgSqlCode(-3046) << DgString0(*strptr);
@@ -1272,9 +1274,10 @@ ItemExpr *literalOfDateTime(NAString *strptr, DatetimeQualifier *qualifier)
   ItemExpr *returnValue = NULL;
   UInt32 fractionPrec = qualifier->getFractionPrecision();
   DatetimeValue    dtValue(*strptr,
-                          qualifier->getStartField(),
-                          qualifier->getEndField(),
-                          fractionPrec);                        // returned value
+                           qualifier->getStartField(),
+                           qualifier->getEndField(),
+                           fractionPrec,                   // returned value
+                           (CmpCommon::getDefault(USE_OLD_DT_CONSTRUCTOR) == DF_ON));
 
   DatetimeType  *dtType = DatetimeType::constructSubtype(       // This call is necessary to insure that we return
                                FALSE,                           // a standard DateTime, if possible.
@@ -1324,8 +1327,9 @@ ItemExpr *literalOfDateTime(NAString *strptr, DatetimeQualifier *qualifier)
 ItemExpr *literalOfTimestamp(NAString *strptr)
 {
   ItemExpr *returnValue = NULL;
-  UInt32 fractionPrec;
-  DatetimeValue dtValue(*strptr, REC_DATE_YEAR, REC_DATE_SECOND, fractionPrec);
+  UInt32 fractionPrec = 0;
+  DatetimeValue dtValue(*strptr, REC_DATE_YEAR, REC_DATE_SECOND, fractionPrec,
+                        (CmpCommon::getDefault(USE_OLD_DT_CONSTRUCTOR) == DF_ON));
   if ((! dtValue.isValid()) &&
       (CmpCommon::getDefault(MARIAQUEST_PROCESS) == DF_OFF))
      *SqlParser_Diags << DgSqlCode(-3047) << DgString0(*strptr);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/parser/sqlparser.y
----------------------------------------------------------------------
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index e709a93..b158446 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -17069,7 +17069,7 @@ maintain_object_option : TOK_ALL
 			    if (fromStr)
 			      {
 				from = 
-				  new (PARSERHEAP()) DatetimeValue(fromStr, REC_DATE_YEAR, REC_DATE_SECOND, fractionPrec1);
+				  new (PARSERHEAP()) DatetimeValue(fromStr, REC_DATE_YEAR, REC_DATE_SECOND, fractionPrec1, FALSE);
 			      }
 
 			    if (toStr && (forVal > 0))
@@ -17078,7 +17078,7 @@ maintain_object_option : TOK_ALL
 			    if (toStr)
 			      {
 				to = 
-				  new (PARSERHEAP()) DatetimeValue(toStr, REC_DATE_YEAR, REC_DATE_SECOND, fractionPrec2);
+				  new (PARSERHEAP()) DatetimeValue(toStr, REC_DATE_YEAR, REC_DATE_SECOND, fractionPrec2, FALSE);
 			      }
 
 			    if ((from && (! from->isValid())) ||

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/regress/executor/EXPECTED022.LINUX
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/EXPECTED022.LINUX b/core/sql/regress/executor/EXPECTED022.LINUX
index 32f5e14..87d8312 100755
--- a/core/sql/regress/executor/EXPECTED022.LINUX
+++ b/core/sql/regress/executor/EXPECTED022.LINUX
@@ -551,6 +551,248 @@
 2015-05-31 10:11:12
 
 --- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12-05:00' from t022t1;
+
+(EXPR)             
+-------------------
+
+2015-05-31 15:11:12
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12+05:00' from t022t1;
+
+(EXPR)             
+-------------------
+
+2015-05-31 05:11:12
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12.123-05:00' from t022t1;
+
+(EXPR)                 
+-----------------------
+
+2015-05-31 15:11:12.123
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12.123+05:00' from t022t1;
+
+(EXPR)                 
+-----------------------
+
+2015-05-31 05:11:12.123
+
+--- 1 row(s) selected.
+>>
+>>select cast('2015-05-31T10:11:12' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 10:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12Z' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 10:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12-05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 15:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12+05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 05:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12.123-05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 15:11:12.123000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12.123+05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 05:11:12.123000
+
+--- 1 row(s) selected.
+>>
+>>select time '10:11:12' from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12Z' from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12-05:00' from t022t1;
+
+(EXPR)  
+--------
+
+15:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12+05:00' from t022t1;
+
+(EXPR)  
+--------
+
+05:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12.123-05:00' from t022t1;
+
+(EXPR)      
+------------
+
+15:11:12.123
+
+--- 1 row(s) selected.
+>>select time '10:11:12.123+05:00' from t022t1;
+
+(EXPR)      
+------------
+
+05:11:12.123
+
+--- 1 row(s) selected.
+>>
+>>select cast('10:11:12' as time) from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12Z' as time) from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12-05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+15:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12+05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+05:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12.123-05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+15:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12.123+05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+05:11:12
+
+--- 1 row(s) selected.
+>>
+>>select time '23:11:06.123' from t022t1;
+
+(EXPR)      
+------------
+
+23:11:06.123
+
+--- 1 row(s) selected.
+>>select cast ('23:11:06.123' as time(2)) from t022t1;
+
+(EXPR)     
+-----------
+
+23:11:06.12
+
+--- 1 row(s) selected.
+>>
+>>-- negative cases
+>>select cast('2016-01-29Z' as date) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select cast('2016-01-29+05:00' as date) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select cast('10:11:12-05:000' as time) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select date '2016-01-29Z' from t022t1;
+
+*** ERROR[3045] The date '2016-01-29Z' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select date '2016-01-29+05:00' from t022t1;
+
+*** ERROR[3045] The date '2016-01-29+05:00' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select time '25:11:11' from t022t1;
+
+*** ERROR[3046] The time '25:11:11' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select time '23:11:11.1234567' from t022t1;
+
+*** ERROR[3046] The time '23:11:11.1234567' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select cast ('23:11:61' as time) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
 >>
 >>-- Prove these cases work since they're used in the succeeding negative tests.
 >>
@@ -3926,7 +4168,7 @@ Hello
 (EXPR)         (EXPR)         (EXPR)                    
 -------------  -------------  --------------------------
 
-10:13:14.0000  10:13:14.0000  2015-05-31 18:36:57.294491
+10:13:14.0000  10:13:14.0000  2016-02-03 06:33:46.601880
 
 --- 1 row(s) selected.
 >>--test on precision of time
@@ -4991,6 +5233,248 @@ lkjihgfedc  ?                               ?
 2015-05-31 10:11:12
 
 --- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12-05:00' from t022t1;
+
+(EXPR)             
+-------------------
+
+2015-05-31 15:11:12
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12+05:00' from t022t1;
+
+(EXPR)             
+-------------------
+
+2015-05-31 05:11:12
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12.123-05:00' from t022t1;
+
+(EXPR)                 
+-----------------------
+
+2015-05-31 15:11:12.123
+
+--- 1 row(s) selected.
+>>select timestamp '2015-05-31T10:11:12.123+05:00' from t022t1;
+
+(EXPR)                 
+-----------------------
+
+2015-05-31 05:11:12.123
+
+--- 1 row(s) selected.
+>>
+>>select cast('2015-05-31T10:11:12' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 10:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12Z' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 10:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12-05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 15:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12+05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 05:11:12.000000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12.123-05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 15:11:12.123000
+
+--- 1 row(s) selected.
+>>select cast('2015-05-31T10:11:12.123+05:00' as timestamp) from t022t1;
+
+(EXPR)                    
+--------------------------
+
+2015-05-31 05:11:12.123000
+
+--- 1 row(s) selected.
+>>
+>>select time '10:11:12' from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12Z' from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12-05:00' from t022t1;
+
+(EXPR)  
+--------
+
+15:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12+05:00' from t022t1;
+
+(EXPR)  
+--------
+
+05:11:12
+
+--- 1 row(s) selected.
+>>select time '10:11:12.123-05:00' from t022t1;
+
+(EXPR)      
+------------
+
+15:11:12.123
+
+--- 1 row(s) selected.
+>>select time '10:11:12.123+05:00' from t022t1;
+
+(EXPR)      
+------------
+
+05:11:12.123
+
+--- 1 row(s) selected.
+>>
+>>select cast('10:11:12' as time) from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12Z' as time) from t022t1;
+
+(EXPR)  
+--------
+
+10:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12-05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+15:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12+05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+05:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12.123-05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+15:11:12
+
+--- 1 row(s) selected.
+>>select cast('10:11:12.123+05:00' as time) from t022t1;
+
+(EXPR)  
+--------
+
+05:11:12
+
+--- 1 row(s) selected.
+>>
+>>select time '23:11:06.123' from t022t1;
+
+(EXPR)      
+------------
+
+23:11:06.123
+
+--- 1 row(s) selected.
+>>select cast ('23:11:06.123' as time(2)) from t022t1;
+
+(EXPR)     
+-----------
+
+23:11:06.12
+
+--- 1 row(s) selected.
+>>
+>>-- negative cases
+>>select cast('2016-01-29Z' as date) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select cast('2016-01-29+05:00' as date) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select cast('10:11:12-05:000' as time) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
+>>select date '2016-01-29Z' from t022t1;
+
+*** ERROR[3045] The date '2016-01-29Z' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select date '2016-01-29+05:00' from t022t1;
+
+*** ERROR[3045] The date '2016-01-29+05:00' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select time '25:11:11' from t022t1;
+
+*** ERROR[3046] The time '25:11:11' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select time '23:11:11.1234567' from t022t1;
+
+*** ERROR[3046] The time '23:11:11.1234567' is not valid.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>select cast ('23:11:61' as time) from t022t1;
+
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+
+--- 0 row(s) selected.
 >>
 >>-- Prove these cases work since they're used in the succeeding negative tests.
 >>
@@ -8366,7 +8850,7 @@ Hello
 (EXPR)         (EXPR)         (EXPR)                    
 -------------  -------------  --------------------------
 
-10:13:14.0000  10:13:14.0000  2015-05-31 18:39:19.247095
+10:13:14.0000  10:13:14.0000  2016-02-03 06:36:01.915955
 
 --- 1 row(s) selected.
 >>--test on precision of time

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/regress/executor/TEST022
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/TEST022 b/core/sql/regress/executor/TEST022
index 1e34996..e82f0cb 100755
--- a/core/sql/regress/executor/TEST022
+++ b/core/sql/regress/executor/TEST022
@@ -191,6 +191,44 @@ select time'12:00:00 am' - interval'1'second from t022t1;
 
 select timestamp '2015-05-31T10:11:12' from t022t1;
 select timestamp '2015-05-31T10:11:12Z' from t022t1;
+select timestamp '2015-05-31T10:11:12-05:00' from t022t1;
+select timestamp '2015-05-31T10:11:12+05:00' from t022t1;
+select timestamp '2015-05-31T10:11:12.123-05:00' from t022t1;
+select timestamp '2015-05-31T10:11:12.123+05:00' from t022t1;
+
+select cast('2015-05-31T10:11:12' as timestamp) from t022t1;
+select cast('2015-05-31T10:11:12Z' as timestamp) from t022t1;
+select cast('2015-05-31T10:11:12-05:00' as timestamp) from t022t1;
+select cast('2015-05-31T10:11:12+05:00' as timestamp) from t022t1;
+select cast('2015-05-31T10:11:12.123-05:00' as timestamp) from t022t1;
+select cast('2015-05-31T10:11:12.123+05:00' as timestamp) from t022t1;
+
+select time '10:11:12' from t022t1;
+select time '10:11:12Z' from t022t1;
+select time '10:11:12-05:00' from t022t1;
+select time '10:11:12+05:00' from t022t1;
+select time '10:11:12.123-05:00' from t022t1;
+select time '10:11:12.123+05:00' from t022t1;
+
+select cast('10:11:12' as time) from t022t1;
+select cast('10:11:12Z' as time) from t022t1;
+select cast('10:11:12-05:00' as time) from t022t1;
+select cast('10:11:12+05:00' as time) from t022t1;
+select cast('10:11:12.123-05:00' as time) from t022t1;
+select cast('10:11:12.123+05:00' as time) from t022t1;
+
+select time '23:11:06.123' from t022t1;
+select cast ('23:11:06.123' as time(2)) from t022t1;
+
+-- negative cases
+select cast('2016-01-29Z' as date) from t022t1;
+select cast('2016-01-29+05:00' as date) from t022t1;
+select cast('10:11:12-05:000' as time) from t022t1;
+select date '2016-01-29Z' from t022t1;
+select date '2016-01-29+05:00' from t022t1;
+select time '25:11:11' from t022t1;
+select time '23:11:11.1234567' from t022t1;
+select cast ('23:11:61' as time) from t022t1;
 
 -- Prove these cases work since they're used in the succeeding negative tests.
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/regress/seabase/EXPECTED012
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED012 b/core/sql/regress/seabase/EXPECTED012
index bb75a11..e4ba376 100644
--- a/core/sql/regress/seabase/EXPECTED012
+++ b/core/sql/regress/seabase/EXPECTED012
@@ -41,7 +41,7 @@
 >>invoke t012t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T012T1
--- Definition current  Thu Nov 20 07:44:05 2014
+-- Definition current  Fri Feb  5 15:58:51 2016
 
   (
     A                                SMALLINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -64,7 +64,7 @@
 >>invoke t012v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T012V1
--- Definition current  Thu Nov 20 07:44:08 2014
+-- Definition current  Fri Feb  5 15:58:54 2016
 
   (
     A                                SMALLINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -321,6 +321,55 @@ T012T11V1
 
 --- SQL operation complete.
 >>
+>>obey TEST012(getStmts);
+>>create schema trafodion.zschema1;
+
+--- SQL operation complete.
+>>create schema trafodion.zschema2;
+
+--- SQL operation complete.
+>>create table zschema1.t (a int);
+
+--- SQL operation complete.
+>>create table zschema2.t (a int);
+
+--- SQL operation complete.
+>>create view zschema1.v as select zschema1.t.a a, zschema2.t.a b 
++>   from zschema1.t, zschema2.t;
+
+--- SQL operation complete.
+>>create view zschema2.v as select zschema1.t.a a, zschema2.t.a b 
++>   from zschema1.t, zschema2.t;
+
+--- SQL operation complete.
+>>get tables in view zschema1.v;
+
+Tables in View ZSCHEMA1.V
+=========================
+
+ZSCHEMA1.T
+ZSCHEMA2.T
+
+--- SQL operation complete.
+>>get views on table zschema1.t;
+
+Views on Table ZSCHEMA1.T
+=========================
+
+ZSCHEMA1.V
+ZSCHEMA2.V
+
+--- SQL operation complete.
+>>drop schema zschema1 cascade;
+
+--- SQL operation complete.
+>>drop schema zschema2 cascade;
+
+--- SQL operation complete.
+>>
+>>
+>>
+>>
 >>
 >>
 >>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/regress/seabase/EXPECTED013
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED013 b/core/sql/regress/seabase/EXPECTED013
index a1eaf32..fd2d30f 100644
--- a/core/sql/regress/seabase/EXPECTED013
+++ b/core/sql/regress/seabase/EXPECTED013
@@ -38,16 +38,16 @@
 --- SQL operation complete.
 >>
 >>insert into date8 values
-+>(date '01-02-2013', 1),
-+>(date '02-02-2013', 2),
-+>(date '03-02-2013', 3),
-+>(date '04-02-2013', 4),
-+>(date '05-02-2013', 5),
-+>(date '06-02-2013', 6),
-+>(date '07-02-2013', 7),
-+>(date '08-02-2013' ,8),
-+>(date '09-02-2013', 9),
-+>(date '10-02-2013', 10);
++>(date '01/02/2013', 1),
++>(date '02/02/2013', 2),
++>(date '03/02/2013', 3),
++>(date '04/02/2013', 4),
++>(date '05/02/2013', 5),
++>(date '06/02/2013', 6),
++>(date '07/02/2013', 7),
++>(date '08/02/2013' ,8),
++>(date '09/02/2013', 9),
++>(date '10/02/2013', 10);
 
 --- 10 row(s) inserted.
 >>
@@ -177,16 +177,16 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 B                     (EXPR)              
 --------------------  --------------------
 
-5                                        1
-7                                        1
 2                                        1
 4                                        1
-9                                        1
+5                                        1
+7                                        1
 8                                        1
+9                                        1
 3                                        1
+6                                        1
 10                                       1
 1                                        1
-6                                        1
 
 --- 10 row(s) selected.
 >>execute reporter;
@@ -237,9 +237,9 @@ B            (EXPR)
           9                     1
           1                     1
           4                     1
+          2                     1
           6                     1
           3                     1
-          2                     1
           5                     1
           7                     1
 
@@ -337,9 +337,9 @@ B            (EXPR)
           6                     1
           2                     1
          10                     1
-          3                     1
           8                     1
           9                     1
+          3                     1
           7                     1
           5                     1
           1                     1
@@ -389,16 +389,16 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 B            (EXPR)              
 -----------  --------------------
 
-         10                     1
+          2                     1
+          5                     1
+          7                     1
           8                     1
+         10                     1
           9                     1
           1                     1
           4                     1
           6                     1
           3                     1
-          2                     1
-          5                     1
-          7                     1
 
 --- 10 row(s) selected.
 >>execute reporter;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/regress/seabase/TEST012
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/TEST012 b/core/sql/regress/seabase/TEST012
index ad6cacc..bdd1484 100644
--- a/core/sql/regress/seabase/TEST012
+++ b/core/sql/regress/seabase/TEST012
@@ -35,6 +35,7 @@ obey TEST012(ddl);
 obey TEST012(tests);
 obey TEST012(negtests);
 obey TEST012(schemaDrop);
+obey TEST012(getStmts);
 log;
 exit;
 
@@ -113,6 +114,23 @@ get tables in schema trafodion.zschema;
 get indexes in schema trafodion.zschema;
 get views in schema trafodion.zschema;
 
+?section getStmts
+create schema trafodion.zschema1;
+create schema trafodion.zschema2;
+create table zschema1.t (a int);
+create table zschema2.t (a int);
+create view zschema1.v as select zschema1.t.a a, zschema2.t.a b 
+   from zschema1.t, zschema2.t;
+create view zschema2.v as select zschema1.t.a a, zschema2.t.a b 
+   from zschema1.t, zschema2.t;
+get tables in view zschema1.v;
+get views on table zschema1.t;
+drop schema zschema1 cascade;
+drop schema zschema2 cascade;
+
+
+
+
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/regress/seabase/TEST013
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/TEST013 b/core/sql/regress/seabase/TEST013
index c3b0d46..e1e73b1 100644
--- a/core/sql/regress/seabase/TEST013
+++ b/core/sql/regress/seabase/TEST013
@@ -70,16 +70,16 @@ update statistics for table char8 on every column;
 create table date8 (a date not null not droppable, b int, primary key (a));
 
 insert into date8 values
-(date '01-02-2013', 1),
-(date '02-02-2013', 2),
-(date '03-02-2013', 3),
-(date '04-02-2013', 4),
-(date '05-02-2013', 5),
-(date '06-02-2013', 6),
-(date '07-02-2013', 7),
-(date '08-02-2013' ,8),
-(date '09-02-2013', 9),
-(date '10-02-2013', 10);
+(date '01/02/2013', 1),
+(date '02/02/2013', 2),
+(date '03/02/2013', 3),
+(date '04/02/2013', 4),
+(date '05/02/2013', 5),
+(date '06/02/2013', 6),
+(date '07/02/2013', 7),
+(date '08/02/2013' ,8),
+(date '09/02/2013', 9),
+(date '10/02/2013', 10);
 
 update statistics for table date8 clear;
 update statistics for table date8 on every column;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultConstants.h b/core/sql/sqlcomp/DefaultConstants.h
index 9150f5b..258af87 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -3788,6 +3788,11 @@ enum DefaultConstants
   // set to ON to aggressively allocate ESP per core
   AGGRESSIVE_ESP_ALLOCATION_PER_CORE,
 
+  // if ON, use older datetime value constructor in DatetimeValue::DatetimeValue
+  // Default is OFF. This cqd is used in case there are problems.
+  // It will be removed after testing is complete.
+  USE_OLD_DT_CONSTRUCTOR,
+
   // This enum constant must be the LAST one in the list; it's a count,
   // not an Attribute (it's not IN DefaultDefaults; it's the SIZE of it)!
   __NUM_DEFAULT_ATTRIBUTES

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/sqlcomp/QCache.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/QCache.cpp b/core/sql/sqlcomp/QCache.cpp
index 3428301..0e3f57a 100644
--- a/core/sql/sqlcomp/QCache.cpp
+++ b/core/sql/sqlcomp/QCache.cpp
@@ -1437,20 +1437,24 @@ NABoolean CacheData::backpatchParams
               charVal = (char*) (&val);
         }
 
+        Lng32 dataConversionErrorFlag = 0;
         short retCode = convDoIt((char*)charVal,
-           constVal->getStorageSize(),
-           (short)sourceType->getFSDatatype(),
-           sourceType->getPrecision(),
-           sourceScale,
-           (char*)(targetBugPtr+offset),
-           targetLen,
-           (short)(targetType->getFSDatatype()),
-           targetType->getPrecision(),
-           targetScale,
-           varCharLen, 
-           varCharLenSize);
-
-        if (retCode != ex_expr::EXPR_OK)
+                                 constVal->getStorageSize(),
+                                 (short)sourceType->getFSDatatype(),
+                                 sourceType->getPrecision(),
+                                 sourceScale,
+                                 (char*)(targetBugPtr+offset),
+                                 targetLen,
+                                 (short)(targetType->getFSDatatype()),
+                                 targetType->getPrecision(),
+                                 targetScale,
+                                 varCharLen, 
+                                 varCharLenSize,
+                                 NULL, NULL, CONV_UNKNOWN,
+                                 &dataConversionErrorFlag);
+
+        if ((retCode != ex_expr::EXPR_OK) ||
+            (dataConversionErrorFlag == ex_conv_clause::CONV_RESULT_ROUNDED_DOWN))
            return FALSE;
   
         offset += targetLen;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0c872245/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index 4ccad11..882d924 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -3462,6 +3462,9 @@ XDDkwd__(SUBQUERY_UNNESTING,			"ON"),
   DDkwd__(USE_LARGE_QUEUES,                     "ON"),
 
   DDkwd__(USE_MAINTAIN_CONTROL_TABLE,          "OFF"),
+
+  DDkwd__(USE_OLD_DT_CONSTRUCTOR,      "OFF"),
+
   // Adaptive segmentation, use operator max to determine degree of parallelism
   DDui___(USE_OPERATOR_MAX_FOR_DOP,     "1"),
 


[2/3] incubator-trafodion git commit: Merge remote branch 'origin/master' into dt_br

Posted by db...@apache.org.
Merge remote branch 'origin/master' into dt_br

Conflicts:
	core/sql/sqlcomp/DefaultConstants.h


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

Branch: refs/heads/master
Commit: e612ede73eb7329f0cb1aec14d9f7e6eacdac2df
Parents: 0c87224 7f33541
Author: Cloud User <ce...@ansharma-1.novalocal>
Authored: Fri Feb 5 19:12:43 2016 +0000
Committer: Cloud User <ce...@ansharma-1.novalocal>
Committed: Fri Feb 5 19:12:43 2016 +0000

----------------------------------------------------------------------
 core/conn/odbc/src/odbc/nsksrvr/Makefile        |    2 +-
 .../odbc/odbcclient/unixcli/cli/drvrglobal.h    |   21 +-
 .../unixcli/package/linux64_install.sh          |  397 --
 core/rest/src/main/asciidoc/_chapters/apis.adoc |   20 +
 .../java/org/trafodion/rest/ServerResource.java |   94 +
 core/sqf/LocalSettingsTemplate.sh               |    3 +
 core/sqf/monitor/linux/amqpmon.cxx              |  231 -
 core/sqf/monitor/linux/amqpmon.h                |   71 -
 core/sqf/monitor/linux/makefile                 |    2 +-
 core/sqf/sqenvcom.sh                            |    2 +-
 core/sqf/sql/scripts/findPort.py                |   40 +-
 core/sqf/sql/scripts/genms                      |    1 +
 core/sqf/sql/scripts/install_traf_components    |   68 +-
 core/sqf/sql/scripts/lsof.awk                   |  110 +
 core/sqf/sql/scripts/restcheck                  |   70 +
 core/sqf/sql/scripts/sqgen                      |   13 +-
 .../sqf/sql/scripts/traf_coprocessor.properties |   26 +
 core/sqf/sql/scripts/uninstall_traf_components  |  159 +
 core/sqf/sqvers                                 |    2 +-
 .../transactional/TrxRegionEndpoint.java        |   33 +-
 .../generated/TrxRegionProtos.java              |  230 +-
 .../hbase-trx/src/main/protobuf/TrxRegion.proto |    3 +-
 .../java/org/trafodion/dtm/TmAuditTlog.java     |    9 +-
 core/sqf/src/tm/Makefile                        |    8 +-
 core/sqf/src/tm/dtm.events.pb.cc                | 1185 -----
 core/sqf/src/tm/dtm.events.pb.h                 |  709 ---
 core/sqf/src/tm/dtm.perf_stats.pb.cc            | 4081 ------------------
 core/sqf/src/tm/dtm.perf_stats.pb.h             | 2442 -----------
 core/sqf/src/tm/idtmsrv.cpp                     |   48 +-
 core/sql/common/csconvert.cpp                   |   48 +
 core/sql/common/csconvert.h                     |    4 +
 core/sql/exp/exp_clause_derived.h               |    4 +-
 core/sql/exp/exp_conv.cpp                       |   26 +
 core/sql/generator/GenItemFunc.cpp              |    3 +
 core/sql/generator/GenRelScan.cpp               |   22 +-
 core/sql/nskgmake/Makerules.linux               |    5 +-
 core/sql/optimizer/BindItemExpr.cpp             |   36 +-
 core/sql/optimizer/ItemExpr.cpp                 |    9 +-
 core/sql/optimizer/ItemFunc.h                   |    1 +
 core/sql/optimizer/NormRelExpr.cpp              |   52 +-
 core/sql/optimizer/SynthType.cpp                |    7 +
 core/sql/regress/executor/EXPECTED015.SB        |   98 +-
 core/sql/regress/executor/EXPECTED131           |   67 +-
 core/sql/regress/executor/TEST015               |   33 +-
 core/sql/regress/executor/TEST131               |    5 +
 core/sql/regress/hive/EXPECTED005               |   26 +
 core/sql/regress/hive/TEST005                   |    7 +
 core/sql/regress/hive/TEST005_a.hive.sql        |    9 +
 core/sql/regress/hive/tbl_gbk.data              |  Bin 0 -> 129 bytes
 core/sql/sqlcomp/DefaultConstants.h             |    3 +
 core/sql/sqlcomp/nadefaults.cpp                 |    2 +
 core/sql/sqlmxevents/logmxevent_sq.cpp          |    2 +-
 .../org/trafodion/sql/CoprocessorUtils.java     |  104 +
 .../java/org/trafodion/sql/HBaseClient.java     |   19 +-
 .../src/asciidoc/_chapters/odbc_linux.adoc      |    4 +-
 .../src/asciidoc/_chapters/odbc_windows.adoc    |    2 +-
 .../src/asciidoc/_chapters/trafci.adoc          |    8 +-
 .../src/asciidoc/_chapters/commands.adoc        |   44 +-
 .../src/asciidoc/_chapters/interactive.adoc     |    8 +-
 .../src/asciidoc/_chapters/binder_msgs.adoc     |  266 +-
 .../src/asciidoc/_chapters/ddl_msgs.adoc        |   19 +-
 .../src/asciidoc/_chapters/executor_msgs.adoc   |    5 +-
 .../asciidoc/_chapters/file_system_errors.adoc  |   10 +-
 .../src/asciidoc/_chapters/optimizer_msgs.adoc  |    4 +-
 .../src/asciidoc/_chapters/parser_msgs.adoc     |   16 +-
 .../src/asciidoc/_chapters/sort_msgs.adoc       |    4 +-
 .../src/asciidoc/_chapters/sqlstate.adoc        |    6 +-
 .../src/asciidoc/_chapters/a_warnings.adoc      |    2 +-
 .../src/asciidoc/_chapters/compare_tables.adoc  |    8 +-
 .../src/asciidoc/_chapters/concepts.adoc        |    6 +-
 .../src/asciidoc/_chapters/install.adoc         |  Bin 13594 -> 13598 bytes
 docs/odb_user/src/asciidoc/_chapters/load.adoc  |   44 +-
 .../src/asciidoc/_chapters/query_driver.adoc    |    6 +-
 .../src/asciidoc/_chapters/sql_interpreter.adoc |    4 +-
 .../src/asciidoc/_chapters/cqds.adoc            |   10 +-
 .../src/asciidoc/_chapters/introduction.adoc    |    8 +-
 .../src/asciidoc/_chapters/olap_functions.adoc  |    6 +-
 .../src/asciidoc/_chapters/runtime_stats.adoc   |    4 +-
 .../src/asciidoc/_chapters/sql_clauses.adoc     |    4 +-
 .../sql_functions_and_expressions.adoc          |  170 +-
 .../_chapters/sql_language_elements.adoc        |   54 +-
 .../src/asciidoc/_chapters/sql_statements.adoc  |  172 +-
 .../src/asciidoc/_chapters/sql_utilities.adoc   |   22 +-
 docs/src/site/markdown/advocate.md              |   15 -
 docs/src/site/markdown/build-tools-manual.md    |  197 -
 docs/src/site/markdown/build.md                 |   80 -
 docs/src/site/markdown/code-organization.md     |   27 -
 docs/src/site/markdown/code.md                  |   32 -
 docs/src/site/markdown/contribute.md            |   69 -
 docs/src/site/markdown/contributing-redirect.md |   18 +
 .../markdown/cplusplus-coding-guidelines.md     |  310 --
 .../src/site/markdown/create-dev-environment.md |  154 -
 docs/src/site/markdown/develop.md               |  253 --
 docs/src/site/markdown/document.md              |  143 -
 docs/src/site/markdown/documentation.md         |   15 +-
 docs/src/site/markdown/download.md              |   18 +-
 docs/src/site/markdown/index.md                 |   22 +-
 docs/src/site/markdown/install.md               |    5 +-
 .../src/site/markdown/manage-dev-environment.md |   51 -
 docs/src/site/markdown/merge.md                 |  140 -
 docs/src/site/markdown/release.md               |  225 -
 .../site/markdown/setup-build-environment.md    |  160 -
 docs/src/site/markdown/team-redirect.md         |   18 +
 docs/src/site/markdown/testing.md               |  179 -
 docs/src/site/markdown/tests.md                 |   71 -
 docs/src/site/markdown/website.md               |  108 -
 docs/src/site/markdown/wiki.md                  |   23 -
 docs/src/site/site.xml                          |   93 +-
 install/installer/cloud_cli_setup               |   20 +-
 install/installer/dcs_installer                 |   31 +-
 install/installer/rest_installer                |   10 +-
 .../tools/traf_cloudera_uninstall_suse          |    5 +
 install/installer/traf_add_sudoAccess           |   11 +-
 install/installer/traf_add_user                 |   37 +-
 install/installer/traf_cloudera_mods98          |  104 +-
 install/installer/traf_config                   |   92 +-
 install/installer/traf_config_check             |  202 +-
 install/installer/traf_config_setup             |   65 +-
 install/installer/traf_create_systemdefaults    |  203 -
 install/installer/traf_getHadoopNodes           |   13 +-
 install/installer/traf_hortonworks_mods98       |  130 +-
 install/installer/traf_package_setup            |   29 +-
 install/installer/traf_setup                    |   41 +-
 install/installer/traf_sqgen                    |   98 +
 install/installer/traf_start                    |   11 +-
 install/installer/traf_user_prompt              |   28 +
 install/installer/traf_user_prompt_check        |   27 +
 install/installer/trafodion_config_default      |    7 +-
 install/installer/trafodion_install             |  125 +-
 install/installer/trafodion_uninstaller         |   15 +-
 install/traf_tools_setup.sh                     |  221 +-
 wms/bin/local-servers.sh                        |    4 +-
 wms/bin/servers.sh                              |    4 +-
 wms/bin/start-wms.sh                            |    6 +-
 wms/bin/stop-wms.sh                             |    8 +-
 wms/bin/wms                                     |    7 +-
 wms/bin/wms-config.sh                           |    7 +-
 wms/bin/wms-daemon.sh                           |    7 +-
 wms/bin/wms-daemons.sh                          |    7 +-
 wms/bin/zookeepers.sh                           |    7 +-
 wms/conf/wms-env.sh                             |   31 +-
 .../trafodion/wms/rest/ServerListResource.java  |    2 +-
 .../org/trafodion/wms/server/ServerManager.java |    1 -
 wms/src/saveVersion.sh                          |    2 +-
 144 files changed, 2674 insertions(+), 12958 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e612ede7/core/sql/exp/exp_clause_derived.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e612ede7/core/sql/exp/exp_conv.cpp
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e612ede7/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --cc core/sql/sqlcomp/DefaultConstants.h
index 258af87,ed10f3e..d4acd8d
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@@ -3788,11 -3788,9 +3788,14 @@@ enum DefaultConstant
    // set to ON to aggressively allocate ESP per core
    AGGRESSIVE_ESP_ALLOCATION_PER_CORE,
  
 +  // if ON, use older datetime value constructor in DatetimeValue::DatetimeValue
 +  // Default is OFF. This cqd is used in case there are problems.
 +  // It will be removed after testing is complete.
 +  USE_OLD_DT_CONSTRUCTOR,
 +
+   // real charset in the HIVE table
+   HIVE_FILE_CHARSET,
+ 
    // This enum constant must be the LAST one in the list; it's a count,
    // not an Attribute (it's not IN DefaultDefaults; it's the SIZE of it)!
    __NUM_DEFAULT_ATTRIBUTES

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e612ede7/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------


[3/3] incubator-trafodion git commit: Merge [TRAFODION-1793] [TRAFODION-1807] [TRAFODION-1808] Various fixes

Posted by db...@apache.org.
Merge [TRAFODION-1793] [TRAFODION-1807] [TRAFODION-1808] Various fixes


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

Branch: refs/heads/master
Commit: 3aef62173a3d6ffc641d51024478b2ade1b5b024
Parents: d4a125b e612ede
Author: Dave Birdsall <db...@apache.org>
Authored: Mon Feb 8 16:39:54 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Mon Feb 8 16:39:54 2016 +0000

----------------------------------------------------------------------
 core/sql/common/DateTimeType.cpp            |  69 +++-
 core/sql/common/DatetimeType.h              |   8 +-
 core/sql/executor/ExExeUtilGet.cpp          |  32 +-
 core/sql/exp/exp_clause_derived.h           |   8 +-
 core/sql/exp/exp_conv.cpp                   |  55 +--
 core/sql/exp/exp_datetime.cpp               | 456 +++++++++------------
 core/sql/exp/exp_datetime.h                 |  43 +-
 core/sql/exp/exp_function.cpp               |  16 +-
 core/sql/parser/SqlParserAux.cpp            |  18 +-
 core/sql/parser/sqlparser.y                 |   4 +-
 core/sql/regress/executor/EXPECTED022.LINUX | 488 ++++++++++++++++++++++-
 core/sql/regress/executor/TEST022           |  38 ++
 core/sql/regress/seabase/EXPECTED012        |  53 ++-
 core/sql/regress/seabase/EXPECTED013        |  40 +-
 core/sql/regress/seabase/TEST012            |  18 +
 core/sql/regress/seabase/TEST013            |  20 +-
 core/sql/sqlcomp/DefaultConstants.h         |   5 +
 core/sql/sqlcomp/QCache.cpp                 |  30 +-
 core/sql/sqlcomp/nadefaults.cpp             |   3 +
 19 files changed, 967 insertions(+), 437 deletions(-)
----------------------------------------------------------------------