You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by li...@apache.org on 2018/02/23 09:45:26 UTC

[7/9] trafodion git commit: [TRAFODION-2954] add MySQL function unix_timestamp, uuid, sleep

[TRAFODION-2954] add MySQL function unix_timestamp,uuid,sleep


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

Branch: refs/heads/master
Commit: 1bfb2a876a011472db705863d51e8277970afd80
Parents: 9312bd2
Author: Liu Ming <ov...@sina.com>
Authored: Thu Feb 22 01:33:37 2018 +0000
Committer: Liu Ming <ov...@sina.com>
Committed: Thu Feb 22 01:33:37 2018 +0000

----------------------------------------------------------------------
 core/sql/exp/exp_function.cpp            |    2 +-
 core/sql/generator/GenExpGenerator.cpp   |    3 +-
 core/sql/optimizer/BindItemExpr.cpp      |   50 +-
 core/sql/optimizer/GroupAttr.cpp         |    5 +-
 core/sql/optimizer/ItemExpr.cpp          |   29 +-
 core/sql/optimizer/ItemFunc.h            |   35 +-
 core/sql/optimizer/OptItemExpr.cpp       |    1 +
 core/sql/optimizer/SynthType.cpp         |   33 +-
 core/sql/parser/sqlparser.y              |    9 +-
 core/sql/regress/executor/EXPECTED002.SB | 1040 +------------------------
 core/sql/regress/executor/FILTER002      |    1 +
 core/sql/regress/executor/TEST002        |   14 +-
 12 files changed, 138 insertions(+), 1084 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index e80401f..a65c120 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -2522,7 +2522,7 @@ ex_expr::exp_return_type ex_function_sleep::eval(char *op_data[],
 						   CollHeap* heap,
 						   ComDiagsArea** diagsArea)
 {
-   Int32 sec = 0;
+  Int32 sec = 0;
   switch (getOperand(1)->getDatatype())
   {
     case REC_BIN8_SIGNED:

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/generator/GenExpGenerator.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenExpGenerator.cpp b/core/sql/generator/GenExpGenerator.cpp
index f2651c4..2fcc85d 100644
--- a/core/sql/generator/GenExpGenerator.cpp
+++ b/core/sql/generator/GenExpGenerator.cpp
@@ -3701,8 +3701,7 @@ short ExpGenerator::generateInputExpr(const ValueIdList &val_id_list,
 	if ((item_expr->isAUserSuppliedInput()) || //evaluate once functions
 		(item_expr->getOperatorType() == ITM_CURRENT_TIMESTAMP) ||
 		(item_expr->getOperatorType() == ITM_UNIX_TIMESTAMP) ||
-		(item_expr->getOperatorType() == ITM_UNIQUE_ID) ||
-		(item_expr->getOperatorType() == ITM_UNIQUE_SHORT_ID) ||
+		(item_expr->getOperatorType() == ITM_SLEEP) ||
 	    (item_expr->getOperatorType() == ITM_CURRENT_USER) ||
 	    (item_expr->getOperatorType() == ITM_SESSION_USER) ||
             (item_expr->getOperatorType() == ITM_EXEC_COUNT) ||

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/optimizer/BindItemExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindItemExpr.cpp b/core/sql/optimizer/BindItemExpr.cpp
index c617d17..3c81218 100644
--- a/core/sql/optimizer/BindItemExpr.cpp
+++ b/core/sql/optimizer/BindItemExpr.cpp
@@ -3187,7 +3187,6 @@ ItemExpr *BuiltinFunction::bindNode(BindWA *bindWA)
 
     case ITM_ISIPV4:
     case ITM_ISIPV6:
-    case ITM_SLEEP:
     case ITM_MD5:
     case ITM_CRC32:
     case ITM_SHA1:
@@ -3199,23 +3198,6 @@ ItemExpr *BuiltinFunction::bindNode(BindWA *bindWA)
       {
          break;
       }
-    case ITM_UNIQUE_ID:
-    case ITM_UNIQUE_SHORT_ID:
-      {
-        if (nodeIsBound())
-          return getValueId().getItemExpr();
-        const NAType *type = synthTypeWithCollateClause(bindWA);
-        if (!type) return this;
- 
-        ItemExpr* ie = ItemExpr::bindUserInput(bindWA,type,getText());
-        if (bindWA->errStatus())
-          return this;
- 
-        // add this value id to BindWA's input function list.
-        bindWA->inputFunction().insert(getValueId());
-        return ie;
-      }
-    break;
     case ITM_NULLIFZERO:
       {
 	// binder has already verified that child is numeric
@@ -8436,6 +8418,38 @@ ItemExpr *DefaultSpecification::bindNode(BindWA *bindWA)
 } // DefaultSpecification::bindNode()
 
 // -----------------------------------------------------------------------
+// member functions for class SleepFunction 
+// -----------------------------------------------------------------------
+
+ItemExpr *SleepFunction::bindNode(BindWA *bindWA)
+{
+
+  if (bindWA->inDDL() && (bindWA->inCheckConstraintDefinition()))
+  {
+	StmtDDLAddConstraintCheck *pCkC = bindWA->getUsageParseNodePtr()
+                                    ->castToElemDDLNode()
+                                    ->castToStmtDDLAddConstraintCheck();
+    *CmpCommon::diags() << DgSqlCode(-4131);
+    bindWA->setErrStatus();
+    return this;
+  }
+
+  if (nodeIsBound())
+    return getValueId().getItemExpr();
+  const NAType *type = synthTypeWithCollateClause(bindWA);
+  if (!type) return this;
+
+  ItemExpr * ie = ItemExpr::bindUserInput(bindWA,type,getText());
+  if (bindWA->errStatus())
+    return this;
+
+  // add this value id to BindWA's input function list.
+  bindWA->inputFunction().insert(getValueId());
+
+  return ie;
+} // SleepFunction::bindNode()
+
+// -----------------------------------------------------------------------
 // member functions for class UnixTimestamp
 // -----------------------------------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/optimizer/GroupAttr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/GroupAttr.cpp b/core/sql/optimizer/GroupAttr.cpp
index 3ebe690..bf31b8b 100644
--- a/core/sql/optimizer/GroupAttr.cpp
+++ b/core/sql/optimizer/GroupAttr.cpp
@@ -1787,14 +1787,13 @@ void GroupAttributes::resolveCharacteristicInputs(const ValueIdSet& externalInpu
 	 {
 	   VEGReference *vegRef = ((VEGReference *)(x.getItemExpr()));
 	   ValueIdSet allValues = vegRef->getVEG()->getAllValues();
-	   // in all these values check for current_user amd current_timestamp
+	   // in all these values check for current_user and current_timestamp
 	   for (ValueId vid = allValues.init(); allValues.next(vid); allValues.advance(vid))
 	   {
 	     ItemExpr * vidExpr = vid.getItemExpr();
 	     if ((vidExpr->getOperatorType() == ITM_CURRENT_USER) ||
 		 (vidExpr->getOperatorType() == ITM_CURRENT_TIMESTAMP) ||
-		 (vidExpr->getOperatorType() == ITM_UNIQUE_SHORT_ID) ||
-		 (vidExpr->getOperatorType() == ITM_UNIQUE_ID) ||
+		 (vidExpr->getOperatorType() == ITM_SLEEP) ||
 		 (vidExpr->getOperatorType() == ITM_UNIX_TIMESTAMP))
 
 	       currentConstants += vid;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/optimizer/ItemExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ItemExpr.cpp b/core/sql/optimizer/ItemExpr.cpp
index a2e56eb..744a0a5 100644
--- a/core/sql/optimizer/ItemExpr.cpp
+++ b/core/sql/optimizer/ItemExpr.cpp
@@ -872,8 +872,6 @@ NABoolean ItemExpr::doesExprEvaluateToConstant(NABoolean strict,
 
 		case ITM_DYN_PARAM:
 		case ITM_CACHE_PARAM:
-		case ITM_UNIQUE_ID:
-		case ITM_UNIQUE_SHORT_ID:
 		case ITM_CURRENT_USER:
 		case ITM_SESSION_USER:
 		case ITM_CURRENT_TIMESTAMP:
@@ -971,8 +969,6 @@ NABoolean ItemExpr::referencesAHostVar() const
       case ITM_CURRENT_TIMESTAMP:
       case ITM_GET_TRIGGERS_STATUS:
       case ITM_UNIQUE_EXECUTE_ID:
-      case ITM_UNIQUE_SHORT_ID:
-      case ITM_UNIQUE_ID:
       case ITM_CURR_TRANSID:
 	return TRUE;
 
@@ -7372,15 +7368,6 @@ Int32 BuiltinFunction::getArity() const
   return getNumChildren();
 }
 
-NABoolean BuiltinFunction::isAUserSuppliedInput() const 
-{
-  if(getOperatorType() == ITM_UNIQUE_ID ||
-     getOperatorType() == ITM_UNIQUE_SHORT_ID ) 
-    return TRUE;
-  else
-    return FALSE;
-}
-
 // -----------------------------------------------------------------------
 // BuiltinFunction::isCovered()
 // -----------------------------------------------------------------------
@@ -8285,6 +8272,22 @@ ItemExpr * ConvertTimestamp::copyTopNode(ItemExpr *derivedNode,
 
 } // ConvertTimestamp::copyTopNode()
 
+SleepFunction::~SleepFunction() {}
+ItemExpr * SleepFunction::copyTopNode(ItemExpr *derivedNode,
+					 CollHeap* outHeap)
+{
+  ItemExpr *result;
+
+  if (derivedNode == NULL)
+    result = new (outHeap) SleepFunction(child(0));
+  else
+    result = derivedNode;
+
+  return BuiltinFunction::copyTopNode(result,outHeap);
+
+} // SleepFunction::copyTopNode()
+NABoolean SleepFunction::isAUserSuppliedInput() const    { return TRUE; }
+
 UnixTimestamp::~UnixTimestamp() {}
 
 ItemExpr * UnixTimestamp::copyTopNode(ItemExpr *derivedNode,

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/optimizer/ItemFunc.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ItemFunc.h b/core/sql/optimizer/ItemFunc.h
index 7c67931..6c0c779 100644
--- a/core/sql/optimizer/ItemFunc.h
+++ b/core/sql/optimizer/ItemFunc.h
@@ -680,12 +680,6 @@ public:
   // a virtual function for performing name binding within the query tree
   virtual ItemExpr * bindNode(BindWA *bindWA);
 
-  // A method that returns for "user-given" input values.
-  // These are values that are either constants, host variables, parameters,
-  // or even values that are sensed from the environment such as
-  // current time, the user name, etcetera.
-  virtual NABoolean isAUserSuppliedInput() const;
-
   // Each operator supports a (virtual) method for transforming its
   // scalar expressions to a canonical form
   virtual void transformNode(NormWA & normWARef,
@@ -1757,6 +1751,35 @@ public:
   virtual NABoolean hasEquivalentProperties(ItemExpr * other) { return TRUE;}
 }; // class ConvertTimestamp
 
+class SleepFunction : public CacheableBuiltinFunction
+{
+public:
+
+  SleepFunction( ItemExpr *val1Ptr )
+   : CacheableBuiltinFunction(ITM_SLEEP, 1, val1Ptr)
+  {}
+  // virtual destructor
+  virtual ~SleepFunction();
+
+  // A method that returns for "user-given" input values.
+  // These are values that are either constants, host variables, parameters,
+  // or even values that are sensed from the environment such as
+  // current time, the user name, etcetera.
+  virtual NABoolean isAUserSuppliedInput() const;
+
+  // a virtual function for performing name binding within the query tree
+  virtual ItemExpr * bindNode(BindWA *bindWA);
+
+  // a virtual function for type propagating the node
+  virtual const NAType * synthesizeType();
+
+  virtual ItemExpr * copyTopNode(ItemExpr *derivedNode = NULL,
+				 CollHeap* outHeap = 0);
+
+  virtual NABoolean hasEquivalentProperties(ItemExpr * other) { return TRUE;}
+
+}; // class SleepFunction 
+
 class UnixTimestamp : public CacheableBuiltinFunction
 {
 public:

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/optimizer/OptItemExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/OptItemExpr.cpp b/core/sql/optimizer/OptItemExpr.cpp
index 4b7d6ba..7e187bf 100644
--- a/core/sql/optimizer/OptItemExpr.cpp
+++ b/core/sql/optimizer/OptItemExpr.cpp
@@ -1812,6 +1812,7 @@ NABoolean BuiltinFunction::calculateMinMaxUecs(ColStatDescList & histograms,
     break;
   case ITM_CONVERTTIMESTAMP:
   case ITM_UNIX_TIMESTAMP:
+  case ITM_SLEEP:
   case ITM_CURRENT_TIMESTAMP:
   case ITM_CURRENT_TIMESTAMP_RUNNING:
   case ITM_JULIANTIMESTAMP:

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/optimizer/SynthType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/SynthType.cpp b/core/sql/optimizer/SynthType.cpp
index c3dfc18..5dcb94e 100644
--- a/core/sql/optimizer/SynthType.cpp
+++ b/core/sql/optimizer/SynthType.cpp
@@ -1120,28 +1120,6 @@ const NAType *BuiltinFunction::synthesizeType()
       }
     break;
 
-    case ITM_SLEEP:
-      {
-        const NAType &typ1 = child(0)->getValueId().getType();
-       	if (typ1.getTypeQualifier() != NA_NUMERIC_TYPE)
-        {
-	    *CmpCommon::diags() << DgSqlCode(-4045) << DgString0("SLEEP");
-	    return NULL;
-        }
-        const NumericType &ntyp1 = (NumericType &) typ1;
-        if (NOT ntyp1.isExact() )
-        {
-             *CmpCommon::diags() << DgSqlCode(-4046) << DgString0(getTextUpper());
-             return NULL;
-        }
-        if (ntyp1.getScale() != 0 )
-        {
-          *CmpCommon::diags() << DgSqlCode(-4047) << DgString0(getTextUpper());
-          return NULL;
-        } 
-        retType = new HEAP SQLInt(HEAP, TRUE, TRUE);
-      }
-    break;
     case ITM_INET_ATON:
       {
         // type cast any params
@@ -3092,6 +3070,17 @@ const NAType *ConvertTimestamp::synthesizeType()
 
 }
 
+// -----------------------------------------------------------------------
+// member functions for class SleepFunction 
+// -----------------------------------------------------------------------
+const NAType *SleepFunction::synthesizeType()
+{
+    return  new HEAP SQLInt(HEAP, TRUE, TRUE);
+}
+
+// -----------------------------------------------------------------------
+// member functions for class UnixTimestamp
+// -----------------------------------------------------------------------
 const NAType *UnixTimestamp::synthesizeType()
 {
   return new HEAP SQLLargeInt(HEAP, FALSE,FALSE);

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/parser/sqlparser.y
----------------------------------------------------------------------
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index 336dfd6..d1e7d56 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -8887,10 +8887,15 @@ datetime_misc_function : TOK_CONVERTTIMESTAMP '(' value_expression ')'
 				 $$ = new (PARSERHEAP()) 
 				   ZZZBinderFunction(ITM_TO_TIMESTAMP, $3);
 			       }
-    | TOK_SLEEP '(' value_expression ')'
+    | TOK_SLEEP '(' numeric_literal_exact ')'
 				{
+                  NAType * type;
+                  type = new (PARSERHEAP())
+                       SQLInt(PARSERHEAP() , FALSE, FALSE);
+				 //ItemExpr* ie = new (PARSERHEAP()) 
 				 $$ = new (PARSERHEAP()) 
-				   BuiltinFunction(ITM_SLEEP,  CmpCommon::statementHeap(), 1, $3);
+				   SleepFunction( $3);
+                  //$$ = new (PARSERHEAP()) Cast(ie,type);
 				}
 
 CHAR_FUNC_optional_character_set : ',' CHAR_FUNC_character_set

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/regress/executor/EXPECTED002.SB
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/EXPECTED002.SB b/core/sql/regress/executor/EXPECTED002.SB
index 6260f06..cb581bd 100644
--- a/core/sql/regress/executor/EXPECTED002.SB
+++ b/core/sql/regress/executor/EXPECTED002.SB
@@ -6878,1030 +6878,44 @@ C1
 
 --- 1000 row(s) inserted.
 >>
->>select sleep(5) from dual;
+>>create table t002timert (c0 int, c1 int, c2 largeint);
 
-(EXPR)
------------
+--- SQL operation complete.
+>>create table t002tmp1 (c1 int);
 
-          1
+--- SQL operation complete.
+>>insert into t002tmp1 values(1),(2),(3);
 
---- 1 row(s) selected.
->>select 'unixtimestamp',unix_timestamp() from dual;
+--- 3 row(s) inserted.
+>>
+>>insert into t002timert select 1, sleep(5) , unix_timestamp() from t002tmp1;
+
+--- 3 row(s) inserted.
+>>insert into t002timert select 2, sleep(5) , unix_timestamp() from t002tmp1;
+
+--- 3 row(s) inserted.
+>>select 'sleeptimetest002', di from (select ( max(c2) - min(c2)) as di from t002timert ) where di between 5 and 9;
 
-(EXPR) (EXPR)
+(EXPR) DI
 ----------
 
-unixtimestamp 1518772709
+good
 
 --- 1 row(s) selected.
->>select 'uuidrow', uuid(), unix_timestamp() from T002T1K;
+>>select distinct(count(uuid())) from T002T1K;
 
-(EXPR) (EXPR) (EXPR)
+(EXPR)
 ----------
 
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-uuid
-
---- 1000 row(s) selected.
->>
+  1000 
+
+--- 1 row(s) selected.
+>>drop table t002timert;
+
+--- SQL operation complete.
+>>drop table t002tmp1;
+
+--- SQL operation complete.
 >>------------------------------------------------------------------------
 >>-- added for JIRA TRAFODION-2843
 >>

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/regress/executor/FILTER002
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/FILTER002 b/core/sql/regress/executor/FILTER002
index d872937..1b5f042 100755
--- a/core/sql/regress/executor/FILTER002
+++ b/core/sql/regress/executor/FILTER002
@@ -32,5 +32,6 @@ fi
 sed "
 s/\.[ ]*\*\*\*/\. \*\*\*/g
 s/^uuidrow.*$/uuid/
+s/^sleeptimetest002.*$/good/
 s/^unixtimestamp.*$/unixtimestamp/
 " $fil

http://git-wip-us.apache.org/repos/asf/trafodion/blob/1bfb2a87/core/sql/regress/executor/TEST002
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/TEST002 b/core/sql/regress/executor/TEST002
index f16c381..d66b483 100755
--- a/core/sql/regress/executor/TEST002
+++ b/core/sql/regress/executor/TEST002
@@ -1210,10 +1210,16 @@ transpose 0,1,2,3,4,5,6,7,8,9 as x10
 transpose 0,1,2,3,4,5,6,7,8,9 as x1
 transpose 0,1,2,3,4,5,6,7,8,9 as X01;
 
-select sleep(5) from dual;
-select 'unixtimestamp',unix_timestamp() from dual;
-select 'uuidrow', uuid(), unix_timestamp() from T002T1K;
-
+create table t002timert (c0 int, c1 int, c2 largeint);
+create table t002tmp1 (c1 int);
+insert into t002tmp1 values(1),(2),(3);
+
+insert into t002timert select 1, sleep(5) , unix_timestamp() from t002tmp1;
+insert into t002timert select 2, sleep(5) , unix_timestamp() from t002tmp1;
+select 'sleeptimetest002', di from (select ( max(c2) - min(c2)) as di from t002timert ) where di between 5 and 9;
+select distinct(count(uuid())) from T002T1K;
+drop table t002timert;
+drop table t002tmp1;
 ------------------------------------------------------------------------
 -- added for JIRA TRAFODION-2843