Merge branch 'master' of https://github.com/apache/trafodion into TRAFODION-3147
diff --git a/core/conn/jdbcT4/src/main/java/T4Messages.properties b/core/conn/jdbcT4/src/main/java/T4Messages.properties
index 3b2e661..a6e68e9 100644
--- a/core/conn/jdbcT4/src/main/java/T4Messages.properties
+++ b/core/conn/jdbcT4/src/main/java/T4Messages.properties
@@ -172,18 +172,10 @@
 unsupported_encoding_sqlstate=HY000
 unsupported_encoding_sqlcode=29036
 
-forward_only_cursor_msg=The Result Set Type is TYPE_FORWARD_ONLY
-forward_only_cursor_sqlstate=HY106
-forward_only_cursor_sqlcode=29037
-
 invalid_row_number_msg=The row number is not valid
 invalid_row_number_sqlstate=HY107
 invalid_row_number_sqlcode=29038
 
-read_only_concur_msg=The concurrency mode of the result set is CONCUR_READ_ONLY
-read_only_concur_sqlstate=HY092
-read_only_concur_sqlcode=29039
-
 invalid_operation_msg=Operation invalid, since the current row is insert row
 invalid_operation_sqlstate=HY000
 invalid_operation_sqlcode=29040
@@ -304,9 +296,9 @@
 address_format_2_error_sqlstate=HY000
 address_format_2_error_sqlcode=29109
 
-missing ip_or_name_error_msg=Address is missing an IP address or machine name
-missing ip_or_name_error_sqlstate=HY000
-missing ip_or_name_error_sqlcode=29110
+missing_ip_or_name_error_msg=Address is missing an IP address or machine name
+missing_ip_or_name_error_sqlstate=HY000
+missing_ip_or_name_error_sqlcode=29110
 
 address_lookup_error_msg=Unable to evaluate address {0} Cause: {1}
 address_lookup_error_sqlstate=HY000
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceResultSet.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceResultSet.java
index fe911e5..972c81b 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceResultSet.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/InterfaceResultSet.java
@@ -448,9 +448,6 @@
 					if (desc.sqlPrecision_ > 0) {
 						nanoSeconds = Bytes.extractUInt(values, noNullValue + 7, swap);
 
-						if (nanoSeconds > 999999) // returned in microseconds
-							nanoSeconds = 0;
-
 						// apply leading 0's for string conversion
 						tmpStr = "" + nanoSeconds;
 						length = tmpStr.length();
@@ -489,9 +486,6 @@
 						if (desc.sqlPrecision_ > 0) {
 							nanoSeconds = Bytes.extractUInt(values, noNullValue + 3, swap);
 
-							if (nanoSeconds > 999999) // returned in microseconds
-								nanoSeconds = 0;
-
 							String formatStr = "";
 							for(int i=0;i<desc.sqlPrecision_;i++)
 								formatStr += "0";
diff --git a/core/conn/jdbcT4/src/main/samples/t4jdbc.properties b/core/conn/jdbcT4/src/main/samples/t4jdbc.properties
index d8ae73e..e0e5f47 100755
--- a/core/conn/jdbcT4/src/main/samples/t4jdbc.properties
+++ b/core/conn/jdbcT4/src/main/samples/t4jdbc.properties
@@ -23,4 +23,4 @@
 schema  = SEABASE
 url = jdbc:t4jdbc://server:port/:
 user = usr
-password = pwd
+password = password
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp b/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
index 837f507..b489afb 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp
@@ -5445,7 +5445,71 @@
                     inputParam[2], inputParam[3],
                     uniqueness == 1 ? "" : "and idx.is_unique=1"
                     );
-
+            break;
+        case SQL_API_SQLTABLEPRIVILEGES:
+            convertWildcard(metadataId, TRUE, catalogNm, expCatalogNm);
+            convertWildcardNoEsc(metadataId, TRUE, catalogNm, catalogNmNoEsc);
+            convertWildcard(metadataId, TRUE, schemaNm, expSchemaNm);
+            convertWildcardNoEsc(metadataId, TRUE, schemaNm, schemaNmNoEsc);
+            convertWildcard(metadataId, TRUE, tableNm, expTableNm);
+            convertWildcardNoEsc(metadataId, TRUE, tableNm, tableNmNoEsc);
+            inputParam[0] = catalogNmNoEsc;
+            inputParam[1] = expCatalogNm;
+            inputParam[2] = schemaNmNoEsc;
+            inputParam[3] = expSchemaNm;
+            inputParam[4] = tableNmNoEsc;
+            inputParam[5] = expTableNm;
+            snprintf(CatalogQuery, sizeof(CatalogQuery), "select cast(ob.CATALOG_NAME as varchar(128) ) TABLE_CAT,"
+                    "cast(trim(ob.SCHEMA_NAME) as varchar(128) ) TABLE_SCHEM,"
+                    "cast(trim(ob.OBJECT_NAME) as varchar(128) ) TABLE_NAME,"
+                    "cast(trim(op.GRANTOR_NAME) as varchar(128) ) GRANTOR,"
+                    "cast(trim(op.GRANTEE_NAME) as varchar(128) ) GRANTEE,"
+                    "cast(trim(case op.PRIVILEGES_BITMAP "
+                    "when 1 then 'SELECT' "
+                    "when 2 then 'INSERT' "
+                    "when 3 then 'SELECT,INSERT' "
+                    "when 4 then 'DELETE' "
+                    "when 5 then 'SELECT,DELETE' "
+                    "when 6 then 'INSERT,DELETE' "
+                    "when 7 then 'SELECT,INSERT,DELETE' "
+                    "when 8 then 'UPDATE' "
+                    "when 9 then 'SELECT,UPDATE' "
+                    "when 10 then 'INSERT,UPDATE' "
+                    "when 11 then 'SELECT,INSERT,UPDATE' "
+                    "when 12 then 'DELETE,UPDATE' "
+                    "when 13 then 'SELECT,DELETE,UPDATE' "
+                    "when 14 then 'INSERT,DELETE,UPDATE' "
+                    "when 15 then 'SELECT,INSERT,DELETE,UPDATE' "
+                    "when 32 then 'REFERENCES' "
+                    "when 33 then 'SELECT,REFERENCES' "
+                    "when 34 then 'INSERT,REFERENCES' "
+                    "when 35 then 'SELECT,INSERT,REFERENCES' "
+                    "when 36 then 'DELETE,REFERENCES' "
+                    "when 37 then 'SELECT,DELETE,REFERENCES' "
+                    "when 38 then 'INSERT,DELETE,REFERENCES' "
+                    "when 39 then 'SELECT,INSERT,DELETE,REFERENCES' "
+                    "when 40 then 'UPDATE,REFERENCES' "
+                    "when 41 then 'SELECT,UPDATE,REFERENCES' "
+                    "when 42 then 'INSERT,UPDATE,REFERENCES' "
+                    "when 43 then 'SELECT,INSERT,UPDATE,REFERENCES' "
+                    "when 44 then 'DELETE,UPDATE,REFERENCES' "
+                    "when 45 then 'SELECT,DELETE,UPDATE,REFERENCES' "
+                    "when 46 then 'INSERT,DELETE,UPDATE,REFERENCES' "
+                    "when 47 then 'SELECT,INSERT,DELETE,UPDATE,REFERENCES' end) as varchar(128)) PRIVILEGE,"
+                    "cast (trim(case op.GRANTABLE_BITMAP "
+                    "when 0 then 'NO' else 'YES' "
+                    "end) as varchar(128)) IS_GRANTABLE "
+                    "from TRAFODION.\"_PRIVMGR_MD_\".OBJECT_PRIVILEGES as op, TRAFODION.\"_MD_\".OBJECTS as ob "
+                    "where ob.OBJECT_UID = op.OBJECT_UID "
+                    "%s"
+                    "and (ob.CATALOG_NAME = '%s' or trim(ob.CATALOG_NAME) LIKE '%s' ESCAPE '\\') "
+                    "and (ob.SCHEMA_NAME = '%s' or trim(ob.SCHEMA_NAME) LIKE '%s' ESCAPE '\\') "
+                    "and (ob.OBJECT_NAME = '%s' or trim(ob.OBJECT_NAME) LIKE '%s' ESCAPE '\\') "
+                    , (strlen(inputParam[4]) == 0 || inputParam[4][0] == '%') ? " " : "and op.GRANTEE_NAME <> 'DB__ROOT' "
+                    , inputParam[0], inputParam[1]
+                    , inputParam[2], inputParam[3]
+                    , inputParam[4], inputParam[5]
+                    );
             break;
                default :
                        exception_->exception_nr = odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_;
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
index 9ded3e6..9db3fae 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
@@ -815,6 +815,7 @@
 	// populate the inContext
 	inContext.location[0] = '\0';
 	inContext.userRole[0] = '\0';
+    inContext.sessionName[0] = '\0';
 
 	// we need to keep the following in UTF8 internally
 	// m_DSValue.m_DSSchema, m_DSValue.m_DSServerDSName, m_DSValue.m_DSName
diff --git a/core/sqf/conf/log4j.dtm.config b/core/sqf/conf/log4j.dtm.config
index 49de700..feaf588 100644
--- a/core/sqf/conf/log4j.dtm.config
+++ b/core/sqf/conf/log4j.dtm.config
@@ -40,10 +40,15 @@
 log4j.appender.dtmAppender.immediateFlush=true
 log4j.appender.dtmAppender.Append=true
 #log4j.appender.dtmAppender.DatePattern='.'yyyy-MM-dd 
+#log4j.additivity.org.trafodion.dtm=false
+#log4j.additivity.org.apache.hadoop.hbase.client.transactional=false
 
 # Custom Logging levels
 
 log4j.logger.org.apache.zookeeper=ERROR,dtmAppender
 log4j.logger.org.apache.hadoop.hbase=ERROR,dtmAppender
 log4j.logger.org.trafodion.dtm=INFO,dtmAppender
+#log4j.logger.org.trafodion.dtm=DEBUG,dtmAppender
+#log4j.logger.org.trafodion.dtm.HBaseTxClient=TRACE,dtmAppender
+#log4j.logger.org.apache.hadoop.hbase.client.transactional=TRACE,dtmAppender
 
diff --git a/core/sqf/conf/log4j.sql.config b/core/sqf/conf/log4j.sql.config
index c9df58b..909ba64 100644
--- a/core/sqf/conf/log4j.sql.config
+++ b/core/sqf/conf/log4j.sql.config
@@ -36,8 +36,11 @@
 log4j.appender.sqlAppender.immediateFlush=true
 log4j.appender.sqlAppender.MaxFileSize=64MB
 log4j.appender.sqlAppender.MaxBackupIndex=20
+#log4j.additivity.org.apache.hadoop.hbase.client.transactional=false
 
 # Custom Logging levels
 
 log4j.logger.org.apache=ERROR,sqlAppender
 log4j.logger.org.trafodion.sql=INFO,sqlAppender
+#log4j.logger.org.trafodion.sql=DEBUG,sqlAppender
+#log4j.logger.org.apache.hadoop.hbase.client.transactional=TRACE,sqlAppender
diff --git a/core/sqf/sql/scripts/genms b/core/sqf/sql/scripts/genms
index aa9129a..29ac957 100755
--- a/core/sqf/sql/scripts/genms
+++ b/core/sqf/sql/scripts/genms
@@ -208,6 +208,14 @@
 echo "TRAF_VAR=$TRAF_VAR"
 echo "TRAF_CONF=$TRAF_CONF"
 
+if [[ ! -z "$PID_MAX" ]]; then
+   echo "PID_MAX=$PID_MAX"
+fi
+
+if [[ ! -z "$RMS_SHARED_SEG_SIZE_MB" ]]; then
+   echo "RMS_SHARED_SEG_SIZE_MB=$RMS_SHARED_SEG_SIZE_MB"
+fi
+
 echo ""
 echo ""
 echo "# Added by gensq.pl"
diff --git a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TransactionManager.java b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TransactionManager.java
index 6c51568..1eceb71 100644
--- a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TransactionManager.java
+++ b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TransactionManager.java
@@ -65,6 +65,7 @@
 import org.apache.hadoop.hbase.client.Connection;
 import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.client.coprocessor.Batch;
 import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.RegionLocator;
@@ -85,8 +86,13 @@
 import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.PushEpochResponse;
 import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.RecoveryRequestRequest;
 import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.RecoveryRequestResponse;
+import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse;
+import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest;
 import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrxRegionService;
 
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
 import org.apache.hadoop.hbase.exceptions.DeserializationException;
 import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
@@ -101,6 +107,8 @@
 
 import org.apache.hadoop.ipc.RemoteException;
 
+import org.apache.hadoop.fs.FileSystem;
+
 import com.google.protobuf.ByteString;
 
 import org.apache.hadoop.hbase.client.transactional.TmDDL;
@@ -173,6 +181,9 @@
   public static final int HBASE_DURABILITY = 20;
   public static final int HBASE_MEMSTORE_FLUSH_SIZE = 21;
   public static final int HBASE_SPLIT_POLICY = 22;
+  public static final int HBASE_CACHE_DATA_IN_L1 = 23;
+  public static final int HBASE_PREFETCH_BLOCKS_ON_OPEN = 24;
+  public static final int HBASE_HDFS_STORAGE_POLICY= 25;
 
   public static final int TM_COMMIT_FALSE = 0;
   public static final int TM_COMMIT_READ_ONLY = 1;
@@ -182,6 +193,7 @@
   public static final int TM_SLEEP = 1000;      // One second
   public static final int TM_SLEEP_INCR = 5000; // Five seconds
   public static final int TM_RETRY_ATTEMPTS = 5;
+  Configuration config;
 
   private IdTm idServer;
   private static final int ID_TM_SERVER_TIMEOUT = 1000;
@@ -1663,6 +1675,7 @@
     private TransactionManager(final Configuration conf, Connection connection) throws ZooKeeperConnectionException, IOException {
         this(LocalTransactionLogger.getInstance(), conf, connection);
         this.connection = connection;
+        this.config = conf;
         int intThreads = 16;
         String retryAttempts = System.getenv("TMCLIENT_RETRY_ATTEMPTS");
         String numThreads = System.getenv("TM_JAVA_THREAD_POOL_SIZE");
@@ -2795,10 +2808,13 @@
     private class ChangeFlags {
         boolean tableDescriptorChanged;
         boolean columnDescriptorChanged;
+        boolean storagePolicyChanged;
+        String storagePolicy_;
 
         ChangeFlags() {
            tableDescriptorChanged = false;
            columnDescriptorChanged = false;
+           storagePolicyChanged = false;
         }
 
         void setTableDescriptorChanged() {
@@ -2816,6 +2832,16 @@
        boolean columnDescriptorChanged() {
           return columnDescriptorChanged;
        }
+
+       void setStoragePolicyChanged(String str) {
+           storagePolicy_ = str;
+           storagePolicyChanged = true;
+       }
+
+       boolean storagePolicyChanged()    {
+           return storagePolicyChanged;
+       }
+ 
     }
 
    private ChangeFlags setDescriptors(Object[] tableOptions,
@@ -2996,6 +3022,11 @@
                    (Long.parseLong(tableOption));
                returnStatus.setTableDescriptorChanged();
                break ;
+           case HBASE_HDFS_STORAGE_POLICY:
+               //TODO HBase 2.0 support this
+               //So when come to HBase 2.0, no need to do this via HDFS, just set here
+             returnStatus.setStoragePolicyChanged(tableOption);
+             break ;
            case HBASE_SPLIT_POLICY:
                   // This method not yet available in earlier versions
                   // desc.setRegionSplitPolicyClassName(tableOption)); 
@@ -3054,6 +3085,9 @@
               admin.modifyColumn(tableName,colDesc);
               waitForCompletion(tblName,admin);
            }
+           else if (status.storagePolicyChanged()) {
+             setStoragePolicy(tblName, status.storagePolicy_);
+           }
         } finally {
            admin.close();
         }
@@ -3138,7 +3172,7 @@
             admin.createTable(hdesc);
             admin.close();
     }
-
+    
     //Called only by DoPrepare.
     public void disableTable(final TransactionState transactionState, String tblName)
             throws IOException{
@@ -3226,5 +3260,79 @@
 
         return resultArray[0].getResultList();
     }
+
+    public void setStoragePolicy(String tblName, String policy)
+      throws IOException {
+
+      int retryCount = 0;
+      int retrySleep = TM_SLEEP;
+      boolean retry = false;
+      org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrxRegionService.BlockingInterface service;
+      org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.Builder request ; 
+      try {
+          Table tbl = connection.getTable(TableName.valueOf(tblName));
+          String rowkey = "0";
+          CoprocessorRpcChannel channel = tbl.coprocessorService(rowkey.getBytes());
+          service =
+            org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrxRegionService.newBlockingStub(channel);
+          request =
+           org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.newBuilder();
+          String hbaseRoot = config.get("hbase.rootdir");
+          FileSystem fs = FileSystem.get(config);
+          //Construct the HDFS dir
+          //find out if namespace is there
+          String[] parts = tblName.split(":");
+          String namespacestr="";
+          String fullPath = hbaseRoot + "/data/" ;
+          String fullPath2 = hbaseRoot + "/data/default/";
+          if(fs.exists(new Path(fullPath2)))
+            fullPath = fullPath2;
+
+          if(parts.length >1) //have namespace
+            fullPath = fullPath + parts[0] + "/" + parts[1];
+          else
+            fullPath = fullPath + tblName;
+
+          request.setPath(fullPath);
+          request.setPolicy(policy);
+      }
+      catch (Exception e) {
+          throw new IOException(e);
+      }
+        
+      do {
+          org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse ret = null;
+          try{
+            ret = service.setStoragePolicy(null,request.build());
+           }
+           catch(ServiceException se) {
+             String msg = new String ("ERROR occurred while calling coprocessor service in setStoragePolicy, retry due to ");
+             LOG.warn(msg, se);
+             retry = true;
+          }
+          catch(Throwable te)
+          {
+             LOG.error("ERROR occurred while calling coprocessor service in setStoragePolicy, not retry due to ", te);
+             retry = false;
+          }
+          //handle result and error
+          if( ret == null)
+          {
+            retry = false;
+            LOG.error("setStoragePolicy Response ret null , not retry");
+          }
+          else if (ret.getStatus() == false)
+          {
+            LOG.error("setStoragePolicy Response ret false." +  ret.getException());
+            throw new IOException(ret.getException());
+          }
+          if(retryCount == RETRY_ATTEMPTS)
+          {
+            throw new IOException("coprocessor not response");
+          }
+          if (retry) 
+              retrySleep = retry(retrySleep);
+      } while (retry && retryCount++ < RETRY_ATTEMPTS);
+    }
 }
 
diff --git a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/TrxRegionEndpoint.java.tmpl b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/TrxRegionEndpoint.java.tmpl
index 430378d..2cbdc1e 100644
--- a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/TrxRegionEndpoint.java.tmpl
+++ b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/TrxRegionEndpoint.java.tmpl
@@ -248,6 +248,8 @@
 import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafEstimateRowCountResponse;
 import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateRequest;
 import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse;
+import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse;
+import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest;
 import org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrxRegionService;
 #ifdef CDH5.7 APACHE1.2
 import org.apache.hadoop.hbase.regionserver.MultiVersionConcurrencyControl.WriteEntry;
@@ -270,6 +272,10 @@
 import com.google.protobuf.Service;
 import com.google.protobuf.ServiceException;
 
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+
 
 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
 @InterfaceStability.Evolving
@@ -464,6 +470,9 @@
   public static final int REGION_STATE_START = 2;
 
   public static final String trxkeyEPCPinstance = "EPCPinstance";
+
+  private static Method hdfsSetStoragePolicyMethod = null;
+  private static String hdfsSetStoragePolicyReflectErrorMsg = "";
   
   #ifdef HDP2.3 HDP2.4 CDH5.5 CDH5.7 APACHE1.2
   static ChoreService s_ChoreService = null;
@@ -2404,6 +2413,62 @@
     done.run(TlogDel_response);
  }
 
+  public void setStoragePolicy(RpcController controller,
+                                             TrafSetStoragePolicyRequest request,
+                                             RpcCallback<TrafSetStoragePolicyResponse> done) {
+    String path = request.getPath();
+    String policy = request.getPolicy();
+    if (LOG.isTraceEnabled()) LOG.trace("setStoragePolicy ENTRY. path " +  path + " policy " + policy );
+
+    IOException t=null;
+    try {
+      invokeSetStoragePolicy(fs, path, policy);
+    }
+    catch (IOException e) {
+      t = e; 
+    }
+  
+    org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.Builder setStoragePolicyResponseBuilder =
+      org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.newBuilder();
+
+    if(t != null)
+    {
+      LOG.error("setStoragePolicy error : " + t.toString() );
+      setStoragePolicyResponseBuilder.setStatus(false);
+      setStoragePolicyResponseBuilder.setException(t.toString());
+    }
+    else
+    {
+      setStoragePolicyResponseBuilder.setStatus(true);
+      setStoragePolicyResponseBuilder.setException("");
+    }
+   
+    TrafSetStoragePolicyResponse resp = setStoragePolicyResponseBuilder.build();
+
+    done.run(resp);
+    
+  }
+
+  private static void invokeSetStoragePolicy(final FileSystem fs, final String pathstr,
+      final String storagePolicy)
+       throws IOException {
+        Path path = new Path(pathstr);
+        if(hdfsSetStoragePolicyMethod == null)
+             throw new IOException(hdfsSetStoragePolicyReflectErrorMsg);
+        if (hdfsSetStoragePolicyMethod != null) {
+          try {
+            hdfsSetStoragePolicyMethod.invoke(fs, path, storagePolicy);
+            if (LOG.isDebugEnabled()) {
+              LOG.debug("Set storagePolicy=" + storagePolicy + " for path=" + path);
+            }
+          } catch (Exception e) {
+               LOG.error("invoke set storage policy error : " , e);
+               throw new IOException(e);
+          }
+        }
+    }
+
+
   public void getTransactionStatesPriorToAsn(RpcController controller,
                                              TlogTransactionStatesFromIntervalRequest request,
                                              RpcCallback<TlogTransactionStatesFromIntervalResponse> done) {
@@ -3378,6 +3443,17 @@
 
     this.config = tmp_env.getConfiguration();
     this.fs = FileSystem.get(config);
+    try {
+          hdfsSetStoragePolicyMethod = fs.getClass().getDeclaredMethod("setStoragePolicy",
+            new Class<?>[] { Path.class, String.class });
+            hdfsSetStoragePolicyMethod.setAccessible(true);
+    } catch (NoSuchMethodException e) {
+            hdfsSetStoragePolicyMethod = null;
+            hdfsSetStoragePolicyReflectErrorMsg = "FileSystem doesn't support setStoragePolicy";
+    } catch (SecurityException e) {
+          hdfsSetStoragePolicyMethod = null;
+          hdfsSetStoragePolicyReflectErrorMsg = "No access to setStoragePolicy on FileSystem from the SecurityManager";
+    }
 
     synchronized (stoppableLock) {
       try {
diff --git a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/generated/SsccRegionProtos.java b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/generated/SsccRegionProtos.java
index dbbbba7..a7e49d4 100644
--- a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/generated/SsccRegionProtos.java
+++ b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/generated/SsccRegionProtos.java
@@ -21,6 +21,7 @@
  * * @@@ END COPYRIGHT @@@
  * **/
 
+
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: SsccRegion.proto
 
diff --git a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/generated/TrxRegionProtos.java b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/generated/TrxRegionProtos.java
index ea96915..65b1eff 100755
--- a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/generated/TrxRegionProtos.java
+++ b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/coprocessor/transactional/generated/TrxRegionProtos.java
@@ -1,25 +1,26 @@
 /**
-* @@@ START COPYRIGHT @@@
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*
-* @@@ END COPYRIGHT @@@
-**/
+ * * @@@ START COPYRIGHT @@@
+ * *
+ * * Licensed to the Apache Software Foundation (ASF) under one
+ * * or more contributor license agreements.  See the NOTICE file
+ * * distributed with this work for additional information
+ * * regarding copyright ownership.  The ASF licenses this file
+ * * to you under the Apache License, Version 2.0 (the
+ * * "License"); you may not use this file except in compliance
+ * * with the License.  You may obtain a copy of the License at
+ * *
+ * *   http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing,
+ * * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * * KIND, either express or implied.  See the License for the
+ * * specific language governing permissions and limitations
+ * * under the License.
+ * *
+ * * @@@ END COPYRIGHT @@@
+ * **/
+
 
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: TrxRegion.proto
@@ -43108,6 +43109,1217 @@
     // @@protoc_insertion_point(class_scope:TrafEstimateRowCountResponse)
   }
 
+  public interface TrafSetStoragePolicyRequestOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string path = 1;
+    /**
+     * <code>required string path = 1;</code>
+     */
+    boolean hasPath();
+    /**
+     * <code>required string path = 1;</code>
+     */
+    java.lang.String getPath();
+    /**
+     * <code>required string path = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getPathBytes();
+
+    // required string policy = 2;
+    /**
+     * <code>required string policy = 2;</code>
+     */
+    boolean hasPolicy();
+    /**
+     * <code>required string policy = 2;</code>
+     */
+    java.lang.String getPolicy();
+    /**
+     * <code>required string policy = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getPolicyBytes();
+  }
+  /**
+   * Protobuf type {@code TrafSetStoragePolicyRequest}
+   */
+  public static final class TrafSetStoragePolicyRequest extends
+      com.google.protobuf.GeneratedMessage
+      implements TrafSetStoragePolicyRequestOrBuilder {
+    // Use TrafSetStoragePolicyRequest.newBuilder() to construct.
+    private TrafSetStoragePolicyRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private TrafSetStoragePolicyRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final TrafSetStoragePolicyRequest defaultInstance;
+    public static TrafSetStoragePolicyRequest getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public TrafSetStoragePolicyRequest getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private TrafSetStoragePolicyRequest(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              path_ = input.readBytes();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              policy_ = input.readBytes();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.internal_static_TrafSetStoragePolicyRequest_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.internal_static_TrafSetStoragePolicyRequest_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.class, org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<TrafSetStoragePolicyRequest> PARSER =
+        new com.google.protobuf.AbstractParser<TrafSetStoragePolicyRequest>() {
+      public TrafSetStoragePolicyRequest parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new TrafSetStoragePolicyRequest(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<TrafSetStoragePolicyRequest> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string path = 1;
+    public static final int PATH_FIELD_NUMBER = 1;
+    private java.lang.Object path_;
+    /**
+     * <code>required string path = 1;</code>
+     */
+    public boolean hasPath() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string path = 1;</code>
+     */
+    public java.lang.String getPath() {
+      java.lang.Object ref = path_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          path_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string path = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getPathBytes() {
+      java.lang.Object ref = path_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        path_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // required string policy = 2;
+    public static final int POLICY_FIELD_NUMBER = 2;
+    private java.lang.Object policy_;
+    /**
+     * <code>required string policy = 2;</code>
+     */
+    public boolean hasPolicy() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>required string policy = 2;</code>
+     */
+    public java.lang.String getPolicy() {
+      java.lang.Object ref = policy_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          policy_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string policy = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getPolicyBytes() {
+      java.lang.Object ref = policy_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        policy_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    private void initFields() {
+      path_ = "";
+      policy_ = "";
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasPath()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasPolicy()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getPathBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getPolicyBytes());
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getPathBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getPolicyBytes());
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code TrafSetStoragePolicyRequest}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequestOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.internal_static_TrafSetStoragePolicyRequest_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.internal_static_TrafSetStoragePolicyRequest_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.class, org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.Builder.class);
+      }
+
+      // Construct using org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        path_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        policy_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.internal_static_TrafSetStoragePolicyRequest_descriptor;
+      }
+
+      public org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest getDefaultInstanceForType() {
+        return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.getDefaultInstance();
+      }
+
+      public org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest build() {
+        org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest buildPartial() {
+        org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest result = new org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.path_ = path_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.policy_ = policy_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest) {
+          return mergeFrom((org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest other) {
+        if (other == org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.getDefaultInstance()) return this;
+        if (other.hasPath()) {
+          bitField0_ |= 0x00000001;
+          path_ = other.path_;
+          onChanged();
+        }
+        if (other.hasPolicy()) {
+          bitField0_ |= 0x00000002;
+          policy_ = other.policy_;
+          onChanged();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasPath()) {
+          
+          return false;
+        }
+        if (!hasPolicy()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string path = 1;
+      private java.lang.Object path_ = "";
+      /**
+       * <code>required string path = 1;</code>
+       */
+      public boolean hasPath() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string path = 1;</code>
+       */
+      public java.lang.String getPath() {
+        java.lang.Object ref = path_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          path_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string path = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getPathBytes() {
+        java.lang.Object ref = path_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          path_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string path = 1;</code>
+       */
+      public Builder setPath(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        path_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string path = 1;</code>
+       */
+      public Builder clearPath() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        path_ = getDefaultInstance().getPath();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string path = 1;</code>
+       */
+      public Builder setPathBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        path_ = value;
+        onChanged();
+        return this;
+      }
+
+      // required string policy = 2;
+      private java.lang.Object policy_ = "";
+      /**
+       * <code>required string policy = 2;</code>
+       */
+      public boolean hasPolicy() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required string policy = 2;</code>
+       */
+      public java.lang.String getPolicy() {
+        java.lang.Object ref = policy_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          policy_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string policy = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getPolicyBytes() {
+        java.lang.Object ref = policy_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          policy_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string policy = 2;</code>
+       */
+      public Builder setPolicy(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        policy_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string policy = 2;</code>
+       */
+      public Builder clearPolicy() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        policy_ = getDefaultInstance().getPolicy();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string policy = 2;</code>
+       */
+      public Builder setPolicyBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        policy_ = value;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:TrafSetStoragePolicyRequest)
+    }
+
+    static {
+      defaultInstance = new TrafSetStoragePolicyRequest(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:TrafSetStoragePolicyRequest)
+  }
+
+  public interface TrafSetStoragePolicyResponseOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required bool status = 1;
+    /**
+     * <code>required bool status = 1;</code>
+     */
+    boolean hasStatus();
+    /**
+     * <code>required bool status = 1;</code>
+     */
+    boolean getStatus();
+
+    // required string exception = 2;
+    /**
+     * <code>required string exception = 2;</code>
+     */
+    boolean hasException();
+    /**
+     * <code>required string exception = 2;</code>
+     */
+    java.lang.String getException();
+    /**
+     * <code>required string exception = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getExceptionBytes();
+  }
+  /**
+   * Protobuf type {@code TrafSetStoragePolicyResponse}
+   */
+  public static final class TrafSetStoragePolicyResponse extends
+      com.google.protobuf.GeneratedMessage
+      implements TrafSetStoragePolicyResponseOrBuilder {
+    // Use TrafSetStoragePolicyResponse.newBuilder() to construct.
+    private TrafSetStoragePolicyResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private TrafSetStoragePolicyResponse(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final TrafSetStoragePolicyResponse defaultInstance;
+    public static TrafSetStoragePolicyResponse getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public TrafSetStoragePolicyResponse getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private TrafSetStoragePolicyResponse(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 8: {
+              bitField0_ |= 0x00000001;
+              status_ = input.readBool();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              exception_ = input.readBytes();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.internal_static_TrafSetStoragePolicyResponse_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.internal_static_TrafSetStoragePolicyResponse_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.class, org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<TrafSetStoragePolicyResponse> PARSER =
+        new com.google.protobuf.AbstractParser<TrafSetStoragePolicyResponse>() {
+      public TrafSetStoragePolicyResponse parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new TrafSetStoragePolicyResponse(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<TrafSetStoragePolicyResponse> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required bool status = 1;
+    public static final int STATUS_FIELD_NUMBER = 1;
+    private boolean status_;
+    /**
+     * <code>required bool status = 1;</code>
+     */
+    public boolean hasStatus() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required bool status = 1;</code>
+     */
+    public boolean getStatus() {
+      return status_;
+    }
+
+    // required string exception = 2;
+    public static final int EXCEPTION_FIELD_NUMBER = 2;
+    private java.lang.Object exception_;
+    /**
+     * <code>required string exception = 2;</code>
+     */
+    public boolean hasException() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>required string exception = 2;</code>
+     */
+    public java.lang.String getException() {
+      java.lang.Object ref = exception_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          exception_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string exception = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getExceptionBytes() {
+      java.lang.Object ref = exception_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        exception_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    private void initFields() {
+      status_ = false;
+      exception_ = "";
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasStatus()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasException()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBool(1, status_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getExceptionBytes());
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBoolSize(1, status_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getExceptionBytes());
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code TrafSetStoragePolicyResponse}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponseOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.internal_static_TrafSetStoragePolicyResponse_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.internal_static_TrafSetStoragePolicyResponse_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.class, org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.Builder.class);
+      }
+
+      // Construct using org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        status_ = false;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        exception_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.internal_static_TrafSetStoragePolicyResponse_descriptor;
+      }
+
+      public org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse getDefaultInstanceForType() {
+        return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.getDefaultInstance();
+      }
+
+      public org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse build() {
+        org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse buildPartial() {
+        org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse result = new org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.status_ = status_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.exception_ = exception_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse) {
+          return mergeFrom((org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse other) {
+        if (other == org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.getDefaultInstance()) return this;
+        if (other.hasStatus()) {
+          setStatus(other.getStatus());
+        }
+        if (other.hasException()) {
+          bitField0_ |= 0x00000002;
+          exception_ = other.exception_;
+          onChanged();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasStatus()) {
+          
+          return false;
+        }
+        if (!hasException()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required bool status = 1;
+      private boolean status_ ;
+      /**
+       * <code>required bool status = 1;</code>
+       */
+      public boolean hasStatus() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required bool status = 1;</code>
+       */
+      public boolean getStatus() {
+        return status_;
+      }
+      /**
+       * <code>required bool status = 1;</code>
+       */
+      public Builder setStatus(boolean value) {
+        bitField0_ |= 0x00000001;
+        status_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required bool status = 1;</code>
+       */
+      public Builder clearStatus() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        status_ = false;
+        onChanged();
+        return this;
+      }
+
+      // required string exception = 2;
+      private java.lang.Object exception_ = "";
+      /**
+       * <code>required string exception = 2;</code>
+       */
+      public boolean hasException() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required string exception = 2;</code>
+       */
+      public java.lang.String getException() {
+        java.lang.Object ref = exception_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          exception_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string exception = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getExceptionBytes() {
+        java.lang.Object ref = exception_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          exception_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string exception = 2;</code>
+       */
+      public Builder setException(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        exception_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string exception = 2;</code>
+       */
+      public Builder clearException() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        exception_ = getDefaultInstance().getException();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string exception = 2;</code>
+       */
+      public Builder setExceptionBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        exception_ = value;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:TrafSetStoragePolicyResponse)
+    }
+
+    static {
+      defaultInstance = new TrafSetStoragePolicyResponse(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:TrafSetStoragePolicyResponse)
+  }
+
   public interface TransactionalAggregateRequestOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
 
@@ -48128,6 +49340,14 @@
           org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateRequest request,
           com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse> done);
 
+      /**
+       * <code>rpc setStoragePolicy(.TrafSetStoragePolicyRequest) returns (.TrafSetStoragePolicyResponse);</code>
+       */
+      public abstract void setStoragePolicy(
+          com.google.protobuf.RpcController controller,
+          org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest request,
+          com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse> done);
+
     }
 
     public static com.google.protobuf.Service newReflectiveService(
@@ -48413,6 +49633,14 @@
           impl.getMedian(controller, request, done);
         }
 
+        @java.lang.Override
+        public  void setStoragePolicy(
+            com.google.protobuf.RpcController controller,
+            org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest request,
+            com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse> done) {
+          impl.setStoragePolicy(controller, request, done);
+        }
+
       };
     }
 
@@ -48505,6 +49733,8 @@
               return impl.getStd(controller, (org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateRequest)request);
             case 34:
               return impl.getMedian(controller, (org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateRequest)request);
+            case 35:
+              return impl.setStoragePolicy(controller, (org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest)request);
             default:
               throw new java.lang.AssertionError("Can't get here.");
           }
@@ -48589,6 +49819,8 @@
               return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateRequest.getDefaultInstance();
             case 34:
               return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateRequest.getDefaultInstance();
+            case 35:
+              return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.getDefaultInstance();
             default:
               throw new java.lang.AssertionError("Can't get here.");
           }
@@ -48673,6 +49905,8 @@
               return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse.getDefaultInstance();
             case 34:
               return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse.getDefaultInstance();
+            case 35:
+              return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.getDefaultInstance();
             default:
               throw new java.lang.AssertionError("Can't get here.");
           }
@@ -48961,6 +50195,14 @@
         org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateRequest request,
         com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse> done);
 
+    /**
+     * <code>rpc setStoragePolicy(.TrafSetStoragePolicyRequest) returns (.TrafSetStoragePolicyResponse);</code>
+     */
+    public abstract void setStoragePolicy(
+        com.google.protobuf.RpcController controller,
+        org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest request,
+        com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse> done);
+
     public static final
         com.google.protobuf.Descriptors.ServiceDescriptor
         getDescriptor() {
@@ -49158,6 +50400,11 @@
             com.google.protobuf.RpcUtil.<org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse>specializeCallback(
               done));
           return;
+        case 35:
+          this.setStoragePolicy(controller, (org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest)request,
+            com.google.protobuf.RpcUtil.<org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse>specializeCallback(
+              done));
+          return;
         default:
           throw new java.lang.AssertionError("Can't get here.");
       }
@@ -49242,6 +50489,8 @@
           return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateRequest.getDefaultInstance();
         case 34:
           return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateRequest.getDefaultInstance();
+        case 35:
+          return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest.getDefaultInstance();
         default:
           throw new java.lang.AssertionError("Can't get here.");
       }
@@ -49326,6 +50575,8 @@
           return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse.getDefaultInstance();
         case 34:
           return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse.getDefaultInstance();
+        case 35:
+          return org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.getDefaultInstance();
         default:
           throw new java.lang.AssertionError("Can't get here.");
       }
@@ -49871,6 +51122,21 @@
             org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse.class,
             org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse.getDefaultInstance()));
       }
+
+      public  void setStoragePolicy(
+          com.google.protobuf.RpcController controller,
+          org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest request,
+          com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse> done) {
+        channel.callMethod(
+          getDescriptor().getMethods().get(35),
+          controller,
+          request,
+          org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.getDefaultInstance(),
+          com.google.protobuf.RpcUtil.generalizeCallback(
+            done,
+            org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.class,
+            org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.getDefaultInstance()));
+      }
     }
 
     public static BlockingInterface newBlockingStub(
@@ -50053,6 +51319,11 @@
           com.google.protobuf.RpcController controller,
           org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateRequest request)
           throws com.google.protobuf.ServiceException;
+
+      public org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse setStoragePolicy(
+          com.google.protobuf.RpcController controller,
+          org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest request)
+          throws com.google.protobuf.ServiceException;
     }
 
     private static final class BlockingStub implements BlockingInterface {
@@ -50481,6 +51752,18 @@
           org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TransactionalAggregateResponse.getDefaultInstance());
       }
 
+
+      public org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse setStoragePolicy(
+          com.google.protobuf.RpcController controller,
+          org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyRequest request)
+          throws com.google.protobuf.ServiceException {
+        return (org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse) channel.callBlockingMethod(
+          getDescriptor().getMethods().get(35),
+          controller,
+          request,
+          org.apache.hadoop.hbase.coprocessor.transactional.generated.TrxRegionProtos.TrafSetStoragePolicyResponse.getDefaultInstance());
+      }
+
     }
 
     // @@protoc_insertion_point(class_scope:TrxRegionService)
@@ -50767,6 +52050,16 @@
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_TrafEstimateRowCountResponse_fieldAccessorTable;
   private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_TrafSetStoragePolicyRequest_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_TrafSetStoragePolicyRequest_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_TrafSetStoragePolicyResponse_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_TrafSetStoragePolicyResponse_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
     internal_static_TransactionalAggregateRequest_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
@@ -50949,88 +52242,94 @@
       "\003\022\026\n\016totalSizeBytes\030\002 \002(\003\022\025\n\rputKVsSampl" +
       "ed\030\003 \002(\005\022\030\n\020nonPutKVsSampled\030\004 \002(\005\022\027\n\017mi" +
       "ssingKVsCount\030\005 \002(\005\022\021\n\texception\030\006 \001(\t\022\024" +
-      "\n\014hasException\030\007 \001(\010\"\264\001\n\035TransactionalAg" +
-      "gregateRequest\022\022\n\nregionName\030\001 \002(\014\022\025\n\rtr" +
-      "ansactionId\030\002 \002(\003\022\017\n\007startId\030\003 \002(\003\022\036\n\026in" +
-      "terpreter_class_name\030\004 \002(\t\022\023\n\004scan\030\005 \002(\013" +
-      "2\005.Scan\022\"\n\032interpreter_specific_bytes\030\006 " +
-      "\001(\014\"I\n\036TransactionalAggregateResponse\022\022\n",
-      "\nfirst_part\030\003 \003(\014\022\023\n\013second_part\030\004 \001(\014\"x" +
-      "\n\022TransactionPersist\022\016\n\006txById\030\001 \003(\003\022\024\n\014" +
-      "seqNoListSeq\030\002 \003(\003\022\024\n\014seqNoListTxn\030\003 \003(\003" +
-      "\022\021\n\tnextSeqId\030\004 \002(\003\022\023\n\013onlineEpoch\030\005 \002(\003" +
-      "\"\372\001\n\023TransactionStateMsg\022\014\n\004txId\030\001 \002(\003\022\033" +
-      "\n\003put\030\002 \003(\0132\016.MutationProto\022\036\n\006delete\030\003 " +
-      "\003(\0132\016.MutationProto\022\020\n\010putOrDel\030\004 \003(\010\022\023\n" +
-      "\013txnsToCheck\030\005 \003(\003\022\023\n\013startSeqNum\030\006 \002(\003\022" +
-      "\016\n\006seqNum\030\007 \002(\003\022\020\n\010logSeqId\030\010 \002(\003\022\022\n\nrei" +
-      "nstated\030\t \002(\010\022\016\n\006status\030\n \002(\005\022\026\n\016commitP",
-      "rogress\030\013 \002(\0052\353\023\n\020TrxRegionService\022G\n\020ab" +
-      "ortTransaction\022\030.AbortTransactionRequest" +
-      "\032\031.AbortTransactionResponse\022_\n\030abortTran" +
-      "sactionMultiple\022 .AbortTransactionMultip" +
-      "leRequest\032!.AbortTransactionMultipleResp" +
-      "onse\022G\n\020beginTransaction\022\030.BeginTransact" +
-      "ionRequest\032\031.BeginTransactionResponse\022A\n" +
-      "\016checkAndDelete\022\026.CheckAndDeleteRequest\032" +
-      "\027.CheckAndDeleteResponse\022Y\n\026checkAndDele" +
-      "teRegionTx\022\036.CheckAndDeleteRegionTxReque",
-      "st\032\037.CheckAndDeleteRegionTxResponse\0228\n\013c" +
-      "heckAndPut\022\023.CheckAndPutRequest\032\024.CheckA" +
-      "ndPutResponse\022P\n\023checkAndPutRegionTx\022\033.C" +
-      "heckAndPutRegionTxRequest\032\034.CheckAndPutR" +
-      "egionTxResponse\022;\n\014closeScanner\022\024.CloseS" +
-      "cannerRequest\032\025.CloseScannerResponse\022)\n\006" +
-      "commit\022\016.CommitRequest\032\017.CommitResponse\022" +
-      "G\n\020commitIfPossible\022\030.CommitIfPossibleRe" +
-      "quest\032\031.CommitIfPossibleResponse\022V\n\025comm" +
-      "itRequestMultiple\022\035.CommitRequestMultipl",
-      "eRequest\032\036.CommitRequestMultipleResponse" +
-      "\022A\n\016commitMultiple\022\026.CommitMultipleReque" +
-      "st\032\027.CommitMultipleResponse\022>\n\rcommitReq" +
-      "uest\022\025.CommitRequestRequest\032\026.CommitRequ" +
-      "estResponse\022A\n\016deleteRegionTx\022\026.DeleteRe" +
-      "gionTxRequest\032\027.DeleteRegionTxResponse\022C" +
-      "\n\006delete\022\033.DeleteTransactionalRequest\032\034." +
-      "DeleteTransactionalResponse\022[\n\016deleteMul" +
-      "tiple\022#.DeleteMultipleTransactionalReque" +
-      "st\032$.DeleteMultipleTransactionalResponse",
-      "\022:\n\003get\022\030.GetTransactionalRequest\032\031.GetT" +
-      "ransactionalResponse\0228\n\013performScan\022\023.Pe" +
-      "rformScanRequest\032\024.PerformScanResponse\0228" +
-      "\n\013openScanner\022\023.OpenScannerRequest\032\024.Ope" +
-      "nScannerResponse\0228\n\013putRegionTx\022\023.PutReg" +
-      "ionTxRequest\032\024.PutRegionTxResponse\022:\n\003pu" +
-      "t\022\030.PutTransactionalRequest\032\031.PutTransac" +
-      "tionalResponse\022R\n\013putMultiple\022 .PutMulti" +
-      "pleTransactionalRequest\032!.PutMultipleTra" +
-      "nsactionalResponse\0228\n\017pushOnlineEpoch\022\021.",
-      "PushEpochRequest\032\022.PushEpochResponse\022D\n\017" +
-      "recoveryRequest\022\027.RecoveryRequestRequest" +
-      "\032\030.RecoveryRequestResponse\022<\n\021deleteTlog" +
-      "Entries\022\022.TlogDeleteRequest\032\023.TlogDelete" +
-      "Response\0220\n\007putTlog\022\021.TlogWriteRequest\032\022" +
-      ".TlogWriteResponse\022w\n\036getTransactionStat" +
-      "esPriorToAsn\022).TlogTransactionStatesFrom" +
-      "IntervalRequest\032*.TlogTransactionStatesF" +
-      "romIntervalResponse\022S\n\024trafEstimateRowCo" +
-      "unt\022\034.TrafEstimateRowCountRequest\032\035.Traf",
-      "EstimateRowCountResponse\022I\n\006GetMax\022\036.Tra" +
-      "nsactionalAggregateRequest\032\037.Transaction" +
-      "alAggregateResponse\022I\n\006GetMin\022\036.Transact" +
-      "ionalAggregateRequest\032\037.TransactionalAgg" +
-      "regateResponse\022I\n\006GetSum\022\036.Transactional" +
-      "AggregateRequest\032\037.TransactionalAggregat" +
-      "eResponse\022L\n\tGetRowNum\022\036.TransactionalAg" +
-      "gregateRequest\032\037.TransactionalAggregateR" +
-      "esponse\022I\n\006GetAvg\022\036.TransactionalAggrega" +
-      "teRequest\032\037.TransactionalAggregateRespon",
-      "se\022I\n\006GetStd\022\036.TransactionalAggregateReq" +
-      "uest\032\037.TransactionalAggregateResponse\022L\n" +
-      "\tGetMedian\022\036.TransactionalAggregateReque" +
-      "st\032\037.TransactionalAggregateResponseBS\n;o" +
-      "rg.apache.hadoop.hbase.coprocessor.trans" +
-      "actional.generatedB\017TrxRegionProtosH\001\210\001\001"
+      "\n\014hasException\030\007 \001(\010\";\n\033TrafSetStoragePo" +
+      "licyRequest\022\014\n\004path\030\001 \002(\t\022\016\n\006policy\030\002 \002(" +
+      "\t\"A\n\034TrafSetStoragePolicyResponse\022\016\n\006sta" +
+      "tus\030\001 \002(\010\022\021\n\texception\030\002 \002(\t\"\264\001\n\035Transac" +
+      "tionalAggregateRequest\022\022\n\nregionName\030\001 \002" +
+      "(\014\022\025\n\rtransactionId\030\002 \002(\003\022\017\n\007startId\030\003 \002",
+      "(\003\022\036\n\026interpreter_class_name\030\004 \002(\t\022\023\n\004sc" +
+      "an\030\005 \002(\0132\005.Scan\022\"\n\032interpreter_specific_" +
+      "bytes\030\006 \001(\014\"I\n\036TransactionalAggregateRes" +
+      "ponse\022\022\n\nfirst_part\030\003 \003(\014\022\023\n\013second_part" +
+      "\030\004 \001(\014\"x\n\022TransactionPersist\022\016\n\006txById\030\001" +
+      " \003(\003\022\024\n\014seqNoListSeq\030\002 \003(\003\022\024\n\014seqNoListT" +
+      "xn\030\003 \003(\003\022\021\n\tnextSeqId\030\004 \002(\003\022\023\n\013onlineEpo" +
+      "ch\030\005 \002(\003\"\372\001\n\023TransactionStateMsg\022\014\n\004txId" +
+      "\030\001 \002(\003\022\033\n\003put\030\002 \003(\0132\016.MutationProto\022\036\n\006d" +
+      "elete\030\003 \003(\0132\016.MutationProto\022\020\n\010putOrDel\030",
+      "\004 \003(\010\022\023\n\013txnsToCheck\030\005 \003(\003\022\023\n\013startSeqNu" +
+      "m\030\006 \002(\003\022\016\n\006seqNum\030\007 \002(\003\022\020\n\010logSeqId\030\010 \002(" +
+      "\003\022\022\n\nreinstated\030\t \002(\010\022\016\n\006status\030\n \002(\005\022\026\n" +
+      "\016commitProgress\030\013 \002(\0052\274\024\n\020TrxRegionServi" +
+      "ce\022G\n\020abortTransaction\022\030.AbortTransactio" +
+      "nRequest\032\031.AbortTransactionResponse\022_\n\030a" +
+      "bortTransactionMultiple\022 .AbortTransacti" +
+      "onMultipleRequest\032!.AbortTransactionMult" +
+      "ipleResponse\022G\n\020beginTransaction\022\030.Begin" +
+      "TransactionRequest\032\031.BeginTransactionRes",
+      "ponse\022A\n\016checkAndDelete\022\026.CheckAndDelete" +
+      "Request\032\027.CheckAndDeleteResponse\022Y\n\026chec" +
+      "kAndDeleteRegionTx\022\036.CheckAndDeleteRegio" +
+      "nTxRequest\032\037.CheckAndDeleteRegionTxRespo" +
+      "nse\0228\n\013checkAndPut\022\023.CheckAndPutRequest\032" +
+      "\024.CheckAndPutResponse\022P\n\023checkAndPutRegi" +
+      "onTx\022\033.CheckAndPutRegionTxRequest\032\034.Chec" +
+      "kAndPutRegionTxResponse\022;\n\014closeScanner\022" +
+      "\024.CloseScannerRequest\032\025.CloseScannerResp" +
+      "onse\022)\n\006commit\022\016.CommitRequest\032\017.CommitR",
+      "esponse\022G\n\020commitIfPossible\022\030.CommitIfPo" +
+      "ssibleRequest\032\031.CommitIfPossibleResponse" +
+      "\022V\n\025commitRequestMultiple\022\035.CommitReques" +
+      "tMultipleRequest\032\036.CommitRequestMultiple" +
+      "Response\022A\n\016commitMultiple\022\026.CommitMulti" +
+      "pleRequest\032\027.CommitMultipleResponse\022>\n\rc" +
+      "ommitRequest\022\025.CommitRequestRequest\032\026.Co" +
+      "mmitRequestResponse\022A\n\016deleteRegionTx\022\026." +
+      "DeleteRegionTxRequest\032\027.DeleteRegionTxRe" +
+      "sponse\022C\n\006delete\022\033.DeleteTransactionalRe",
+      "quest\032\034.DeleteTransactionalResponse\022[\n\016d" +
+      "eleteMultiple\022#.DeleteMultipleTransactio" +
+      "nalRequest\032$.DeleteMultipleTransactional" +
+      "Response\022:\n\003get\022\030.GetTransactionalReques" +
+      "t\032\031.GetTransactionalResponse\0228\n\013performS" +
+      "can\022\023.PerformScanRequest\032\024.PerformScanRe" +
+      "sponse\0228\n\013openScanner\022\023.OpenScannerReque" +
+      "st\032\024.OpenScannerResponse\0228\n\013putRegionTx\022" +
+      "\023.PutRegionTxRequest\032\024.PutRegionTxRespon" +
+      "se\022:\n\003put\022\030.PutTransactionalRequest\032\031.Pu",
+      "tTransactionalResponse\022R\n\013putMultiple\022 ." +
+      "PutMultipleTransactionalRequest\032!.PutMul" +
+      "tipleTransactionalResponse\0228\n\017pushOnline" +
+      "Epoch\022\021.PushEpochRequest\032\022.PushEpochResp" +
+      "onse\022D\n\017recoveryRequest\022\027.RecoveryReques" +
+      "tRequest\032\030.RecoveryRequestResponse\022<\n\021de" +
+      "leteTlogEntries\022\022.TlogDeleteRequest\032\023.Tl" +
+      "ogDeleteResponse\0220\n\007putTlog\022\021.TlogWriteR" +
+      "equest\032\022.TlogWriteResponse\022w\n\036getTransac" +
+      "tionStatesPriorToAsn\022).TlogTransactionSt",
+      "atesFromIntervalRequest\032*.TlogTransactio" +
+      "nStatesFromIntervalResponse\022S\n\024trafEstim" +
+      "ateRowCount\022\034.TrafEstimateRowCountReques" +
+      "t\032\035.TrafEstimateRowCountResponse\022I\n\006GetM" +
+      "ax\022\036.TransactionalAggregateRequest\032\037.Tra" +
+      "nsactionalAggregateResponse\022I\n\006GetMin\022\036." +
+      "TransactionalAggregateRequest\032\037.Transact" +
+      "ionalAggregateResponse\022I\n\006GetSum\022\036.Trans" +
+      "actionalAggregateRequest\032\037.Transactional" +
+      "AggregateResponse\022L\n\tGetRowNum\022\036.Transac",
+      "tionalAggregateRequest\032\037.TransactionalAg" +
+      "gregateResponse\022I\n\006GetAvg\022\036.Transactiona" +
+      "lAggregateRequest\032\037.TransactionalAggrega" +
+      "teResponse\022I\n\006GetStd\022\036.TransactionalAggr" +
+      "egateRequest\032\037.TransactionalAggregateRes" +
+      "ponse\022L\n\tGetMedian\022\036.TransactionalAggreg" +
+      "ateRequest\032\037.TransactionalAggregateRespo" +
+      "nse\022O\n\020setStoragePolicy\022\034.TrafSetStorage" +
+      "PolicyRequest\032\035.TrafSetStoragePolicyResp" +
+      "onseBS\n;org.apache.hadoop.hbase.coproces",
+      "sor.transactional.generatedB\017TrxRegionPr" +
+      "otosH\001\210\001\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -51373,26 +52672,38 @@
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_TrafEstimateRowCountResponse_descriptor,
               new java.lang.String[] { "TotalEntries", "TotalSizeBytes", "PutKVsSampled", "NonPutKVsSampled", "MissingKVsCount", "Exception", "HasException", });
-          internal_static_TransactionalAggregateRequest_descriptor =
+          internal_static_TrafSetStoragePolicyRequest_descriptor =
             getDescriptor().getMessageTypes().get(56);
+          internal_static_TrafSetStoragePolicyRequest_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_TrafSetStoragePolicyRequest_descriptor,
+              new java.lang.String[] { "Path", "Policy", });
+          internal_static_TrafSetStoragePolicyResponse_descriptor =
+            getDescriptor().getMessageTypes().get(57);
+          internal_static_TrafSetStoragePolicyResponse_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_TrafSetStoragePolicyResponse_descriptor,
+              new java.lang.String[] { "Status", "Exception", });
+          internal_static_TransactionalAggregateRequest_descriptor =
+            getDescriptor().getMessageTypes().get(58);
           internal_static_TransactionalAggregateRequest_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_TransactionalAggregateRequest_descriptor,
               new java.lang.String[] { "RegionName", "TransactionId", "StartId", "InterpreterClassName", "Scan", "InterpreterSpecificBytes", });
           internal_static_TransactionalAggregateResponse_descriptor =
-            getDescriptor().getMessageTypes().get(57);
+            getDescriptor().getMessageTypes().get(59);
           internal_static_TransactionalAggregateResponse_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_TransactionalAggregateResponse_descriptor,
               new java.lang.String[] { "FirstPart", "SecondPart", });
           internal_static_TransactionPersist_descriptor =
-            getDescriptor().getMessageTypes().get(58);
+            getDescriptor().getMessageTypes().get(60);
           internal_static_TransactionPersist_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_TransactionPersist_descriptor,
               new java.lang.String[] { "TxById", "SeqNoListSeq", "SeqNoListTxn", "NextSeqId", "OnlineEpoch", });
           internal_static_TransactionStateMsg_descriptor =
-            getDescriptor().getMessageTypes().get(59);
+            getDescriptor().getMessageTypes().get(61);
           internal_static_TransactionStateMsg_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_TransactionStateMsg_descriptor,
diff --git a/core/sqf/src/seatrans/hbase-trx/src/main/protobuf/TrxRegion.proto b/core/sqf/src/seatrans/hbase-trx/src/main/protobuf/TrxRegion.proto
index b3edbfa..357b15b 100755
--- a/core/sqf/src/seatrans/hbase-trx/src/main/protobuf/TrxRegion.proto
+++ b/core/sqf/src/seatrans/hbase-trx/src/main/protobuf/TrxRegion.proto
@@ -421,6 +421,16 @@
   optional bool hasException = 7;
 }
 
+message TrafSetStoragePolicyRequest {
+  required  string path = 1;
+  required  string policy = 2;
+}
+
+message TrafSetStoragePolicyResponse {
+  required bool status = 1;
+  required string exception = 2;
+}
+
 message TransactionalAggregateRequest {
   /** The request passed to the TransactionalAggregateService consists of three parts
    *  (1) the (canonical) classname of the ColumnInterpreter implementation
@@ -543,4 +553,7 @@
     returns (TransactionalAggregateResponse);
   rpc GetMedian (TransactionalAggregateRequest) 
     returns (TransactionalAggregateResponse);
+  rpc setStoragePolicy (TrafSetStoragePolicyRequest)
+    returns (TrafSetStoragePolicyResponse);
+
 }
diff --git a/core/sql/arkcmp/CmpContext.cpp b/core/sql/arkcmp/CmpContext.cpp
index 78c3c63..e502047 100644
--- a/core/sql/arkcmp/CmpContext.cpp
+++ b/core/sql/arkcmp/CmpContext.cpp
@@ -863,6 +863,17 @@
         copyData = TRUE;
         break;
       } // end of case (CmpMessageObj::DDL)
+      case (CmpMessageObj::DDL_WITH_STATUS) :
+      {
+        // request is from ExDDLTcb::work() to get statement explain
+        cmpStatement = new CTXTHEAP CmpStatement(this);
+        CmpMessageDDLwithStatus ddlStmt(data, data_len, CTXTHEAP);
+ 
+        Assign_SqlParser_Flags(parserFlags);
+        rs = cmpStatement->process(ddlStmt);
+        copyData = TRUE;
+        break;
+      } // end of case (CmpMessageObj::DDL)
       case (CmpMessageObj::DESCRIBE) :
       {
         // request is from ExDescribeTcb::work() to get statement explain
diff --git a/core/sql/arkcmp/CmpStatement.cpp b/core/sql/arkcmp/CmpStatement.cpp
index f66baae..7f72a99 100644
--- a/core/sql/arkcmp/CmpStatement.cpp
+++ b/core/sql/arkcmp/CmpStatement.cpp
@@ -151,7 +151,6 @@
   recompiling_ = FALSE;
   isDDL_ = FALSE;
   isSMDRecompile_ = FALSE;
-  isParallelLabelOp_ = FALSE;
   displayGraph_ = FALSE;
   cses_ = NULL;
   detailsOnRefusedRequirements_ = NULL;
@@ -996,7 +995,7 @@
                                          currCatName, currSchName))
         return CmpStatement_ERROR;
     }
-  else if (dws->getMDcleanup())
+  else if (dws->getMDcleanup() || dws->getInitTraf())
     {
       CmpSeabaseDDL cmpSBD(heap_);
       if (cmpSBD.executeSeabaseDDL(ddlExpr, ddlNode,
diff --git a/core/sql/arkcmp/CmpStatement.h b/core/sql/arkcmp/CmpStatement.h
index 097d0cf..c5d8dad 100644
--- a/core/sql/arkcmp/CmpStatement.h
+++ b/core/sql/arkcmp/CmpStatement.h
@@ -160,9 +160,6 @@
   //is this statement a DDL statement
   inline NABoolean isDDL(){return isDDL_;}
 
-  inline NABoolean isParallelLabelOp() { return isParallelLabelOp_; }
-  inline void setParallelLabelOp(NABoolean flag) { isParallelLabelOp_ = flag; }
-
   QueryAnalysis* getQueryAnalysis() { return queryAnalysis_; };
   QueryAnalysis* initQueryAnalysis();
 
@@ -292,8 +289,6 @@
   //flag, indicates if this is a DDL statment
   NABoolean isDDL_;
 
-  NABoolean isParallelLabelOp_;
-
   // CompilationStats object that is recording the compilation stats for this statement
   CompilationStats* compStats_;
 
diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt
index ee51272..3437cef 100644
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@ -887,7 +887,7 @@
 3131 0A000 99999 BEGINNER MAJOR DBADMIN The statement just entered is currently not supported.
 3132 42000 99999 BEGINNER MAJOR DBADMIN The HEADING for column $0~ColumnName exceeds the maximum size of 128 characters.
 3133 42000 99999 BEGINNER MAJOR DBADMIN PERFORM is valid only in COBOL programs.
-3134 42000 99999 BEGINNER MAJOR DBADMIN The specified TIME or TIMESTAMP precision value, $0~int0, cannot exceed 6.
+3134 42000 99999 BEGINNER MAJOR DBADMIN The specified TIME or TIMESTAMP precision value, $0~int0, cannot exceed 9.
 3135 42000 99999 BEGINNER MAJOR DBADMIN The precision of float, $0~int0, cannot exceed 54.
 3136 42000 99999 BEGINNER MAJOR DBADMIN Only LEFT, RIGHT, and FULL OUTER JOIN are valid in {oj ...}
 3137 0A000 99999 BEGINNER MAJOR DBADMIN UNION JOIN is not yet supported.
@@ -1449,6 +1449,8 @@
 4493 ZZZZZ 99999 BEGINNER MINOR LOGONLY Stored Descriptor Status: $0~String0
 4494 ZZZZZ 99999 BEGINNER MINOR LOGONLY LOAD is not supported on a table with LOB columns. Table $0~TableName has LOB column $1~ColumnName.
 4495 ZZZZZ 99999 BEGINNER MINOR LOGONLY UNLOAD is not supported on a SELECT with LOB columns. $0~ColumnName is a LOB column.
+4496 42000 99999 BEGINNER MAJOR DBADMIN $0~String0 is supported only with datetime fields.
+4497 ZZZZZ 99999 BEGINNER MAJOR DBADMIN The $0~String0 operand of $1~String1 must be $2~String2.
 5000 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Internal error in the query normalizer.
 5001 ZZZZZ 99999 ADVANDED MINOR LOGONLY Common subexpression $0~String0 will not be shared among multiple consumers. Reason: $1~String1.
 6000 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Internal error in the query optimizer.
@@ -1578,7 +1580,7 @@
 8437 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Mismatch detected between external table and underlying hive table definitions.
 8440 ZZZZZ 99999 BEGINNER MAJOR DBADMIN The size of the history buffer is too small to execute one or more of the OLAP Windowed Functions in the query. 
 8441 ZZZZZ 99999 BEGINNER MAJOR DBADMIN one or more of the OLAP Windowed Functions in the query may require overflow which is not supported yet.
-8442 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Unable to access $0~string0 interface. Call to $1~string1 returned error $2~string2($0~int0). Error detail $1~int1.
+8442 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Unable to access $0~string0 interface. Call to $0~string0 returned error $1~string1($0~int0). Error detail: $1~int1. Cause: $2~string2.
 8443 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Provided LOB handle is invalid.
 8444 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Only one lob handle can be returned by child for data extract.
 8445 ZZZZZ 99999 BEGINNER MAJOR DBADMIN An error occurred during transformation of hdfs row to sql row. Error Detail: $0~string0 
@@ -1589,6 +1591,7 @@
 8450 ZZZZZ 99999 BEGINNER MINOR LOGONLY ESP number ($0~Int0) has processed ($1~Int1) transactions of the LRU operation on table $2~String0.
 8451 ZZZZZ 99999 BEGINNER MINOR LOGONLY Error $0~String0  returned while retrieving region stats from hbase.
 8452 ZZZZZ 99999 BEGINNER MINOR LOGONLY The regular expression is invalid. Cause: $0~String0
+8453 ZZZZZ 99999 BEGINNER MINOR LOGONLY This expression results in an invalid interval value '$0~String0'
 8550 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Error $0~NSKCode was returned by the Data Access Manager.
 8551 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Error $0~NSKCode was returned by the file system on $0~string0$1~string1.
 8552 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Error $0~int0 was returned by the file system while fetching the version of the system $0~string0.
@@ -1681,7 +1684,7 @@
 8676 ZZZZZ 99999 ADVANCED INFRM DBADMIN Cannot suspend the query because it is already suspended.
 8677 ZZZZZ 99999 ADVANCED INFRM DBADMIN Cannot activate the query because it is not suspended.
 8690 ZZZZZ 99999 BEGINNER MINOR LOGONLY An invalid character value encountered in TRANSLATE function. Source charset $0~string0 , Target charset $1~string1. Error data in HEX: $2~string2 .
-8691 ZZZZZ 99999 UUUUUUUU UUUUU UUUUUUU ---- unused ----
+8691 ZZZZZ 99999 BEGINNER MINOR LOGONLY Field position must be greater than zero, currently is $0~int0.
 8692 ZZZZZ 99999 UUUUUUUU UUUUU UUUUUUU ---- unused ----
 8693 ZZZZZ 99999 UUUUUUUU UUUUU UUUUUUU ---- unused ----
 8694 ZZZZZ 99999 UUUUUUUU UUUUU UUUUUUU ---- unused ----
diff --git a/core/sql/bin/ex_sscp_main.cpp b/core/sql/bin/ex_sscp_main.cpp
index a1f1f2b..40b19e2 100644
--- a/core/sql/bin/ex_sscp_main.cpp
+++ b/core/sql/bin/ex_sscp_main.cpp
@@ -165,7 +165,7 @@
   struct tm *nowtm;
 
   long maxSegSize = STATS_MAX_SEG_SIZE;
-  char *envSegSize = getenv("MX_RTS_STATS_SEG_SIZE");
+  char *envSegSize = getenv("RMS_SHARED_SEG_SIZE_MB");
   if (envSegSize)
   {
     maxSegSize = (long) str_atoi(envSegSize, str_len(envSegSize));
diff --git a/core/sql/cli/Cli.cpp b/core/sql/cli/Cli.cpp
index a942bca..9e14307 100644
--- a/core/sql/cli/Cli.cpp
+++ b/core/sql/cli/Cli.cpp
@@ -7148,6 +7148,18 @@
       }
     break;
 
+    case SQLTRANS_SUSPEND:
+      {
+        currContext.getTransaction()->suspendTransaction();
+      }
+    break;
+
+    case SQLTRANS_RESUME:
+      {
+        currContext.getTransaction()->resumeTransaction();
+      }
+    break;
+
     default:
       diags << DgSqlCode(-CLI_INVALID_SQLTRANS_COMMAND);
       return SQLCLI_ReturnCode(&currContext,diags.mainSQLCODE());
@@ -9397,7 +9409,7 @@
       ExRaiseSqlError(currContext.exHeap(), &da, 
                       (ExeErrorCode)(8442), NULL, &cliRC    , 
                       &rc, NULL, (char*)"Lob GC call",
-                      getLobErrStr(rc));
+		      getLobErrStr(rc), (char*)getSqlJniErrorStr());
       // TBD When local transaction support is in
       // rollback all the updates to the lob desc chunks file too. 
       // return with warning
@@ -9466,7 +9478,7 @@
   ComDiagsArea & diags       = currContext.diags();
 
   ComDiagsArea * myDiags = NULL;
-
+  NABoolean useLibHdfs = currContext.getSessionDefaults()->getUseLibHdfs();
   char logBuf[4096];
   lobDebugInfo("In LOBddlInterface",0,__LINE__,lobTrace);
   ExeCliInterface *cliInterface = NULL;
@@ -9486,6 +9498,7 @@
   char * query = new(currContext.exHeap()) char[4096];
   char *hdfsServer = new(currContext.exHeap()) char[256];
   strcpy(hdfsServer,lobHdfsServer);
+  Int32 rc = 0;
   switch (qType)
     {
     case LOB_CLI_CREATE:
@@ -9525,19 +9538,18 @@
 
         //Initialize LOB interface 
         
-        Int32 rc= ExpLOBoper::initLOBglobal(exLobGlob,currContext.exHeap(),&currContext,hdfsServer,hdfsPort);
-        if (rc)
+        exLobGlob = ExpLOBoper::initLOBglobal(currContext.exHeap(), &currContext, useLibHdfs);
+        if (exLobGlob == NULL) 
           {
             cliRC = 0;
             ComDiagsArea * da = &diags;
             ExRaiseSqlError(currContext.exHeap(), &da, 
 			    (ExeErrorCode)(8442), NULL, &cliRC    , 
 			    &rc, NULL, (char*)"ExpLOBInterfaceCreate",
-
-			    getLobErrStr(rc));
+		            getLobErrStr(rc), (char*)getSqlJniErrorStr());
             goto non_cli_error_return;
           }
-          
+
 	for (Lng32 i = 0; i < numLOBs; i++)
 	  {
 	    // create lob data tables
@@ -9553,8 +9565,7 @@
 		ExRaiseSqlError(currContext.exHeap(), &da, 
 			    (ExeErrorCode)(8442), NULL, &cliRC    , 
 			    &rc, NULL, (char*)"ExpLOBInterfaceCreate",
-
-			    getLobErrStr(rc));
+		            getLobErrStr(rc), (char*)getSqlJniErrorStr());
 		goto non_cli_error_return;
 	      }
 	    
@@ -9642,15 +9653,15 @@
         //above tables . 
         //Initialize LOB interface 
        
-        Int32 rc= ExpLOBoper::initLOBglobal(exLobGlob,currContext.exHeap(),&currContext,hdfsServer,hdfsPort);
-        if (rc)
+        exLobGlob = ExpLOBoper::initLOBglobal(currContext.exHeap(), &currContext, useLibHdfs);
+        if (exLobGlob == NULL) 
           {
             cliRC = 0;
             ComDiagsArea * da = &diags;
             ExRaiseSqlError(currContext.exHeap(), &da, 
 			    (ExeErrorCode)(8442), NULL, &cliRC    , 
 			    &rc, NULL, (char*)"ExpLOBInterfaceCreate",
-			    getLobErrStr(rc));
+		            getLobErrStr(rc), (char*)getSqlJniErrorStr());
             goto non_cli_error_return;
 	      
           }
@@ -9668,7 +9679,7 @@
 		ExRaiseSqlError(currContext.exHeap(), &da, 
 			    (ExeErrorCode)(8442), NULL, &cliRC    , 
 			    &rc, NULL, (char*)"ExpLOBInterfaceDrop  ",
-			    getLobErrStr(rc));
+		            getLobErrStr(rc), (char*)getSqlJniErrorStr());
 		goto non_cli_error_return;
               }
           }//for
@@ -9691,16 +9702,15 @@
            goto error_return;
 
 	//Initialize LOB interface 
-        
-        Int32 rc= ExpLOBoper::initLOBglobal(exLobGlob,currContext.exHeap(),&currContext,hdfsServer,hdfsPort);
-        if (rc)
+        exLobGlob = ExpLOBoper::initLOBglobal(currContext.exHeap(), &currContext, useLibHdfs);
+        if (exLobGlob == NULL) 
           {
             cliRC = 0;
             ComDiagsArea * da = &diags;
             ExRaiseSqlError(currContext.exHeap(), &da, 
 			    (ExeErrorCode)(8442), NULL, &cliRC    , 
                             &rc, NULL, (char*)"ExpLOBInterfaceCreate",
-                            getLobErrStr(rc));
+		            getLobErrStr(rc), (char*)getSqlJniErrorStr());
             goto non_cli_error_return;	      
           }
 	// drop descriptor table
@@ -9718,7 +9728,7 @@
 		ExRaiseSqlError(currContext.exHeap(), &da, 
 			    (ExeErrorCode)(8442), NULL, &cliRC    , 
 			    &rc, NULL, (char*)"ExpLOBInterfaceDrop  ",
-			    getLobErrStr(rc));
+		            getLobErrStr(rc), (char*)getSqlJniErrorStr());
 		goto non_cli_error_return;
 	      }
 	    
@@ -9855,7 +9865,8 @@
       myDiags->decrRefCount();
     }
  non_cli_error_return:
-  ExpLOBinterfaceCleanup(exLobGlob);
+  if (exLobGlob != NULL)
+     ExpLOBoper::deleteLOBglobal(exLobGlob, currContext.exHeap());
   NADELETEBASIC(query, currContext.exHeap());
   NADELETEBASIC(hdfsServer,currContext.exHeap());
   delete cliInterface;
diff --git a/core/sql/cli/Descriptor.cpp b/core/sql/cli/Descriptor.cpp
index a1a607f..47110c0 100644
--- a/core/sql/cli/Descriptor.cpp
+++ b/core/sql/cli/Descriptor.cpp
@@ -1501,7 +1501,7 @@
         case SQLINTCODE_HOUR_SECOND:
         case SQLINTCODE_DAY_SECOND:
           // 17.5 - GR 5-j-i
-          descItem.precision          = 6;
+          descItem.precision          = 9;
           break;
 
         default:
@@ -1519,7 +1519,7 @@
         case SQLDTCODE_TIMESTAMP:
         // none with Timezone yet
           // 17.5 - GR 5-i-i
-          descItem.precision          = 6;
+          descItem.precision          = 9;
           break;
 
         case SQLDTCODE_TIME:
diff --git a/core/sql/cli/Globals.cpp b/core/sql/cli/Globals.cpp
index f716345..6f498fb 100644
--- a/core/sql/cli/Globals.cpp
+++ b/core/sql/cli/Globals.cpp
@@ -177,10 +177,17 @@
     cli_globals = this;
     int error;
     statsGlobals_ = (StatsGlobals *)shareStatsSegment(shmId_);
-    if (statsGlobals_ == NULL
-      || (statsGlobals_ != NULL && 
-        statsGlobals_->getVersion() != StatsGlobals::CURRENT_SHARED_OBJECTS_VERSION_))
+    NABoolean reportError = FALSE;
+    char msg[256];;
+    if ((statsGlobals_ == NULL)
+      || ((statsGlobals_ != NULL) && (statsGlobals_->getInitError(myPin_, reportError))))
     {
+      if (reportError) {
+         snprintf(msg, sizeof(msg),
+          "Version mismatch or Pid %d,%d is higher than the configured pid max %d",
+           myCpu_, myPin_, statsGlobals_->getConfiguredPidMax());
+         SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, msg, 0);
+      }
       statsGlobals_ = NULL;
       statsHeap_ = new (getExecutorMemory()) 
         NAHeap("Process Stats Heap", getExecutorMemory(),
diff --git a/core/sql/cli/SessionDefaults.cpp b/core/sql/cli/SessionDefaults.cpp
index 59be23e..84be26f 100644
--- a/core/sql/cli/SessionDefaults.cpp
+++ b/core/sql/cli/SessionDefaults.cpp
@@ -108,6 +108,7 @@
   SDEntry(SessionDefaults::SCHEMA,                   SCHEMA,                     SessionDefaults::SDT_ASCII,          TRUE,    TRUE,  FALSE, FALSE),
   SDEntry(SessionDefaults::STATISTICS_VIEW_TYPE,     STATISTICS_VIEW_TYPE,       SessionDefaults::SDT_ASCII,          FALSE,   FALSE, TRUE,  TRUE),
   SDEntry(SessionDefaults::SUSPEND_LOGGING,          SUSPEND_LOGGING,            SessionDefaults::SDT_BOOLEAN,        FALSE,   FALSE, TRUE,  FALSE),
+  SDEntry(SessionDefaults::USE_LIBHDFS,              USE_LIBHDFS,                SessionDefaults::SDT_BOOLEAN,        TRUE,    TRUE,  FALSE, FALSE),
   SDEntry(SessionDefaults::USER_EXPERIENCE_LEVEL,    USER_EXPERIENCE_LEVEL,      SessionDefaults::SDT_ASCII,          TRUE,    TRUE,  FALSE, FALSE),
   SDEntry(SessionDefaults::WMS_PROCESS,              WMS_PROCESS,                SessionDefaults::SDT_BOOLEAN,        FALSE,   FALSE, TRUE,  FALSE)
 };
@@ -237,6 +238,7 @@
   setCancelEscalationMxosrvrInterval(120);
   setCancelEscalationSaveabend(FALSE);
   setModeSeabase(FALSE);
+  setUseLibHdfs(FALSE);
 }
   
 SessionDefaults::~SessionDefaults()
@@ -450,6 +452,12 @@
       };
     break;
 
+    case USE_LIBHDFS:
+      {
+         setUseLibHdfs(defaultValueAsBoolean);
+
+      }
+      break;
     case USER_EXPERIENCE_LEVEL:
       {
 	setUEL(attrValue, attrValueLen);
diff --git a/core/sql/cli/SessionDefaults.h b/core/sql/cli/SessionDefaults.h
index ea91454..964aa29 100644
--- a/core/sql/cli/SessionDefaults.h
+++ b/core/sql/cli/SessionDefaults.h
@@ -131,6 +131,7 @@
     SCHEMA,
     STATISTICS_VIEW_TYPE,
     SUSPEND_LOGGING,
+    USE_LIBHDFS,
     USER_EXPERIENCE_LEVEL,
     WMS_PROCESS,
     LAST_SESSION_DEFAULT_ATTRIBUTE  // This enum entry should be last always. Add new enums before this entry
@@ -345,6 +346,14 @@
                               espCloseErrorLogging_);
   }
 
+  void setUseLibHdfs(NABoolean useLibHdfs)
+  {
+    const Int16 DisAmbiguate = 0;
+    useLibHdfs_ = useLibHdfs;
+    updateDefaultsValueString(USE_LIBHDFS, DisAmbiguate,
+                              useLibHdfs_);
+  }
+
   void setEspFreeMemTimeout(Lng32 espFreeMemTimeout)
   {
     espFreeMemTimeout_ = espFreeMemTimeout;
@@ -543,6 +552,8 @@
 
   NABoolean getSuspendLogging()                  { return suspendLogging_; }
 
+  NABoolean getUseLibHdfs()                  { return useLibHdfs_; }
+
   Lng32 readFromDefaultsTable(CliGlobals * cliGlobals);
   Lng32 setIsoMappingDefine();
 
@@ -790,6 +801,7 @@
   NABoolean modeSeabase_;
   Lng32 jniDebugPort_;     // port to attache JNI debugger, <=0 to disable
   Lng32 jniDebugTimeout_;  // timeout (msec) to wait for debugger to attach
+  NABoolean useLibHdfs_;
 };
 
 
diff --git a/core/sql/cli/sqlcli.h b/core/sql/cli/sqlcli.h
index 3a8a5b4..2bfbfcb 100644
--- a/core/sql/cli/sqlcli.h
+++ b/core/sql/cli/sqlcli.h
@@ -696,7 +696,10 @@
   SQLTRANS_BEGIN_WITH_DP2_XNS   = 9,
 
   /* inherit the global transaction and make it the current xn */
-  SQLTRANS_INHERIT          = 10
+  SQLTRANS_INHERIT          = 10,
+
+  SQLTRANS_SUSPEND          = 11,
+  SQLTRANS_RESUME           = 12,
 };
 
 /* specifies the type/format of an AUTHID */
@@ -1157,6 +1160,7 @@
   SQLSTATS_RMS_STATS_RESET_TIMESTAMP = 130,
   SQLSTATS_RMS_STATS_NUM_SQL_SIK = 131,
   SQLSTATS_PROCESS_STATS_HEAPS = 132,
+  SQLSTATS_RMS_CONFIGURED_PID_MAX = 133,
 /* SQLSTATS_ITEM_ID for BMO_STATS */
   SQLSTATS_BMO_HEAP_USED = 150,
   SQLSTATS_BMO_HEAP_ALLOC = 151,
diff --git a/core/sql/comexe/CmpMessage.cpp b/core/sql/comexe/CmpMessage.cpp
index af0827b..79831a4 100644
--- a/core/sql/comexe/CmpMessage.cpp
+++ b/core/sql/comexe/CmpMessage.cpp
@@ -261,7 +261,8 @@
        sqltext_(sourceStr), sqlTextLen_(sourceStrLen),
        sqlTextCharSet_(sourceStrCharSet),
        schemaName_(schemaName), schemaNameLen_(schemaNameLen),
-       inputArrayMaxsize_(inputArrayMaxsize)
+       inputArrayMaxsize_(inputArrayMaxsize),
+       unused2_(0)
 {
   if (atomicity == 1) {
       flags_ |= ROWSET_ATOMICITY_SPECIFIED;
diff --git a/core/sql/comexe/CmpMessage.h b/core/sql/comexe/CmpMessage.h
index 3733239..8f34630 100644
--- a/core/sql/comexe/CmpMessage.h
+++ b/core/sql/comexe/CmpMessage.h
@@ -818,19 +818,22 @@
 
   enum
   {
-    DONE_                = 0x0001,
-    COMPUTE_ST_    = 0x0002,
-    COMPUTE_ET_    = 0x0004,
-    RETURN_ET_       = 0x0008,
-    START_               = 0x0010,
-    END_                   = 0x0020,
+    DONE_           = 0x0001,
+    COMPUTE_ST_     = 0x0002,
+    COMPUTE_ET_     = 0x0004,
+    RETURN_ET_      = 0x0008,
+    START_          = 0x0010,
+    END_            = 0x0020,
     XN_STARTED_     = 0x0040,
     MD_UPGRADE_     = 0x0080,
-    GET_MD_VERSION_    = 0x0100,
-    GET_SW_VERSION_    = 0x0200,
-    MD_CLEANUP_           = 0x0400,
-    CHECK_ONLY_          = 0x0800,
-    RETURN_DETAILS_    = 0x1000
+    GET_MD_VERSION_ = 0x0100,
+    GET_SW_VERSION_ = 0x0200,
+    MD_CLEANUP_     = 0x0400,
+    CHECK_ONLY_     = 0x0800,
+    RETURN_DETAILS_ = 0x1000,
+    INIT_TRAF_      = 0x2000,
+    MINIMAL_IT_     = 0x4000,
+    DDL_XNS_        = 0x8000,
   };
 
  public:
@@ -897,6 +900,18 @@
   {(v ? statusFlags_ |= RETURN_DETAILS_ : statusFlags_ &= ~RETURN_DETAILS_); }
   NABoolean getReturnDetails() { return (statusFlags_ & RETURN_DETAILS_) != 0;}
 
+  void setInitTraf(NABoolean v)
+  {(v ? statusFlags_ |= INIT_TRAF_ : statusFlags_ &= ~INIT_TRAF_); }
+  NABoolean getInitTraf() { return (statusFlags_ & INIT_TRAF_) != 0;}
+
+  void setMinimalInitTraf(NABoolean v)
+  {(v ? statusFlags_ |= MINIMAL_IT_ : statusFlags_ &= ~MINIMAL_IT_); }
+  NABoolean getMinimalInitTraf() { return (statusFlags_ & MINIMAL_IT_) != 0;}
+
+  void setDDLXns(NABoolean v)
+  {(v ? statusFlags_ |= DDL_XNS_ : statusFlags_ &= ~DDL_XNS_); }
+  NABoolean getDDLXns() { return (statusFlags_ & DDL_XNS_) != 0;}
+
   void setMsg(const char * msg)
   {
     msgLen_ = strlen(msg);
diff --git a/core/sql/comexe/ComTdb.cpp b/core/sql/comexe/ComTdb.cpp
index 2578c46..4770f59 100644
--- a/core/sql/comexe/ComTdb.cpp
+++ b/core/sql/comexe/ComTdb.cpp
@@ -576,12 +576,6 @@
       break;
     }
 
-    case ex_FAST_DELETE:
-    {
-      GetVTblPtr(vtblptr,ComTdbExeUtilFastDelete);
-      break;
-    }
-
     case ex_HIVE_TRUNCATE:
     {
       GetVTblPtr(vtblptr,ComTdbExeUtilHiveTruncate);
diff --git a/core/sql/comexe/ComTdb.h b/core/sql/comexe/ComTdb.h
index 1b90b90..e00728f 100644
--- a/core/sql/comexe/ComTdb.h
+++ b/core/sql/comexe/ComTdb.h
@@ -251,7 +251,6 @@
     ex_CLEANUP_VOLATILE_TABLES = 109,
     ex_GET_VOLATILE_INFO = 110,
     ex_CREATE_TABLE_AS = 111,
-    ex_FAST_DELETE       = 112,
     ex_GET_STATISTICS    = 113,
     ex_PROBE_CACHE = 114,
     ex_LONG_RUNNING = 116,
@@ -561,6 +560,10 @@
 
   void setProcessLOB(NABoolean v){ v ? flags_ |= PROCESS_LOB: flags_ &= ~PROCESS_LOB;}
 
+  NABoolean useLibHdfs() const { return ((flags_ & USE_LIBHDFS) > 0);}
+
+  void setUseLibHdfs(NABoolean v){ v ? flags_ |= USE_LIBHDFS : flags_ &= ~USE_LIBHDFS ;}
+
   enum CollectStatsType
   {
     NO_STATS      = SQLCLI_NO_STATS,
@@ -675,7 +678,9 @@
     // code generation:
     //  master root(ComTdbRoot), esp root(ComTdbSplitBottom),
     //  eid root (ComTdbEidRoot)
-    PROCESS_LOB = 0x0100
+    PROCESS_LOB = 0x0100,
+    //
+    USE_LIBHDFS = 0x0200
 
   };
 
diff --git a/core/sql/comexe/ComTdbControl.h b/core/sql/comexe/ComTdbControl.h
index 9fe6029..474ade0 100644
--- a/core/sql/comexe/ComTdbControl.h
+++ b/core/sql/comexe/ComTdbControl.h
@@ -121,8 +121,19 @@
   void setNonResettable(NABoolean nonResettable) 
                  { nonResettable_ = nonResettable; }
   NABoolean isNonResettable() { return (nonResettable_ != FALSE); } 
+
+  void setIsSetStmt(short v) {(v ? flags_ |= IS_SET_STMT : flags_ &= ~IS_SET_STMT); };
+  NABoolean isSetStmt() { return (flags_ & IS_SET_STMT) != 0; };
+
+  void setIsHiveSetSchema(short v) {(v ? flags_ |= IS_HIVE_SET_SCHEMA : flags_ &= ~IS_HIVE_SET_SCHEMA); };
+  NABoolean isHiveSetSchema() { return (flags_ & IS_HIVE_SET_SCHEMA) != 0; };
  
 private:
+  enum
+    {
+      IS_SET_STMT        = 0x0001,
+      IS_HIVE_SET_SCHEMA = 0x0002
+    };
 
   // Remember, when putting tablename into one of these 3 char*'s,
   // to save its ANSI name; e.g.
@@ -141,7 +152,8 @@
   Int16 sqlTextCharSet_;           // 36-37
   Int16 actionType_;               // 38-39
   Int16 nonResettable_;            // 40-41
-  char fillersComTdbControl_[30];  // 42-71
+  UInt16 flags_;                   // 42-43
+  char fillersComTdbControl_[28];  // 44-71
 
 };
 #endif
diff --git a/core/sql/comexe/ComTdbDDL.h b/core/sql/comexe/ComTdbDDL.h
index b1576b7..65492d4 100644
--- a/core/sql/comexe/ComTdbDDL.h
+++ b/core/sql/comexe/ComTdbDDL.h
@@ -320,15 +320,20 @@
   {(v ? flags2_ |= RETURN_DETAILS : flags2_ &= ~RETURN_DETAILS); }
   NABoolean getReturnDetails() { return (flags2_ & RETURN_DETAILS) != 0;}
 
+  void setInitTraf(NABoolean v)
+  {(v ? flags2_ |= INIT_TRAF : flags2_ &= ~INIT_TRAF); }
+  NABoolean getInitTraf() { return (flags2_ & INIT_TRAF) != 0;}
+
 protected:
   enum Flags 
   { 
     GET_MD_VERSION          = 0x0001,
     GET_SW_VERSION          = 0x0002,
-    MD_UPGRADE                 = 0x0004,
-    MD_CLEANUP                 = 0x0008,
-    CHECK_ONLY                 = 0x0010,
-    RETURN_DETAILS           = 0x0020
+    MD_UPGRADE              = 0x0004,
+    MD_CLEANUP              = 0x0008,
+    CHECK_ONLY              = 0x0010,
+    RETURN_DETAILS          = 0x0020,
+    INIT_TRAF               = 0x0040
   };
  
   UInt16 flags2_;                       // 00-01
diff --git a/core/sql/comexe/ComTdbExeUtil.cpp b/core/sql/comexe/ComTdbExeUtil.cpp
index c7c5a8c..df34a5d 100644
--- a/core/sql/comexe/ComTdbExeUtil.cpp
+++ b/core/sql/comexe/ComTdbExeUtil.cpp
@@ -1139,141 +1139,6 @@
     }
 }
 
-
-
-
-///////////////////////////////////////////////////////////////////////////
-//
-// Methods for class ComTdbExeUtilFastDelete
-//
-///////////////////////////////////////////////////////////////////////////
-ComTdbExeUtilFastDelete::ComTdbExeUtilFastDelete(
-     char * tableName,
-     ULng32 tableNameLen,
-     char * primaryPartnLoc,
-     Queue * indexList,
-     char * stmt,
-     ULng32 stmtLen,
-     Lng32 numEsps,
-     Int64 objectUID,
-     Lng32 numLOBs,
-     char * lobNumArray,
-     ex_cri_desc * work_cri_desc,
-     const unsigned short work_atp_index,
-     ex_cri_desc * given_cri_desc,
-     ex_cri_desc * returned_cri_desc,
-     queue_index down,
-     queue_index up,
-     Lng32 num_buffers,
-     ULng32 buffer_size)
-     : ComTdbExeUtil(ComTdbExeUtil::FAST_DELETE_,
-		     NULL, 0, (Int16)SQLCHARSETCODE_UNKNOWN,
-		     tableName, tableNameLen,
-		     NULL, 0,
-		     NULL, 0,
-		     NULL,
-		     work_cri_desc, work_atp_index,
-		     given_cri_desc, returned_cri_desc,
-		     down, up, 
-		     num_buffers, buffer_size),
-       flags_(0),
-       indexList_(indexList),
-       purgedataStmt_(stmt),
-       purgedataStmtLen_(stmtLen),
-       primaryPartnLoc_(primaryPartnLoc),
-       numEsps_(numEsps),
-       objectUID_(objectUID),
-       numLOBs_(numLOBs),
-       lobNumArray_(lobNumArray)
-{
-  setNodeType(ComTdb::ex_FAST_DELETE);
-}
-
-Long ComTdbExeUtilFastDelete::pack(void * space)
-{
-  indexList_.pack(space);
-
-  if (purgedataStmt_) 
-    purgedataStmt_.pack(space);
-
-  if (primaryPartnLoc_)
-    primaryPartnLoc_.pack(space);
-
-  if (lobNumArray_) 
-    lobNumArray_.pack(space);
-
-  return ComTdbExeUtil::pack(space);
-}
-
-Lng32 ComTdbExeUtilFastDelete::unpack(void * base, void * reallocator)
-{
-  if(indexList_.unpack(base, reallocator)) return -1;
-
-  if (purgedataStmt_.unpack(base)) 
-    return -1;
-
-  if (primaryPartnLoc_.unpack(base))
-    return -1;
-
-  if(lobNumArray_.unpack(base)) 
-    return -1;
-
-  return ComTdbExeUtil::unpack(base, reallocator);
-}
-
-short ComTdbExeUtilFastDelete::getLOBnum(short i)
-{
-  if ((i > numLOBs_) || (i <= 0))
-    return -1;
-
-  short lobNum = *((short*)&getLOBnumArray()[2*(i-1)]);
-
-  return lobNum;
-}
-
-void ComTdbExeUtilFastDelete::displayContents(Space * space,
-					      ULng32 flag)
-{
-  ComTdb::displayContents(space,flag & 0xFFFFFFFE);
-  
-  if(flag & 0x00000008)
-    {
-      char buf[500];
-      str_sprintf(buf, "\nFor ComTdbExeUtilFastDelete :");
-      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
-      
-      if (getTableName() != NULL)
-	{
-	  str_sprintf(buf,"Tablename = %s ",getTableName());
-	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), 
-					       sizeof(short));
-	}
-
-      if (purgedataStmt_)
-	{
-	  str_sprintf(buf,"purgedataStmt_ = %s ", purgedataStmt());
-	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), 
-					       sizeof(short));
-	}
-
-      if (numLOBs_ > 0)
-	{
-	  str_sprintf(buf, "numLOBs_ = %d ", numLOBs_);
-	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), 
-					       sizeof(short));
-	}
- 
-    }
-
-  
-  if (flag & 0x00000001)
-    {
-      displayExpression(space,flag);
-      displayChildren(space,flag);
-    }
-
-}
-
 ///////////////////////////////////////////////////////////////////////////
 //
 // Methods for class ComTdbExeUtilHiveTruncate
@@ -1288,6 +1153,7 @@
      char * hostName,
      Lng32 portNum,
      Int64 modTS,
+     char * hiveTruncQuery,
      ex_cri_desc * given_cri_desc,
      ex_cri_desc * returned_cri_desc,
      queue_index down,
@@ -1310,7 +1176,8 @@
        partnLocation_(partnLocation),
        hdfsHost_(hostName),
        hdfsPort_(portNum),
-       modTS_(modTS)
+       modTS_(modTS),
+       hiveTruncQuery_(hiveTruncQuery)
 {
   setNodeType(ComTdb::ex_HIVE_TRUNCATE);
 }
@@ -1329,6 +1196,9 @@
   if (hiveTableName_)
     hiveTableName_.pack(space);
 
+  if (hiveTruncQuery_)
+    hiveTruncQuery_.pack(space);
+
   return ComTdbExeUtil::pack(space);
 }
 
@@ -1346,6 +1216,9 @@
   if (hiveTableName_.unpack(base))
     return -1;
 
+  if (hiveTruncQuery_.unpack(base))
+    return -1;
+
   return ComTdbExeUtil::unpack(base, reallocator);
 }
 
@@ -1388,6 +1261,10 @@
 					       sizeof(short));
 	}
  
+      if (getHiveTruncQuery() != NULL)
+        {
+          
+        }
     }
   
   if (flag & 0x00000001)
diff --git a/core/sql/comexe/ComTdbExeUtil.h b/core/sql/comexe/ComTdbExeUtil.h
index 40742ba..39cd249 100644
--- a/core/sql/comexe/ComTdbExeUtil.h
+++ b/core/sql/comexe/ComTdbExeUtil.h
@@ -65,7 +65,6 @@
     CLEANUP_VOLATILE_SCHEMA_ = 5,
     GET_VOLATILE_INFO        = 6,
     CREATE_TABLE_AS_         = 7,
-    FAST_DELETE_             = 8,
     GET_MAINTAIN_INFO_       = 9,
     GET_STATISTICS_          = 10,
     USER_LOAD_               = 11,
@@ -1507,139 +1506,17 @@
   char fillersComTdbExeUtilCreateTableAs_[92];       // 44-135
 };
 
-class ComTdbExeUtilFastDelete : public ComTdbExeUtil
-{
-public:
-  ComTdbExeUtilFastDelete()
-  : ComTdbExeUtil()
-  {}
-
-  ComTdbExeUtilFastDelete(char * tableName,
-			  ULng32 tableNameLen,
-			  char * primaryPartnLoc,
-			  Queue * indexList,
-			  char * stmt,
-			  ULng32 stmtLen,
-			  Lng32 numEsps,
-			  Int64 objectUID,
-			  Lng32 numLOBs,
-			  char * lobNumArray,
-			  ex_cri_desc * work_cri_desc,
-			  const unsigned short work_atp_index,
-			  ex_cri_desc * given_cri_desc,
-			  ex_cri_desc * returned_cri_desc,
-			  queue_index down,
-			  queue_index up,
-			  Lng32 num_buffers,
-			  ULng32 buffer_size
-			  );
-
-  Long pack(void *);
-  Lng32 unpack(void *, void * reallocator);
-
-
-  // ---------------------------------------------------------------------
-  // Redefine virtual functions required for Versioning.
-  //----------------------------------------------------------------------
-  virtual short getClassSize() {return (short)sizeof(ComTdbExeUtilFastDelete);}
-
-  virtual const char *getNodeName() const
-  {
-    return "FAST_DELETE";
-  };
-
-  Queue* getIndexList()       { return indexList_; }
-
-  char * purgedataStmt()      { return purgedataStmt_; }
-
-  char * getPrimaryPartnLoc()  { return primaryPartnLoc_; }
-
-  Lng32 getNumEsps() { return numEsps_;}
-
-  char * getLOBnumArray() { return lobNumArray_; }
-
-  short getLOBnum(short i);
-
-  UInt16 numLOBs() { return numLOBs_; }
-
-  Int64 getObjectUID() { return objectUID_; }
-
-  // ---------------------------------------------------------------------
-  // Used by the internal SHOWPLAN command to get attributes of a TDB.
-  // ---------------------------------------------------------------------
-  void displayContents(Space *space, ULng32 flag);
-
-  void setDoPurgedataCat(NABoolean v)
-  {(v ? flags_ |= DO_PURGEDATA_CAT : flags_ &= ~DO_PURGEDATA_CAT); };
-  NABoolean doPurgedataCat() { return (flags_ & DO_PURGEDATA_CAT) != 0; };
-
-  void setReturnPurgedataWarn(NABoolean v)
-  {(v ? flags_ |= RETURN_PURGEDATA_WARN : flags_ &= ~RETURN_PURGEDATA_WARN); };
-  NABoolean returnPurgedataWarn() { return (flags_ & RETURN_PURGEDATA_WARN) != 0; };
-
-  void setIsMV(NABoolean v)
-  {(v ? flags_ |= IS_MV: flags_ &= ~IS_MV); };
-  NABoolean isMV() { return (flags_ & IS_MV) != 0; };
-
-  void setDoParallelDelete(NABoolean v)
-  {(v ? flags_ |= DO_PARALLEL_DELETE: flags_ &= ~DO_PARALLEL_DELETE); };
-  NABoolean doParallelDelete() { return (flags_ & DO_PARALLEL_DELETE) != 0; };
-
-  void setDoParallelDeleteIfXn(NABoolean v)
-  {(v ? flags_ |= DO_PARALLEL_DELETE_IF_XN: flags_ &= ~DO_PARALLEL_DELETE_IF_XN); };
-  NABoolean doParallelDeleteIfXn() { return (flags_ & DO_PARALLEL_DELETE_IF_XN) != 0; };
-
-  void setOfflineTable(NABoolean v)
-  {(v ? flags_ |= OFFLINE_TABLE : flags_ &= ~OFFLINE_TABLE); };
-  NABoolean offlineTable() { return (flags_ & OFFLINE_TABLE) != 0; };
-
-  void setDoLabelPurgedata(NABoolean v)
-  {(v ? flags_ |= DO_LABEL_PURGEDATA: flags_ &= ~DO_LABEL_PURGEDATA); };
-  NABoolean doLabelPurgedata() { return (flags_ & DO_LABEL_PURGEDATA) != 0; };
-
-private:
-  enum
-  {
-    DO_PURGEDATA_CAT         = 0x0001,
-    RETURN_PURGEDATA_WARN    = 0x0002,
-    IS_MV                    = 0x0004,
-    DO_PARALLEL_DELETE       = 0x0008,
-    DO_PARALLEL_DELETE_IF_XN = 0x0010,
-    OFFLINE_TABLE            = 0x0020,
-    DO_LABEL_PURGEDATA       = 0x0040
-   };
-
-  // list of indexes on the table.
-  QueuePtr indexList_;                               // 00-07
-
-  NABasicPtr purgedataStmt_;                         // 08-15
-
-  NABasicPtr primaryPartnLoc_;                       // 16-23
-
-  UInt32 purgedataStmtLen_;                          // 24-27
-
-  UInt32 flags_;                                     // 28-31
-
-  UInt32 numEsps_;                                   // 32-35
-
-  // next 3 fields are used if table contains LOBs
-  UInt16 numLOBs_;                                   // 36-37
-  char   filler1_[2];                                // 38-39
-  
-  // array of shorts. numLOBs entries. 
-  // Each entry is the lobNum.
-  NABasicPtr lobNumArray_;                           // 40-47
-
-  Int64 objectUID_;                                  // 48-55
-};
-
 class ComTdbExeUtilHiveTruncate : public ComTdbExeUtil
 {
 public:
   // flags
   enum
   {
-    TRUNC_DROP_TABLE_ON_DEALLOC = 0x0001
+    TRUNC_DROP_TABLE_ON_DEALLOC = 0x0001,
+    IS_LEGACY                   = 0x0002,
+    IS_EXTERNAL                 = 0x0004,
+    IF_EXISTS                   = 0x0008,
+    TABLE_NOT_EXISTS            = 0x0010
   };
 
   ComTdbExeUtilHiveTruncate()
@@ -1654,6 +1531,7 @@
                             char * hostName,
                             Lng32 portNum,
                             Int64 modTS,
+                            char * hiveTruncQuery,
                             ex_cri_desc * given_cri_desc,
                             ex_cri_desc * returned_cri_desc,
                             queue_index down,
@@ -1705,10 +1583,31 @@
     return hiveTableName_;
   }
 
+  char * getHiveTruncQuery() const
+  {
+    return hiveTruncQuery_;
+  }
+
   void setDropOnDealloc(NABoolean v)
   {(v ? flags_ |= TRUNC_DROP_TABLE_ON_DEALLOC : flags_ &= ~TRUNC_DROP_TABLE_ON_DEALLOC); }
   NABoolean getDropOnDealloc() { return (flags_ & TRUNC_DROP_TABLE_ON_DEALLOC) != 0; }
 
+  void setIsLegacy(NABoolean v)
+  {(v ? flags_ |= IS_LEGACY : flags_ &= ~IS_LEGACY); }
+  NABoolean getIsLegacy() { return (flags_ & IS_LEGACY) != 0; }
+
+  void setIsExternal(NABoolean v)
+  {(v ? flags_ |= IS_EXTERNAL : flags_ &= ~IS_EXTERNAL); }
+  NABoolean getIsExternal() { return (flags_ & IS_EXTERNAL) != 0; }
+
+  void setIfExists(NABoolean v)
+  {(v ? flags_ |= IF_EXISTS : flags_ &= ~IF_EXISTS); }
+  NABoolean getIfExists() { return (flags_ & IF_EXISTS) != 0; }
+
+  void setTableNotExists(NABoolean v)
+  {(v ? flags_ |= TABLE_NOT_EXISTS : flags_ &= ~TABLE_NOT_EXISTS); }
+  NABoolean getTableNotExists() { return (flags_ & TABLE_NOT_EXISTS) != 0; }
+
   // ---------------------------------------------------------------------
   // Used by the internal SHOWPLAN command to get attributes of a TDB.
   // ---------------------------------------------------------------------
@@ -1722,6 +1621,7 @@
   Int64 modTS_;                                  // 32-39
   Int32 hdfsPort_;                               // 40-43
   UInt32 flags_;                                 // 44-47
+  NABasicPtr hiveTruncQuery_;                    // 48-55
 };
 
 class ComTdbExeUtilHiveQuery : public ComTdbExeUtil
diff --git a/core/sql/common/ComMisc.cpp b/core/sql/common/ComMisc.cpp
index b4a0cea..387b309 100644
--- a/core/sql/common/ComMisc.cpp
+++ b/core/sql/common/ComMisc.cpp
@@ -296,6 +296,53 @@
   return convertedName;
 }
 
+// Hive names specified in the query may have any of the following
+// forms after they are fully qualified:
+//  hive.hive.t, hive.`default`.t, hive.hivesch.t, hive.hivesch
+// These names are valid in traf environment only and are used to determine
+// if hive ddl is being processed.
+//
+// Return equivalent native hive names of the format:
+//   `default`.t, `default`.t, hivesch.t, hivesch
+// Return NULL string in case of an error.
+NAString ComConvertTrafHiveNameToNativeHiveName(
+     const NAString &catalogName,
+     const NAString &schemaName,
+     const NAString &objectName)
+{
+  NAString newHiveName;
+  if (catalogName.compareTo(HIVE_SYSTEM_CATALOG, NAString::ignoreCase) != 0)
+    {
+      // Invalid hive name in traf environment.
+      return newHiveName;
+    }
+
+  if (schemaName.compareTo(HIVE_DEFAULT_SCHEMA_EXE, NAString::ignoreCase) == 0) // matches  'default'
+    {
+      newHiveName += NAString("`") + schemaName + "`";
+      if (NOT objectName.isNull())
+        newHiveName += ".";
+    }
+  else if (schemaName.compareTo(HIVE_SYSTEM_SCHEMA, NAString::ignoreCase) == 0) // matches  'hive'
+    {
+      // set fully qualified hive default schema name `default`
+      newHiveName += NAString("`default`");
+      if (NOT objectName.isNull())
+        newHiveName += ".";
+    }
+  else // user schema name
+    {
+      newHiveName += schemaName;
+      if (NOT objectName.isNull())
+        newHiveName += ".";
+    }
+
+  if (NOT objectName.isNull())
+    newHiveName += objectName;
+
+  return newHiveName;
+}
+
 NABoolean ComTrafReservedColName(
      const NAString &colName)
 {
diff --git a/core/sql/common/ComMisc.h b/core/sql/common/ComMisc.h
index bbe418d..1581489 100644
--- a/core/sql/common/ComMisc.h
+++ b/core/sql/common/ComMisc.h
@@ -90,6 +90,20 @@
                                          const NAString &schemaName,
                                          const NAString &objectName);
 
+// Hive names specified in the query may have any of the following
+// forms after they are fully qualified:
+//  hive.hive.t, hive.`default`.t, hive.hivesch.t, hive.hivesch
+// These names are valid in traf environment only and are used to determine
+// if hive ddl is being processed.
+//
+// Return equivalent native hive names of the format:
+//   `default`.t, `default`.t, hivesch.t, hivesch
+// Return NULL string in case of an error.
+NAString ComConvertTrafHiveNameToNativeHiveName(
+     const NAString &catalogName,
+     const NAString &schemaName,
+     const NAString &objectName);
+
 // returns TRUE if specified name is a reserved name.
 // Currently, reserved names for traf internal usage are:
 //   SYSKEY
diff --git a/core/sql/common/ComResWords.cpp b/core/sql/common/ComResWords.cpp
index 8796f6b..7f49b20 100644
--- a/core/sql/common/ComResWords.cpp
+++ b/core/sql/common/ComResWords.cpp
@@ -55,50 +55,50 @@
   ComResWord("AFTER",            COMPAQ_|RESWORD_),
   ComResWord("AGGREGATE",        COMPAQ_|RESWORD_),
   ComResWord("ALIAS",            POTANS_|RESWORD_),
-  ComResWord("ALL",              ANS_|RESWORD_|MPWORD_),
+  ComResWord("ALL",              ANS_|RESWORD_),
   ComResWord("ALLOCATE",         ANS_|RESWORD_),
   ComResWord("ALTER",            ANS_|RESWORD_),
-  ComResWord("AND",              ANS_|RESWORD_|MPWORD_),
-  ComResWord("ANY",              ANS_|RESWORD_|MPWORD_),
+  ComResWord("AND",              ANS_|RESWORD_),
+  ComResWord("ANY",              ANS_|RESWORD_),
   ComResWord("ARE",              ANS_|RESWORD_),
   ComResWord("ARRAY",            COMPAQ_|RESWORD_),
-  ComResWord("AS",               ANS_|RESWORD_|MPWORD_),
-  ComResWord("ASC",              ANS_|RESWORD_|MPWORD_),
+  ComResWord("AS",               ANS_|RESWORD_),
+  ComResWord("ASC",              ANS_|RESWORD_),
   ComResWord("ASSERTION",        ANS_|RESWORD_),
   ComResWord("ASYNC",            POTANS_|RESWORD_),
   ComResWord("AT",               ANS_|RESWORD_),
   ComResWord("AUTHORIZATION",    ANS_|RESWORD_),
-  ComResWord("AVG",              ANS_|RESWORD_|MPWORD_),
+  ComResWord("AVG",              ANS_|RESWORD_),
   ComResWord("BEFORE",           POTANS_|RESWORD_),
-  ComResWord("BEGIN",            ANS_|RESWORD_|MPWORD_),
-  ComResWord("BETWEEN",          ANS_|RESWORD_|MPWORD_),
+  ComResWord("BEGIN",            ANS_|RESWORD_),
+  ComResWord("BETWEEN",          ANS_|RESWORD_),
   ComResWord("BINARY",           COMPAQ_|RESWORD_),
   ComResWord("BIT",              ANS_|RESWORD_),
   ComResWord("BIT_LENGTH",       ANS_|RESWORD_),
   ComResWord("BLOB",             COMPAQ_|RESWORD_),
   ComResWord("BOOLEAN",          POTANS_|RESWORD_),
-  ComResWord("BOTH",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("BOTH",             ANS_|RESWORD_),
   ComResWord("BREADTH",          POTANS_|RESWORD_),
-  ComResWord("BY",               ANS_|RESWORD_|MPWORD_),
+  ComResWord("BY",               ANS_|RESWORD_),
   ComResWord("CALL",             POTANS_|RESWORD_),
   ComResWord("CASCADE",          ANS_|RESWORD_),
   ComResWord("CASCADED",         ANS_|RESWORD_),
-  ComResWord("CASE",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("CASE",             ANS_|RESWORD_),
   ComResWord("CAST",             ANS_|RESWORD_),
-  ComResWord("CATALOG",          ANS_|RESWORD_|MPWORD_),
-  ComResWord("CHAR",             ANS_|RESWORD_|MPWORD_),
-  ComResWord("CHARACTER",        ANS_|RESWORD_|MPWORD_),
+  ComResWord("CATALOG",          ANS_|RESWORD_),
+  ComResWord("CHAR",             ANS_|RESWORD_),
+  ComResWord("CHARACTER",        ANS_|RESWORD_),
   ComResWord("CHARACTER_LENGTH", ANS_|RESWORD_),
   ComResWord("CHAR_LENGTH",      ANS_|RESWORD_),
-  ComResWord("CHECK",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("CHECK",            ANS_|RESWORD_),
   ComResWord("CLASS",            COMPAQ_|RESWORD_),
   ComResWord("CLOB",             COMPAQ_|RESWORD_),
-  ComResWord("CLOSE",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("CLOSE",            ANS_|RESWORD_),
   ComResWord("COALESCE",         ANS_|RESWORD_),
-  ComResWord("COLLATE",          ANS_|RESWORD_|MPWORD_),
+  ComResWord("COLLATE",          ANS_|RESWORD_),
   ComResWord("COLLATION",        ANS_|RESWORD_),
   ComResWord("COLUMN",           ANS_|RESWORD_),
-  ComResWord("COMMIT",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("COMMIT",           ANS_|RESWORD_),
   ComResWord("COMPLETION",       POTANS_|RESWORD_),
   ComResWord("CONNECT",          ANS_|RESWORD_),
   //  ComResWord("CONNECTION",       ANS_|RESWORD_),
@@ -108,17 +108,17 @@
   ComResWord("CONTINUE",         ANS_|RESWORD_),
   ComResWord("CONVERT",          ANS_|RESWORD_),
   ComResWord("CORRESPONDING",    ANS_|RESWORD_),
-  ComResWord("COUNT",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("COUNT",            ANS_|RESWORD_),
   ComResWord("CREATE",           ANS_|RESWORD_),
   ComResWord("CROSS",            ANS_|RESWORD_),
   ComResWord("CUBE",             COMPAQ_|RESWORD_),
-  ComResWord("CURRENT",          ANS_|RESWORD_|MPWORD_),
+  ComResWord("CURRENT",          ANS_|RESWORD_),
   ComResWord("CURRENT_DATE",     ANS_|RESWORD_),
   ComResWord("CURRENT_PATH",     COMPAQ_|RESWORD_),
   ComResWord("CURRENT_TIME",     ANS_|RESWORD_),
   ComResWord("CURRENT_TIMESTAMP",ANS_|RESWORD_),
   ComResWord("CURRENT_USER",     ANS_|RESWORD_),
-  ComResWord("CURSOR",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("CURSOR",           ANS_|RESWORD_),
   ComResWord("CYCLE",            POTANS_|RESWORD_),
   ComResWord("DATA",             POTANS_|NONRESWORD_),
   // The word DATA is used in several places in mxcmp (ISP and RFORK),
@@ -126,20 +126,20 @@
   // made it reserved even though it is in the potential ANSI reserved
   // word list.
 
-  ComResWord("DATE",             ANS_|RESWORD_|MPWORD_),
-  ComResWord("DATETIME",         COMPAQ_|RESWORD_|MPWORD_),
-  ComResWord("DAY",              ANS_|RESWORD_|MPWORD_),
+  ComResWord("DATE",             ANS_|RESWORD_),
+  ComResWord("DATETIME",         COMPAQ_|RESWORD_),
+  ComResWord("DAY",              ANS_|RESWORD_),
   ComResWord("DEALLOCATE",       ANS_|RESWORD_),
-  ComResWord("DEC",              ANS_|RESWORD_|MPWORD_),
-  ComResWord("DECIMAL",          ANS_|RESWORD_|MPWORD_),
-  ComResWord("DECLARE",          ANS_|RESWORD_|MPWORD_),
-  ComResWord("DEFAULT",          ANS_|RESWORD_|MPWORD_),
+  ComResWord("DEC",              ANS_|RESWORD_),
+  ComResWord("DECIMAL",          ANS_|RESWORD_),
+  ComResWord("DECLARE",          ANS_|RESWORD_),
+  ComResWord("DEFAULT",          ANS_|RESWORD_),
   ComResWord("DEFERRABLE",       ANS_|RESWORD_),
   ComResWord("DEFERRED",         ANS_|RESWORD_),
-  ComResWord("DELETE",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("DELETE",           ANS_|RESWORD_),
   ComResWord("DEPTH",            POTANS_|RESWORD_),
   ComResWord("DEREF",            COMPAQ_|RESWORD_),
-  ComResWord("DESC",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("DESC",             ANS_|RESWORD_),
   ComResWord("DESCRIBE",         ANS_|RESWORD_),
   ComResWord("DESCRIPTOR",       ANS_|RESWORD_),
   ComResWord("DESTROY",          COMPAQ_|RESWORD_),
@@ -148,7 +148,7 @@
   ComResWord("DIAGNOSTICS",      ANS_|RESWORD_),
   ComResWord("DICTIONARY",       POTANS_|RESWORD_),
   ComResWord("DISCONNECT",       ANS_|RESWORD_),
-  ComResWord("DISTINCT",         ANS_|RESWORD_|MPWORD_),
+  ComResWord("DISTINCT",         ANS_|RESWORD_),
   ComResWord("DOMAIN",           ANS_|RESWORD_),
   ComResWord("DOUBLE",           ANS_|RESWORD_),
   ComResWord("DROP",             ANS_|RESWORD_),
@@ -159,24 +159,24 @@
   ComResWord("END",              ANS_|RESWORD_),
   ComResWord("END-EXEC",         ANS_|RESWORD_),
   ComResWord("EQUALS",           POTANS_|RESWORD_),
-  ComResWord("ESCAPE",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("ESCAPE",           ANS_|RESWORD_),
   ComResWord("EXCEPT",           ANS_|RESWORD_),
   ComResWord("EXCEPTION",        ANS_|RESWORD_),
   ComResWord("EXEC",             ANS_|RESWORD_),
   ComResWord("EXECUTE",          ANS_|RESWORD_),
-  ComResWord("EXISTS",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("EXISTS",           ANS_|RESWORD_),
   ComResWord("EXTERNAL",         ANS_|RESWORD_),
   ComResWord("EXTRACT",          ANS_|RESWORD_),
   ComResWord("FALSE",            ANS_|RESWORD_),
-  ComResWord("FETCH",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("FETCH",            ANS_|RESWORD_),
   ComResWord("FIRST",            ANS_|RESWORD_),
   ComResWord("FLOAT",            ANS_|RESWORD_),
-  ComResWord("FOR",              ANS_|RESWORD_|MPWORD_),
+  ComResWord("FOR",              ANS_|RESWORD_),
   ComResWord("FOREIGN",          ANS_|RESWORD_),
   ComResWord("FOUND",            ANS_|RESWORD_),
-  ComResWord("FRACTION",         COMPAQ_|RESWORD_|MPWORD_),
+  ComResWord("FRACTION",         COMPAQ_|RESWORD_),
   ComResWord("FREE",             COMPAQ_|RESWORD_),
-  ComResWord("FROM",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("FROM",             ANS_|RESWORD_),
   ComResWord("FULL",             ANS_|RESWORD_),
   ComResWord("FUNCTION",         COMPAQ_|RESWORD_),
   ComResWord("GENERAL",          POTANS_|RESWORD_),
@@ -185,43 +185,43 @@
   ComResWord("GO",               ANS_|RESWORD_),
   ComResWord("GOTO",             ANS_|RESWORD_),
   ComResWord("GRANT",            ANS_|RESWORD_),
-  ComResWord("GROUP",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("GROUP",            ANS_|RESWORD_),
   ComResWord("GROUPING",         COMPAQ_|RESWORD_),
-  ComResWord("HAVING",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("HAVING",           ANS_|RESWORD_),
   ComResWord("HOST",             COMPAQ_|RESWORD_),
-  ComResWord("HOUR",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("HOUR",             ANS_|RESWORD_),
   ComResWord("IDENTITY",         ANS_|RESWORD_),
   ComResWord("IF",               POTANS_|RESWORD_),
   ComResWord("IGNORE",           POTANS_|RESWORD_),
   ComResWord("IMMEDIATE",        ANS_|RESWORD_),
-  ComResWord("IN",               ANS_|RESWORD_|MPWORD_),
+  ComResWord("IN",               ANS_|RESWORD_),
   ComResWord("INDICATOR",        ANS_|RESWORD_),
   ComResWord("INITIALLY",        ANS_|RESWORD_),
-  ComResWord("INNER",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("INNER",            ANS_|RESWORD_),
   ComResWord("INOUT",            COMPAQ_|RESWORD_),
-  ComResWord("INPUT",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("INPUT",            ANS_|RESWORD_),
   ComResWord("INSENSITIVE",      ANS_|RESWORD_),
-  ComResWord("INSERT",           ANS_|RESWORD_|MPWORD_),
-  ComResWord("INT",              ANS_|RESWORD_|MPWORD_),
-  ComResWord("INTEGER",          ANS_|RESWORD_|MPWORD_),
+  ComResWord("INSERT",           ANS_|RESWORD_),
+  ComResWord("INT",              ANS_|RESWORD_),
+  ComResWord("INTEGER",          ANS_|RESWORD_),
   ComResWord("INTERSECT",        ANS_|RESWORD_),
-  ComResWord("INTERVAL",         ANS_|RESWORD_|MPWORD_),
-  ComResWord("INTO",             ANS_|RESWORD_|MPWORD_),
-  ComResWord("IS",               ANS_|RESWORD_|MPWORD_),
+  ComResWord("INTERVAL",         ANS_|RESWORD_),
+  ComResWord("INTO",             ANS_|RESWORD_),
+  ComResWord("IS",               ANS_|RESWORD_),
   ComResWord("ISOLATION",        ANS_|RESWORD_),
   ComResWord("ITERATE",          COMPAQ_|RESWORD_),
-  ComResWord("JOIN",             ANS_|RESWORD_|MPWORD_),
-  ComResWord("KEY",              ANS_|RESWORD_|MPWORD_),
+  ComResWord("JOIN",             ANS_|RESWORD_),
+  ComResWord("KEY",              ANS_|RESWORD_),
   ComResWord("LANGUAGE",         ANS_|RESWORD_),
   ComResWord("LARGE",            COMPAQ_|RESWORD_),
   ComResWord("LAST",             ANS_|RESWORD_),
   ComResWord("LATERAL",          COMPAQ_|RESWORD_),
-  ComResWord("LEADING",          ANS_|RESWORD_|MPWORD_),
+  ComResWord("LEADING",          ANS_|RESWORD_),
   ComResWord("LEAVE",            POTANS_|RESWORD_),
-  ComResWord("LEFT",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("LEFT",             ANS_|RESWORD_),
   ComResWord("LESS",             POTANS_|RESWORD_),
   ComResWord("LEVEL",            ANS_|RESWORD_),
-  ComResWord("LIKE",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("LIKE",             ANS_|RESWORD_),
   ComResWord("LIMIT",            POTANS_|RESWORD_),
   ComResWord("LOCAL",            ANS_|RESWORD_),
   ComResWord("LOCALTIME",        COMPAQ_|RESWORD_),
@@ -230,43 +230,41 @@
   ComResWord("LOOP",             POTANS_|RESWORD_),
   ComResWord("LOWER",            ANS_|RESWORD_),
   ComResWord("MATCH",            ANS_|RESWORD_),
-  ComResWord("MAX",              ANS_|RESWORD_|MPWORD_),
+  ComResWord("MAX",              ANS_|RESWORD_),
   ComResWord("MIN",              ANS_|RESWORD_),
-  ComResWord("MINUTE",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("MINUTE",           ANS_|RESWORD_),
   ComResWord("MODIFIES",         COMPAQ_|RESWORD_),
   ComResWord("MODIFY",           POTANS_|RESWORD_),
   ComResWord("MODULE",           ANS_|RESWORD_),
-  ComResWord("MONTH",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("MONTH",            ANS_|RESWORD_),
   ComResWord("NAMES",            ANS_|RESWORD_),
   ComResWord("NATIONAL",         ANS_|RESWORD_),
   ComResWord("NATURAL",          ANS_|RESWORD_),
   ComResWord("NCHAR",            ANS_|RESWORD_),
   ComResWord("NCLOB",            COMPAQ_|RESWORD_),
-  ComResWord("NEW",              POTANS_|RESWORD_|ALLOWOLDNEW_),
   ComResWord("NEXT",             ANS_|RESWORD_),
   ComResWord("NO",               ANS_|RESWORD_),
   ComResWord("NONE",             POTANS_|RESWORD_),
-  ComResWord("NOT",              ANS_|RESWORD_|MPWORD_),
-  ComResWord("NULL",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("NOT",              ANS_|RESWORD_),
+  ComResWord("NULL",             ANS_|RESWORD_),
   ComResWord("NULLIF",           ANS_|RESWORD_),
-  ComResWord("NUMERIC",          ANS_|RESWORD_|MPWORD_),
+  ComResWord("NUMERIC",          ANS_|RESWORD_),
   ComResWord("OBJECT",           POTANS_|RESWORD_),
   ComResWord("OCTET_LENGTH",     ANS_|RESWORD_),
-  ComResWord("OF",               ANS_|RESWORD_|MPWORD_),
+  ComResWord("OF",               ANS_|RESWORD_),
   ComResWord("OFF",              POTANS_|RESWORD_),
-  ComResWord("OLD",              POTANS_|RESWORD_|ALLOWOLDNEW_),
-  ComResWord("ON",               ANS_|RESWORD_|MPWORD_),
+  ComResWord("ON",               ANS_|RESWORD_),
   ComResWord("ONLY",             ANS_|RESWORD_),
-  ComResWord("OPEN",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("OPEN",             ANS_|RESWORD_),
   ComResWord("OPERATION",        POTANS_|NONRESWORD_),
   // The word OPERATION is used as a column in the SMD LOCKS table, so
   // we have not made this word reserved even though it is in the
   // potential ANSI reserved word list.
 
   ComResWord("OPERATORS",        POTANS_|RESWORD_),
-  ComResWord("OPTION",           ANS_|RESWORD_|MPWORD_),
-  ComResWord("OR",               ANS_|RESWORD_|MPWORD_),
-  ComResWord("ORDER",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("OPTION",           ANS_|RESWORD_),
+  ComResWord("OR",               ANS_|RESWORD_),
+  ComResWord("ORDER",            ANS_|RESWORD_),
   ComResWord("ORDINALITY",       COMPAQ_|RESWORD_),
   ComResWord("OTHERS",           POTANS_|RESWORD_),
   ComResWord("OUT",              COMPAQ_|RESWORD_),
@@ -310,8 +308,8 @@
   ComResWord("RETURN",           POTANS_|RESWORD_),
   ComResWord("RETURNS",          POTANS_|RESWORD_),
   ComResWord("REVOKE",           ANS_|RESWORD_),
-  ComResWord("RIGHT",            ANS_|RESWORD_|MPWORD_),
-  ComResWord("ROLLBACK",         ANS_|RESWORD_|MPWORD_),
+  ComResWord("RIGHT",            ANS_|RESWORD_),
+  ComResWord("ROLLBACK",         ANS_|RESWORD_),
   ComResWord("ROLLUP",           COMPAQ_|RESWORD_),
   ComResWord("ROUTINE",          POTANS_|RESWORD_),
   ComResWord("ROW",              ANS_|RESWORD_),
@@ -321,19 +319,19 @@
   ComResWord("SCOPE",            COMPAQ_|RESWORD_),
   ComResWord("SCROLL",           ANS_|RESWORD_),
   ComResWord("SEARCH",           POTANS_|RESWORD_),
-  ComResWord("SECOND",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("SECOND",           ANS_|RESWORD_),
   ComResWord("SECTION",          ANS_|RESWORD_),
-  ComResWord("SELECT",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("SELECT",           ANS_|RESWORD_),
   ComResWord("SENSITIVE",        POTANS_|RESWORD_),
   ComResWord("SESSION",          ANS_|RESWORD_),
   ComResWord("SESSION_USER",     ANS_|RESWORD_),
-  ComResWord("SET",              ANS_|RESWORD_|MPWORD_),
+  ComResWord("SET",              ANS_|RESWORD_),
   ComResWord("SETS",             COMPAQ_|RESWORD_),
   ComResWord("SIGNAL",           POTANS_|RESWORD_),
   ComResWord("SIMILAR",          POTANS_|RESWORD_),
   ComResWord("SIZE",             ANS_|RESWORD_),
-  ComResWord("SMALLINT",         ANS_|RESWORD_|MPWORD_),
-  ComResWord("SOME",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("SMALLINT",         ANS_|RESWORD_),
+  ComResWord("SOME",             ANS_|RESWORD_),
   ComResWord("SPECIFIC",         COMPAQ_|RESWORD_),
   ComResWord("SPECIFICTYPE",     COMPAQ_|RESWORD_),
   ComResWord("SQL",              ANS_|RESWORD_),
@@ -360,21 +358,21 @@
 // used in qat tests
   ComResWord("STRUCTURE",        POTANS_|RESWORD_),
   ComResWord("SUBSTRING",        ANS_|RESWORD_),
-  ComResWord("SUM",              ANS_|RESWORD_|MPWORD_),
+  ComResWord("SUM",              ANS_|RESWORD_),
   ComResWord("SYSTEM_USER",      ANS_|RESWORD_),
-  ComResWord("TABLE",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("TABLE",            ANS_|RESWORD_),
   ComResWord("TEMPORARY",        ANS_|RESWORD_),
   ComResWord("TERMINATE",        COMPAQ_|RESWORD_),
   ComResWord("TEST",             POTANS_|RESWORD_),
   ComResWord("THAN",             COMPAQ_|RESWORD_),
-  ComResWord("THEN",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("THEN",             ANS_|RESWORD_),
   ComResWord("THERE",            POTANS_|RESWORD_),
-  ComResWord("TIME",             ANS_|RESWORD_|MPWORD_),
-  ComResWord("TIMESTAMP",        ANS_|RESWORD_|MPWORD_),
+  ComResWord("TIME",             ANS_|RESWORD_),
+  ComResWord("TIMESTAMP",        ANS_|RESWORD_),
   ComResWord("TIMEZONE_HOUR",    ANS_|RESWORD_),
   ComResWord("TIMEZONE_MINUTE",  ANS_|RESWORD_),
-  ComResWord("TO",               ANS_|RESWORD_|MPWORD_),
-  ComResWord("TRAILING",         ANS_|RESWORD_|MPWORD_),
+  ComResWord("TO",               ANS_|RESWORD_),
+  ComResWord("TRAILING",         ANS_|RESWORD_),
   ComResWord("TRANSACTION",      ANS_|RESWORD_),
   ComResWord("TRANSLATE",        ANS_|RESWORD_),
   ComResWord("TRANSLATION",      ANS_|RESWORD_),
@@ -384,34 +382,34 @@
   ComResWord("TRIM",             ANS_|RESWORD_),
   ComResWord("TRUE",             ANS_|RESWORD_),
   ComResWord("UNDER",            POTANS_|RESWORD_),
-  ComResWord("UNION",            ANS_|RESWORD_|MPWORD_),
-  ComResWord("UNIQUE",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("UNION",            ANS_|RESWORD_),
+  ComResWord("UNIQUE",           ANS_|RESWORD_),
   ComResWord("UNKNOWN",          ANS_|RESWORD_),
   ComResWord("UNNEST",           COMPAQ_|RESWORD_),
-  ComResWord("UPDATE",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("UPDATE",           ANS_|RESWORD_),
   ComResWord("UPPER",            ANS_|RESWORD_),
   ComResWord("UPSERT",           RESWORD_),
   ComResWord("UPSHIFT",          COMPAQ_|RESWORD_),
   ComResWord("USAGE",            ANS_|RESWORD_),
   ComResWord("USER",             ANS_|RESWORD_),
   ComResWord("USING",            ANS_|RESWORD_),
-  ComResWord("VALUES",           ANS_|RESWORD_|MPWORD_),
+  ComResWord("VALUES",           ANS_|RESWORD_),
   ComResWord("VARCHAR",          ANS_|RESWORD_),
   ComResWord("VARIABLE",         POTANS_|RESWORD_),
   ComResWord("VARYING",          ANS_|RESWORD_),
-  ComResWord("VIEW",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("VIEW",             ANS_|RESWORD_),
   ComResWord("VIRTUAL",          POTANS_|RESWORD_),
   ComResWord("VISIBLE",          POTANS_|RESWORD_),
   ComResWord("WAIT",             POTANS_|RESWORD_),
-  ComResWord("WHEN",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("WHEN",             ANS_|RESWORD_),
   ComResWord("WHENEVER",         ANS_|RESWORD_),
-  ComResWord("WHERE",            ANS_|RESWORD_|MPWORD_),
+  ComResWord("WHERE",            ANS_|RESWORD_),
   ComResWord("WHILE",            POTANS_|RESWORD_),
-  ComResWord("WITH",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("WITH",             ANS_|RESWORD_),
   ComResWord("WITHOUT",          POTANS_|RESWORD_),
-  ComResWord("WORK",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("WORK",             ANS_|RESWORD_),
   ComResWord("WRITE",            ANS_|RESWORD_),
-  ComResWord("YEAR",             ANS_|RESWORD_|MPWORD_),
+  ComResWord("YEAR",             ANS_|RESWORD_),
   ComResWord("ZONE",             ANS_|RESWORD_)
 };
 
@@ -464,7 +462,7 @@
 // =================================================================
 //
 NABoolean
-ComResWords::isSqlReservedWord(const char *word,NABoolean mp_context,
+ComResWords::isSqlReservedWord(const char *word,
 			       UInt32 ifSetFlags)
 {
   char uword[MAX_RESWORD_LENGTH];
@@ -491,7 +489,7 @@
     //resWord.setResWord(uword, 0);
     ComResWord *entry = searchResWordTbl(&resWord);
 
-    return (entry && entry->isReserved(mp_context,ifSetFlags));
+    return (entry && entry->isReserved(ifSetFlags));
   } else {
     return FALSE;
   }
diff --git a/core/sql/common/ComResWords.h b/core/sql/common/ComResWords.h
index 99c817b..e8f7af9 100644
--- a/core/sql/common/ComResWords.h
+++ b/core/sql/common/ComResWords.h
@@ -54,8 +54,6 @@
                                 // are not for various reason. See ABSOLUTE,
                                 // DATA, and OPERATION in ComResWords.cpp.
 
-  MPWORD_      = 0x04,          // a SQL/MP Reserved word.
-
   ANS_         = 0x08,          // Indicates that the word is reserved by ANSI
                                 // This flag is used only for notation.
 
@@ -94,12 +92,9 @@
   //
   inline const char *getResWord() const { return resWord_; };
 
-  // Is the word reserved, depends on isMPContext.
+  // Is the word reserved
   //
-  inline NABoolean isReserved(NABoolean inMPContext,UInt32 ifSetFlags) {
-    if (inMPContext) 
-      return isMPReserved();
-     else 
+  inline NABoolean isReserved(UInt32 ifSetFlags) {
       return ((flags_ & RESWORD_) &&
 	      !(allowOldAndNew(ifSetFlags) ));
    
@@ -112,16 +107,6 @@
     return  (ifSetFlags & (flags_ & ALLOWOLDNEW_));
   };
 
-  // Are we parsing/lexing SQL/MP Stored text.
-  // This affect which words are reserved identifiers.
-  //
-  
-  
-  // Is the word reserved by SQL/MP.
-  //
-  inline NABoolean isMPReserved() const { return flags_ & MPWORD_; };
-
-
   // The reserved word.
   //
   const char * resWord_;
@@ -153,11 +138,9 @@
   ComResWords(const ComResWords &other, NAMemory * h=0); 
   ComResWords(NAMemory * h=0);
 
-  // Determine if the given word is reserved. Depends on if parsing
-  // MX or MP text.
+  // Determine if the given word is reserved. 
   //
   static NABoolean isSqlReservedWord(const char *word,
-				     NABoolean MPContext =FALSE,
 				     UInt32 ifSetFlags = 0);
 
 private:
diff --git a/core/sql/common/ComRtUtils.cpp b/core/sql/common/ComRtUtils.cpp
index 35f9ca7..764b8ee 100644
--- a/core/sql/common/ComRtUtils.cpp
+++ b/core/sql/common/ComRtUtils.cpp
@@ -1123,3 +1123,26 @@
   sprintf(ComRtGetUnknownString_Buf, "UNKNOWN (%d)", (int) val);
   return &(ComRtGetUnknownString_Buf[0]);
 }
+
+
+pid_t ComRtGetConfiguredPidMax()
+{
+   FILE *fd_pid_max;
+   char buffer[100];
+   size_t bytesRead = 0;
+   pid_t pid_max = 0;
+
+   fd_pid_max = fopen("/proc/sys/kernel/pid_max", "r");
+   if (fd_pid_max != NULL) {
+      bytesRead = fread(buffer, 1, sizeof(buffer)-1, fd_pid_max);
+      if (ferror(fd_pid_max))
+         assert(false); 
+      if (feof(fd_pid_max))
+         clearerr(fd_pid_max);
+      buffer[bytesRead] = '\0';
+      pid_max = atoi(buffer);
+      fclose(fd_pid_max);
+      return pid_max;
+   } 
+   return 0;
+}
diff --git a/core/sql/common/ComRtUtils.h b/core/sql/common/ComRtUtils.h
index 94d309c..d26e52e 100644
--- a/core/sql/common/ComRtUtils.h
+++ b/core/sql/common/ComRtUtils.h
@@ -288,4 +288,6 @@
 
 SB_Phandle_Type *get_phandle_with_retry(char *pname, short *fserr = NULL);
 
+pid_t ComRtGetConfiguredPidMax();
+
 #endif // COMRTUTILS_H
diff --git a/core/sql/common/DTICommonType.cpp b/core/sql/common/DTICommonType.cpp
index e8c11df..44fe2da 100644
--- a/core/sql/common/DTICommonType.cpp
+++ b/core/sql/common/DTICommonType.cpp
@@ -73,6 +73,22 @@
     return "YEARMONTHD";
   case REC_DATE_YEARWEEK_D_EXTRACT:
     return "YEARWEEKD";
+  case REC_DATE_CENTURY:
+    return "CENTURY";
+  case REC_DATE_DECADE:
+    return "DECADE";
+  case REC_DATE_WEEK:
+    return "WEEK";
+  case REC_DATE_QUARTER:
+    return "QUARTER";
+  case REC_DATE_EPOCH:
+    return "EPOCH";
+  case REC_DATE_DOW:
+    return "DOW";
+  case REC_DATE_DOY:
+    return "DOY";
+  case REC_DATE_WOM:
+    return "WOM";
   default:
     return NULL;
   }
diff --git a/core/sql/common/DateTimeType.cpp b/core/sql/common/DateTimeType.cpp
index de67e74..c9cab0f 100644
--- a/core/sql/common/DateTimeType.cpp
+++ b/core/sql/common/DateTimeType.cpp
@@ -314,9 +314,13 @@
     {
       str_cpy_all((char *) &fraction, datetimeOpData, sizeof(fraction));
       if (fractionPrec > 0)
-        // Adjust the fractional seconds part to be the number of microseconds.
-        fraction *= (Lng32)pow(10, (DatetimeType::MAX_FRACTION_PRECISION
-                                        - fractionPrec));
+        {
+          if (fractionPrec > DatetimeType::MAX_FRACTION_PRECISION_USEC)
+            // Adjust the fractional seconds part to be the number of microseconds
+            fraction /= (Lng32)pow(10, (fractionPrec - DatetimeType::MAX_FRACTION_PRECISION_USEC));
+          else 
+            fraction *= (Lng32)pow(10, (DatetimeType::MAX_FRACTION_PRECISION_USEC - fractionPrec));
+        }
     }
   short timestamp[] = {
     year, month, day, hour, minute, second, (short)(fraction / 1000), (short)(fraction % 1000)
@@ -584,7 +588,7 @@
                                  (datetime2->supportsSQLnull())) ? TRUE : FALSE);
 
         UInt32 fractionPrecision = MAXOF(datetime1->getFractionPrecision(),
-					   datetime2->getFractionPrecision());
+                                         datetime2->getFractionPrecision());
 
         if ((modeSpecial4) &&
             (fractionPrecision == 0) &&
@@ -597,8 +601,16 @@
           }
         else
           {
-            return new(h) SQLInterval(h, allowNulls, datetime1->getEndField(),
-                                      12, datetime1->getEndField(),
+            Int32 leadingPrecision = IntervalType::computeLeadingPrecision
+              (datetime1->getEndField(), 
+               SQLInterval::MAX_LEADING_PRECISION, 
+               datetime1->getEndField(),
+               fractionPrecision);
+            
+            return new(h) SQLInterval(h, allowNulls, 
+                                      datetime1->getEndField(),
+                                      leadingPrecision, 
+                                      datetime1->getEndField(),
                                       fractionPrecision);
           }
       }
@@ -1383,7 +1395,7 @@
 
   ComDiagsArea *diags = NULL;
 
-  Lng32 trueFP = 6;
+  Lng32 trueFP = DatetimeType::MAX_FRACTION_PRECISION;
   ULng32 flags = 0;
   flags |= CONV_NO_HADOOP_DATE_FIX;
   short rc = 
@@ -1399,7 +1411,7 @@
   if (endField == REC_DATE_SECOND)
     {
       Lng32 fp = trueFP;
-      for (; fp < 6; fp++)
+      for (; fp < DatetimeType::MAX_FRACTION_PRECISION; fp++)
         {
           if (startField == REC_DATE_YEAR)
             *(Lng32*)&dstValue[7] /= 10;
diff --git a/core/sql/common/DatetimeType.h b/core/sql/common/DatetimeType.h
index e948fd5..e56b575 100644
--- a/core/sql/common/DatetimeType.h
+++ b/core/sql/common/DatetimeType.h
@@ -69,7 +69,10 @@
 public:
 
   enum { DEFAULT_FRACTION_PRECISION = 0 };      // See ANSI 6.1 SR 25: zero
-  enum { MAX_FRACTION_PRECISION = 6 };  // See ANSI 6.1 SR 26: max is at least 6
+  enum { MAX_FRACTION_PRECISION_USEC = 6 }; // max microseconds fract precision
+  enum { MAX_FRACTION_PRECISION = 9 };  // See ANSI 6.1 SR 26: max is at least 6.
+                                        // Changed to 9 to support nano secs 
+                                        // fractional precision
 
   enum Subtype { SUBTYPE_ILLEGAL,
                  SUBTYPE_SQLDate, 
diff --git a/core/sql/common/IntervalType.cpp b/core/sql/common/IntervalType.cpp
index e10bf08..74d6d7a 100644
--- a/core/sql/common/IntervalType.cpp
+++ b/core/sql/common/IntervalType.cpp
@@ -251,9 +251,9 @@
 } // IntervalType::getPrecision
 
 UInt32 IntervalType::computeLeadingPrecision(rec_datetime_field startField,
-					       UInt32 precision,
-					       rec_datetime_field endField,
-					       UInt32 fractionPrecision)
+                                             UInt32 precision,
+                                             rec_datetime_field endField,
+                                             UInt32 fractionPrecision)
 {
   UInt32 leadingPrecision;
   switch (getIntervalFSDatatype(startField, endField)) {
@@ -299,9 +299,11 @@
 				  UInt32 fractionPrecision)
 {
   Lng32 size = getBinaryStorageSize(getPrecision(startField, 
-                                                 leadingPrecision,
-                                                 endField,
-                                                 fractionPrecision));
+                            leadingPrecision,
+                            endField,
+                            fractionPrecision));
+  
+
   // interval datatypes are stored as 2(smallint),4(int) or 8(largeint) bytes.
   // If size is tinyint size based on precision, change it to smallint size.
   if (size == SQL_TINY_SIZE)
diff --git a/core/sql/common/IntervalType.h b/core/sql/common/IntervalType.h
index 378ff76..ec80729 100644
--- a/core/sql/common/IntervalType.h
+++ b/core/sql/common/IntervalType.h
@@ -325,7 +325,8 @@
   enum { DEFAULT_LEADING_PRECISION  =  2,	// ANSI 10.1 SR 5: two
 	 MAX_LEADING_PRECISION	    = MAX_NUMERIC_PRECISION, // 10.1 SR 3: >=2
 	 DEFAULT_FRACTION_PRECISION =  6,	// ANSI 10.1 SR 6: six
-	 MAX_FRACTION_PRECISION	    =  6	// ANSI 10.1 SR 4: >=6
+	 MAX_FRACTION_PRECISION_USEC=  6,	// ANSI 10.1 SR 4: >=6
+	 MAX_FRACTION_PRECISION	    =  9	// ANSI 10.1 SR 4: >=6
        };
 
   // ---------------------------------------------------------------------
diff --git a/core/sql/common/NAMemory.cpp b/core/sql/common/NAMemory.cpp
index 0c13caa..d3f0fdd 100644
--- a/core/sql/common/NAMemory.cpp
+++ b/core/sql/common/NAMemory.cpp
@@ -877,6 +877,8 @@
     , lastVmSize_(0l)
     , maxVmSize_(0l)
     , sharedMemory_(FALSE)
+    , heapStartAddr_(NULL)
+    , heapStartOffset_(NULL)
 {
   setType(type_, 0);
 #if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) )  
@@ -928,6 +930,8 @@
     , lastVmSize_(0l)
     , maxVmSize_(0l)
     , sharedMemory_(FALSE)
+    , heapStartAddr_(NULL)
+    , heapStartOffset_(NULL)
 {
   if (parent_->getSharedMemory())
      setSharedMemory();
@@ -984,6 +988,8 @@
     , lastVmSize_(0l)
     , maxVmSize_(0l)
     , sharedMemory_(FALSE)
+    , heapStartAddr_(NULL)
+    , heapStartOffset_(NULL)
 {
   // call setType to initialize the values of all the sizes
   setType(type_, blockSize);
@@ -1035,6 +1041,8 @@
     , lastVmSize_(0l)
     , maxVmSize_(0l)
     , sharedMemory_(FALSE)
+    , heapStartOffset_(heapStartOffset)
+    , heapStartAddr_(baseAddr)
 {
   // call setType to initialize the values of all the sizes
   setType(type_, 0);
@@ -1055,12 +1063,12 @@
   // space in the segment, then initialize the firstBlk_ within
   // the passed in memory.  The NAHeap constructor will initialize
   // the top NAHeapFragment.
-  if (baseAddr != NULL) {
+  if (heapStartAddr_ != NULL) {
     blockCnt_ = 1;
-    size_t tsize = maxSize - heapStartOffset - BLOCK_OVERHEAD;
+    size_t tsize = maxSize - heapStartOffset_ - BLOCK_OVERHEAD;
     if (tsize > (8 * sizeof(size_t))) {
-      firstBlk_ = (NABlock*)((char*)baseAddr + heapStartOffset);
-      firstBlk_->size_ = maxSize - heapStartOffset;
+      firstBlk_ = (NABlock*)((char*)heapStartAddr_ + heapStartOffset_);
+      firstBlk_->size_ = maxSize - heapStartOffset_;
       firstBlk_->sflags_ = NABlock::EXTERN_BIT;
       firstBlk_->next_ = NULL;
       firstBlk_->segmentId_ = segmentId;
@@ -1161,7 +1169,7 @@
     firstBlk_ = externSegment;
     firstBlk_->next_ = NULL;
     blockCnt_ = 1;
-    totalSize_ = firstBlk_->size_ ;
+    totalSize_ = firstBlk_->size_ - heapStartOffset_;
   }
 
   // If this is an NAHeap, then call reInitializeHeap() to reinitialize
@@ -2668,6 +2676,7 @@
   // That code frees the NABlocks and will reinitialize the firstBlk_
   // if it was allocated externally.
   if (firstBlk_ != NULL) {
+     assert((char*)firstBlk_ == ((char*)heapStartAddr_ - heapStartOffset_));
      least_addr_ = (char*)firstBlk_;
      initTop(firstBlk_);
   }
diff --git a/core/sql/common/NAMemory.h b/core/sql/common/NAMemory.h
index 009ec1a..329159f 100644
--- a/core/sql/common/NAMemory.h
+++ b/core/sql/common/NAMemory.h
@@ -380,6 +380,8 @@
   Lng32 lastVmSize_;
   Lng32 maxVmSize_;
   DerivedClass derivedClass_; // The derived class (removes virtual functions)
+  off_t heapStartOffset_;
+  void *heapStartAddr_;
 public:
   // ---------------------------------------------------------------------
   // The following method and data member are needed for minimizing
diff --git a/core/sql/common/NAString.cpp b/core/sql/common/NAString.cpp
index 5733837..107e620 100644
--- a/core/sql/common/NAString.cpp
+++ b/core/sql/common/NAString.cpp
@@ -377,7 +377,7 @@
 // an ANSI, PotentialANSI, or Tandem reserved word.
 NABoolean IsSqlReservedWord(const char *sqlText)
 {
-  return FALSE;
+  return ComResWords::isSqlReservedWord(sqlText,0);
 }
 
 NABoolean IsCIdentifier(const char *id)
@@ -1137,6 +1137,7 @@
 	"COS ",                // Tandem-extension
 	"COSH ",               // Tandem-extension
 	"COUNT ",              // ANSI
+	"CRC32 ",              // Trafodion extension
 	"CURDATE ",            // Tandem-extension
 	"CURRENT ",            // ANSI
 	"CURRENT_DATE ",       // ANSI
@@ -1175,6 +1176,7 @@
 	"LPAD ",               // Tandem-extension
 	"LTRIM ",              // Tandem-extension
 	"MAX ",                // ANSI
+	"MD5 ",                // Trafodion extension
 	"MIN ",                // ANSI
 	"MINUTE ",             // Datatype with scales/precisions/length
 	"MOD ",                // Tandem-extension
@@ -1201,6 +1203,9 @@
 	"RTRIM ",              // Tandem-extension
 	"SECOND ",             // Datatype with scales/precisions/length
 	"SESSION_USER ",       // ANSI
+	"SHA ",                // Trafodion extension
+	"SHA1 ",               // Trafodion extension
+	"SHA2 ",               // Trafodion extension
 	"SIGN ",               // Tandem-extension
 	"SIN ",                // Tandem-extension
 	"SINH ",               // Tandem-extension
diff --git a/core/sql/common/NAType.cpp b/core/sql/common/NAType.cpp
index b428500..ab5b4fa 100644
--- a/core/sql/common/NAType.cpp
+++ b/core/sql/common/NAType.cpp
@@ -1005,7 +1005,7 @@
     return new (heap) SQLDoublePrecision(heap, TRUE /* allow NULL*/);
 
   if ( !strcmp(hiveType, "timestamp"))
-    return new (heap) SQLTimestamp(heap, TRUE /* allow NULL */ , 6);
+    return new (heap) SQLTimestamp(heap, TRUE /* allow NULL */ , DatetimeType::MAX_FRACTION_PRECISION);
 
   if ( !strcmp(hiveType, "date"))
     return new (heap) SQLDate(heap, TRUE /* allow NULL */);
diff --git a/core/sql/common/NAWinNT.h b/core/sql/common/NAWinNT.h
index 2edcd1e..26da7b3 100644
--- a/core/sql/common/NAWinNT.h
+++ b/core/sql/common/NAWinNT.h
@@ -181,6 +181,7 @@
 Int64 na_wcstoll (const NAWchar *);
 Lng32 na_wcstol (const NAWchar *);
 NAWchar *na_wcschr (const NAWchar *, NAWchar);
+NAWchar *na_wcschrSkipOverParenText (const NAWchar *, NAWchar);
 NAWchar *na_wcsrchr (const NAWchar *, NAWchar);
 Int32 na_wsprintf(NAWchar *buffer, const NAWchar *format, ... );
 NAWchar *na_wmemchr(const NAWchar *ws, NAWchar wc, Int32 n); // used by swsprintf
diff --git a/core/sql/common/OperTypeEnum.h b/core/sql/common/OperTypeEnum.h
index f3114ca..dda4074 100644
--- a/core/sql/common/OperTypeEnum.h
+++ b/core/sql/common/OperTypeEnum.h
@@ -519,6 +519,7 @@
                         ITM_JSONOBJECTFIELDTEXT = 2241,
 
                         // string functions
+                        ITM_SPLIT_PART = 2249,
                         ITM_TRUNC = 2250,
                         ITM_ASCII = 2251,
                         ITM_POSITION = 2252,
@@ -1097,7 +1098,6 @@
                         ELM_LIKE_OPT_LIMIT_COLUMN_LENGTH,
                         ELM_LIKE_OPT_WITHOUT_ROW_FORMAT_ELEM,
                         ELM_LIKE_OPT_WITHOUT_LOB_COLUMNS,
-                        ELM_LIKE_OPT_WITH_HIVE_OPTIONS,
                         ELM_LOCATION_ELEM,
                         ELM_OPTION_LIST,
                         ELM_PARALLEL_EXEC_ELEM,
diff --git a/core/sql/common/dfs2rec.h b/core/sql/common/dfs2rec.h
index 910cda3..b87c960 100644
--- a/core/sql/common/dfs2rec.h
+++ b/core/sql/common/dfs2rec.h
@@ -231,7 +231,14 @@
 , REC_DATE_MINUTE
 , REC_DATE_SECOND
 , REC_DATE_FRACTION_MP			// Used in MP only!
-
+, REC_DATE_CENTURY
+, REC_DATE_DECADE
+, REC_DATE_WEEK
+, REC_DATE_QUARTER
+, REC_DATE_EPOCH
+, REC_DATE_DOW
+, REC_DATE_DOY
+, REC_DATE_WOM
 , REC_DATE_MAX_SINGLE_FIELD
   // other datetime fields, not used in FS2 and DDL
 , REC_DATE_YEARQUARTER_EXTRACT   = 1000     // Used for EXTRACT (DATE_PART) function only!
diff --git a/core/sql/common/wstr.cpp b/core/sql/common/wstr.cpp
index 4480998..b4dc622 100644
--- a/core/sql/common/wstr.cpp
+++ b/core/sql/common/wstr.cpp
@@ -286,6 +286,39 @@
    return NULL;
 }
 
+// like na_wcschr, except this variant skips over any text
+// that is within matched parentheses (note that it will never
+// find a left parenthesis as a consequence)
+NAWchar *na_wcschrSkipOverParenText (const NAWchar * wstr, NAWchar wc)
+{
+   NAWchar* p = (NAWchar*)wstr;
+
+   if ( wc == 0 )
+     return p+na_wcslen(wstr);
+
+   int ignoringTextDepth = 0;
+   while ( *p != (NAWchar)0 )
+     {
+       if (ignoringTextDepth > 0)
+         {
+           if (*p == L')')
+             ignoringTextDepth--;
+           p++;
+         }
+       else if (*p == L'(')
+         {
+           ignoringTextDepth++;
+           p++;
+         }
+       else if ( wc == *p )
+         return p;
+       else 
+         p++;
+     }
+
+   return NULL;
+}
+
 NAWchar *na_wcsrchr (const NAWchar * wstr, NAWchar wc)
 {
    NAWchar* p = (NAWchar*)wstr;
diff --git a/core/sql/executor/ExComTdb.cpp b/core/sql/executor/ExComTdb.cpp
index 68b4cf7..005cdf1 100644
--- a/core/sql/executor/ExComTdb.cpp
+++ b/core/sql/executor/ExComTdb.cpp
@@ -330,12 +330,6 @@
       break;
     }
 
-    case ex_FAST_DELETE:
-    {
-      GetVTblPtr(vtblptr,ExExeUtilFastDeleteTdb);
-      break;
-    }
-
     case ex_HIVE_TRUNCATE:
     {
       GetVTblPtr(vtblptr,ExExeUtilHiveTruncateTdb);
diff --git a/core/sql/executor/ExExeUtil.h b/core/sql/executor/ExExeUtil.h
index 595a0a6..49261a6 100644
--- a/core/sql/executor/ExExeUtil.h
+++ b/core/sql/executor/ExExeUtil.h
@@ -86,7 +86,6 @@
 class ExExeUtilTdb;
 class ExExeUtilDisplayExplainTdb;
 class ExExeUtilDisplayExplainComplexTdb;
-class ExExeUtilFastDeleteTdb;
 class ExExeUtilHiveTruncateTdb;
 class ExExeUtilHiveQueryTdb;
 class ExExeUtilSuspendTdb;
@@ -236,7 +235,8 @@
 
   NABoolean isUpQueueFull(short size);
 
-  char * getTimeAsString(Int64 t, char * timeBuf);
+  static char * getTimeAsString(Int64 t, char * timeBuf,
+                                NABoolean noUsec = FALSE);
   char * getTimestampAsString(Int64 t, char * timeBuf);
 
   short initializeInfoList(Queue* &infoList);
@@ -436,7 +436,6 @@
   friend class ExExeUtilTcb;
   friend class ExExeUtilCleanupVolatileTablesTcb;
   friend class ExExeUtilCreateTableAsTcb;
-  friend class ExExeUtilFastDeleteTcb;
   friend class ExExeUtilHiveTruncateTcb;
   friend class ExExeUtilHiveQueryTcb;
   friend class ExExeUtilAQRTcb;
@@ -900,7 +899,7 @@
     {
       INITIAL_,
       CREATE_,
-      DELETE_DATA_,
+      TRUNCATE_TABLE_,
       INSERT_SIDETREE_,
       INSERT_VSBB_,
       ALTER_TO_NOAUDIT_,
@@ -908,7 +907,7 @@
       ALTER_TO_AUDIT_AND_INSERT_VSBB_,
       UPD_STATS_,
       DONE_,
-      HANDLE_ERROR_, DELETE_DATA_AND_ERROR_, ERROR_,
+      HANDLE_ERROR_, TRUNCATE_TABLE_AND_ERROR_, ERROR_,
       DROP_AND_ERROR_,
       DROP_AND_DONE_,
       INSERT_SIDETREE_EXECUTE_,
@@ -1359,141 +1358,6 @@
  protected:
 };
 
-// -----------------------------------------------------------------------
-// ExExeUtilFastDeleteTdb
-// -----------------------------------------------------------------------
-class ExExeUtilFastDeleteTdb : public ComTdbExeUtilFastDelete
-{
- public:
-
-  // ---------------------------------------------------------------------
-  // Constructor is only called to instantiate an object used for
-  // retrieval of the virtual table function pointer of the class while
-  // unpacking. An empty constructor is enough.
-  // ---------------------------------------------------------------------
-  ExExeUtilFastDeleteTdb()
-    {}
-
-  virtual ~ExExeUtilFastDeleteTdb()
-    {}
-
-  // ---------------------------------------------------------------------
-  // Build a TCB for this TDB. Redefined in the Executor project.
-  // ---------------------------------------------------------------------
-  virtual ex_tcb *build(ex_globals *globals);
-
- private:
-  // ---------------------------------------------------------------------
-  // !!!!!!! IMPORTANT -- NO DATA MEMBERS ALLOWED IN EXECUTOR TDB !!!!!!!!
-  // *********************************************************************
-  // The Executor TDB's are only used for the sole purpose of providing a
-  // way to supplement the Compiler TDB's (in comexe) with methods whose
-  // implementation depends on Executor objects. This is done so as to
-  // decouple the Compiler from linking in Executor objects unnecessarily.
-  //
-  // When a Compiler generated TDB arrives at the Executor, the same data
-  // image is "cast" as an Executor TDB after unpacking. Therefore, it is
-  // a requirement that a Compiler TDB has the same object layout as its
-  // corresponding Executor TDB. As a result of this, all Executor TDB's
-  // must have absolutely NO data members, but only member functions. So,
-  // if you reach here with an intention to add data members to a TDB, ask
-  // yourself two questions:
-  //
-  // 1. Are those data members Compiler-generated?
-  //    If yes, put them in the ComTdbDLL instead.
-  //    If no, they should probably belong to someplace else (like TCB).
-  //
-  // 2. Are the classes those data members belong defined in the executor
-  //    project?
-  //    If your answer to both questions is yes, you might need to move
-  //    the classes to the comexe project.
-  // ---------------------------------------------------------------------
-};
-
-///////////////////////////////////////////////////////////////
-// ExExeUtilFastDeleteTcb
-///////////////////////////////////////////////////////////////
-class ExExeUtilFastDeleteTcb : public ExExeUtilTcb
-{
- public:
-  // Constructor
-  ExExeUtilFastDeleteTcb(const ComTdbExeUtilFastDelete & exe_util_tdb,
-                         ex_globals * glob = 0);
-
-  ~ExExeUtilFastDeleteTcb();
-
-  virtual short work();
-
-  virtual ex_tcb_private_state * allocatePstates(
-                                                            Lng32 &numElems,      // inout, desired/actual elements
-                                                            Lng32 &pstateLength); // out, length of one element
-
- private:
-  enum Step
-    {
-      INITIAL_,
-
-      ADD_DDL_LOCK_,
-      MAKE_OBJECT_OFFLINE_,
-      SET_CORRUPT_BIT_,
-
-      FASTDEL_TABLE_,
-      FASTDEL_INDEX_,
-
-      RESET_CORRUPT_BIT_,
-      MAKE_OBJECT_ONLINE_,
-      DROP_DDL_LOCK_,
-
-      BEGIN_WORK_,
-      COMMIT_WORK_,
-
-      PURGEDATA_CAT_,
-
-      KILL_MXCMP_AND_ERROR_,
-      ROLLBACK_WORK_AND_ERROR_,
-      ROLLBACK_WORK_AND_NO_PD_ERROR_,
-      ERROR_,
-
-      DONE_
-    };
-
-  ExExeUtilFastDeleteTdb & fdTdb() const
-    {return (ExExeUtilFastDeleteTdb &) tdb;};
-
-  short doPurgedataCat(char * objectName);
-  short doFastDelete(char * objectName,
-                     NABoolean isIndex,
-                     NABoolean fastDelUsingResetEOF);
-  short doLabelPurgedata(char * objectName,
-                         NABoolean isIndex);
-  
-  short injectError(const char * val);
-
-  
-  short purgedataLOBs();
-  
-
-  Step step_;
-
-  NABoolean fastDelUsingResetEOF_;
-
-  NABoolean xnWasStarted_;
-
-  NABoolean parallelDeleteDone_;
-
-  char failReason_[2000];
-};
-
-class ExExeUtilFastDeletePrivateState : public ex_tcb_private_state
-{
-  friend class ExExeUtilFastDeleteTcb;
-
- public:
-  ExExeUtilFastDeletePrivateState();
-  ~ExExeUtilFastDeletePrivateState();        // destructor
- protected:
-};
-
 //////////////////////////////////////////////////////////////////////////
 // -----------------------------------------------------------------------
 // ExExeUtilGetStatisticsTdb
@@ -2491,6 +2355,13 @@
   Lng32 getUsedObjects(Queue * infoList,
                       NABoolean isShorthandView,
                       char* &viewName, Lng32 &len);
+  void setReturnRowCount( Lng32 n) { returnRowCount_ = n; }
+
+  Lng32 getReturnRowCount() {return returnRowCount_;}
+
+  void incReturnRowCount() {returnRowCount_++; }
+
+  Lng32 returnRowCount_;
 
 private:
 
@@ -2518,6 +2389,7 @@
     const char *schName,
     const char *objName);
 
+
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -3468,23 +3340,23 @@
 };
 
 ///////////////////////////////////////////////////////////////
-// ExExeUtilHiveTruncateTcb
+// ExExeUtilHiveTruncateLegacyTcb
 ///////////////////////////////////////////////////////////////
-class ExExeUtilHiveTruncateTcb : public ExExeUtilTcb
+class ExExeUtilHiveTruncateLegacyTcb : public ExExeUtilTcb
 {
  public:
   // Constructor
-  ExExeUtilHiveTruncateTcb(const ComTdbExeUtilHiveTruncate & exe_util_tdb,
+  ExExeUtilHiveTruncateLegacyTcb(const ComTdbExeUtilHiveTruncate & exe_util_tdb,
                            ex_globals * glob = 0);
 
-  ~ExExeUtilHiveTruncateTcb();
+  ~ExExeUtilHiveTruncateLegacyTcb();
 
   virtual void freeResources();
   virtual short work();
 
   virtual ex_tcb_private_state * allocatePstates(
-                                                            Lng32 &numElems,      // inout, desired/actual elements
-                                                            Lng32 &pstateLength); // out, length of one element
+       Lng32 &numElems,      // inout, desired/actual elements
+       Lng32 &pstateLength); // out, length of one element
   virtual Int32 fixup();
  private:
   enum Step
@@ -3507,6 +3379,52 @@
   ExLobGlobals * lobGlob_;
 };
 
+class ExExeUtilHiveTruncateLegacyPrivateState : public ex_tcb_private_state
+{
+  friend class ExExeUtilHiveTruncateLegacyTcb;
+
+ public:
+  ExExeUtilHiveTruncateLegacyPrivateState();
+  ~ExExeUtilHiveTruncateLegacyPrivateState();        // destructor
+ protected:
+};
+
+///////////////////////////////////////////////////////////////
+// ExExeUtilHiveTruncateTcb
+///////////////////////////////////////////////////////////////
+class ExExeUtilHiveTruncateTcb : public ExExeUtilTcb
+{
+ public:
+  // Constructor
+  ExExeUtilHiveTruncateTcb(const ComTdbExeUtilHiveTruncate & exe_util_tdb,
+                                ex_globals * glob = 0);
+
+  ~ExExeUtilHiveTruncateTcb();
+
+  virtual ex_tcb_private_state * allocatePstates(
+       Lng32 &numElems,      // inout, desired/actual elements
+       Lng32 &pstateLength); // out, length of one element
+  virtual void freeResources();
+  virtual short work();
+
+ private:
+  enum Step
+    {
+      INITIAL_,
+      ALTER_TO_MANAGED_,
+      TRUNCATE_TABLE_,
+      ALTER_TO_EXTERNAL_,
+      ALTER_TO_EXTERNAL_AND_ERROR_,
+      ERROR_,
+      DONE_
+    };
+
+  ExExeUtilHiveTruncateTdb & htTdb() const
+    {return (ExExeUtilHiveTruncateTdb &) tdb;};
+
+  Step step_;
+};
+
 class ExExeUtilHiveTruncatePrivateState : public ex_tcb_private_state
 {
   friend class ExExeUtilHiveTruncateTcb;
@@ -3517,6 +3435,9 @@
  protected:
 };
 
+//////////////////////////////////////////////////////////////
+// ExExeUtilHiveQueryTdb
+//////////////////////////////////////////////////////////////
 class ExExeUtilHiveQueryTdb : public ComTdbExeUtilHiveQuery
 {
  public:
diff --git a/core/sql/executor/ExExeUtilCli.cpp b/core/sql/executor/ExExeUtilCli.cpp
index f71a8ff..d10ef19 100644
--- a/core/sql/executor/ExExeUtilCli.cpp
+++ b/core/sql/executor/ExExeUtilCli.cpp
@@ -2081,6 +2081,16 @@
   return SQL_EXEC_Xact(SQLTRANS_STATUS, NULL);
 }
 
+Lng32 ExeCliInterface::suspendXn()
+{
+  return SQL_EXEC_Xact(SQLTRANS_SUSPEND, 0);
+}
+
+Lng32 ExeCliInterface::resumeXn()
+{
+  return SQL_EXEC_Xact(SQLTRANS_RESUME, 0);
+}
+
 Lng32 ExeCliInterface::createContext(char * contextHandle)
 {
   Lng32 rc = 0;
diff --git a/core/sql/executor/ExExeUtilCli.h b/core/sql/executor/ExExeUtilCli.h
index 859c852..62fff82 100644
--- a/core/sql/executor/ExExeUtilCli.h
+++ b/core/sql/executor/ExExeUtilCli.h
@@ -239,6 +239,8 @@
   static Lng32 commitXn();
   static Lng32 rollbackXn();
   static Lng32 statusXn();
+  static Lng32 suspendXn();
+  static Lng32 resumeXn();
 
   Lng32 createContext(char* contextHandle); // out buf will return context handle
   Lng32 switchContext(char* contextHandle); // in buf contains context handle
diff --git a/core/sql/executor/ExExeUtilCommon.cpp b/core/sql/executor/ExExeUtilCommon.cpp
index b623ee3..6566f91 100644
--- a/core/sql/executor/ExExeUtilCommon.cpp
+++ b/core/sql/executor/ExExeUtilCommon.cpp
@@ -337,7 +337,8 @@
   return  retcode;
 }
 
-char * ExExeUtilTcb::getTimeAsString(Int64 elapsedTime, char * timeBuf)
+char * ExExeUtilTcb::getTimeAsString(Int64 elapsedTime, char * timeBuf,
+                                     NABoolean noUsec)
 {
   ULng32 sec = (ULng32) (elapsedTime / 1000000);
   ULng32 usec = (ULng32) (elapsedTime % 1000000);
@@ -346,9 +347,13 @@
   ULng32 hour = min/60;
   min = min % 60;
   
-  str_sprintf (timeBuf,  "%02u:%02u:%02u.%03u",
-	       hour, min, sec, TO_FMT3u(usec));
-
+  if (noUsec)
+    str_sprintf (timeBuf,  "%02u:%02u:%02u",
+                 hour, min, sec);
+  else
+    str_sprintf (timeBuf,  "%02u:%02u:%02u.%03u",
+                 hour, min, sec, TO_FMT3u(usec));
+   
   return timeBuf;
 }
 
diff --git a/core/sql/executor/ExExeUtilGet.cpp b/core/sql/executor/ExExeUtilGet.cpp
index 163b190..e66ef01 100644
--- a/core/sql/executor/ExExeUtilGet.cpp
+++ b/core/sql/executor/ExExeUtilGet.cpp
@@ -149,6 +149,7 @@
   patternStr_ = new(glob->getDefaultHeap()) char[1000];
 
   numOutputEntries_ = 0;
+  returnRowCount_ = 0;
 }
 
 ExExeUtilGetMetadataInfoTcb::~ExExeUtilGetMetadataInfoTcb()
@@ -1820,6 +1821,7 @@
   Lng32 cliRC = 0;
   ex_expr::exp_return_type exprRetCode = ex_expr::EXPR_OK;
 
+
   // if no parent request, return
   if (qparent_.down->isEmpty())
     return WORK_OK;
@@ -1849,6 +1851,7 @@
 	    headingReturned_ = FALSE;
 
 	    numOutputEntries_ = 1;
+            returnRowCount_ = 0 ;
 
 	    objectUid_[0] = 0;
 	  }
@@ -3184,6 +3187,7 @@
             }
 
 	    infoList_->advance();
+            incReturnRowCount();
 	  }
 	break;
 
@@ -3343,6 +3347,15 @@
 
 	case DONE_:
 	  {
+            if (NOT getMItdb().noHeader() && getReturnRowCount() > 0)
+            {
+              short rc = 0;
+              char returnMsg[256];
+              memset(returnMsg, 0, 256);
+              sprintf(returnMsg, "\n=======================\n %d row(s) returned", getReturnRowCount());
+              moveRowToUpQueue(returnMsg, strlen(returnMsg), &rc);
+            }
+
 	    retcode = handleDone();
 	    if (retcode == 1)
 	      return WORK_OK;
@@ -3408,6 +3421,7 @@
 	case INITIAL_:
 	  {
 	    step_ = SETUP_QUERY_;
+            returnRowCount_ = 0 ;
 	  }
 	break;
 
@@ -3878,6 +3892,7 @@
 	      moveRowToUpQueue(" ", 0, &rc);
 
 	    infoList_->advance();
+            incReturnRowCount();
 	  }
 	break;
 
@@ -3893,6 +3908,14 @@
 
 	case DONE_:
 	  {
+            if (NOT getMItdb().noHeader() && getReturnRowCount() > 0)
+            {
+              short rc = 0;
+              char returnMsg[256];
+              memset(returnMsg, 0, 256);
+              sprintf(returnMsg, "\n=======================\n %d row(s) returned", getReturnRowCount());
+              moveRowToUpQueue(returnMsg, strlen(returnMsg), &rc);
+            }
 	    retcode = handleDone();
 	    if (retcode == 1)
 	      return WORK_OK;
@@ -4728,6 +4751,7 @@
             }
 
 	    infoList_->advance();
+            incReturnRowCount();
 	  }
 	  break;
 
@@ -7733,26 +7757,12 @@
     return rc;  
                 
   //EOD of LOB data file
-  
-  hdfsFS fs = currContext->getHdfsServerConnection((char*)getLItdb().getHdfsServer(),getLItdb().getHdfsPort());
-  if (fs == NULL)
-    return LOB_DATA_FILE_OPEN_ERROR;
-
-  
   snprintf(lobDataFilePath, LOBINFO_MAX_FILE_LEN, "%s/%s", lobLocation, lobDataFile);
-  hdfsFile fdData = hdfsOpenFile(fs, lobDataFilePath,O_RDONLY,0,0,0);
-  if (!fdData) 
-    {
-      hdfsCloseFile(fs,fdData);
-      fdData = NULL;
-      return LOB_DATA_FILE_OPEN_ERROR;
-    }
-  hdfsFileInfo *fInfo = hdfsGetPathInfo(fs, lobDataFilePath);
-  if (fInfo)
-    lobEOD = fInfo->mSize;
-  else
-    lobEOD = 0;
-  
+  HDFS_Client_RetCode hdfsClientRetcode;
+  lobEOD = HdfsClient::hdfsSize(lobDataFilePath, hdfsClientRetcode);
+  if (hdfsClientRetcode != HDFS_CLIENT_OK) 
+     return LOB_DATA_FILE_OPEN_ERROR;
+
   str_sprintf(buf, "  LOB EOD :  %ld", lobEOD);
   if (moveRowToUpQueue(buf, strlen(buf), &rc))
     return rc;
@@ -8034,24 +8044,12 @@
       str_cpy_all(lobInfo_->lobDataFile,  lobDataFile,strlen(lobDataFile));
     }             
   //EOD of LOB data file
-  // hdfsFS fs = hdfsConnect(getLItdb().getHdfsServer(),getLItdb().getHdfsPort());
-  hdfsFS fs = currContext->getHdfsServerConnection((char*)getLItdb().getHdfsServer(),getLItdb().getHdfsPort());
-  if (fs == NULL)
-    return LOB_DATA_FILE_OPEN_ERROR;
-
   snprintf(lobDataFilePath, LOBINFO_MAX_FILE_LEN, "%s/%s", lobLocation, lobDataFile);
-  hdfsFile fdData = hdfsOpenFile(fs, lobDataFilePath,O_RDONLY,0,0,0);
-  if (!fdData) 
-    {
-      hdfsCloseFile(fs,fdData);
-      fdData = NULL;
-      return LOB_DATA_FILE_OPEN_ERROR;
-    }
-  hdfsFileInfo *fInfo = hdfsGetPathInfo(fs, lobDataFilePath);
-  if (fInfo)
-    lobEOD = fInfo->mSize;
-  else
-    lobEOD = 0;
+  HDFS_Client_RetCode hdfsClientRetcode;
+  lobEOD = HdfsClient::hdfsSize(lobDataFilePath, hdfsClientRetcode);
+  if (hdfsClientRetcode != HDFS_CLIENT_OK) 
+     return LOB_DATA_FILE_OPEN_ERROR;
+
   lobInfo_->lobDataFileSizeEod=lobEOD;
   // Sum of all the lobDescChunks for used space
 
diff --git a/core/sql/executor/ExExeUtilGetStats.cpp b/core/sql/executor/ExExeUtilGetStats.cpp
index 1f32971..a8a128d 100644
--- a/core/sql/executor/ExExeUtilGetStats.cpp
+++ b/core/sql/executor/ExExeUtilGetStats.cpp
@@ -3654,7 +3654,7 @@
       {
         if (rmsStatsItems_ == NULL)
         {
-          maxRMSStatsItems_ = 33;
+          maxRMSStatsItems_ = 34;
           rmsStatsItems_ = new (getGlobals()->getDefaultHeap()) 
                   SQLSTATS_ITEM[maxRMSStatsItems_];
           initSqlStatsItems(rmsStatsItems_, maxRMSStatsItems_, FALSE);
@@ -3691,7 +3691,8 @@
           rmsStatsItems_[30].statsItem_id = SQLSTATS_SSCP_REPLY_MSG_BYTES;
           rmsStatsItems_[31].statsItem_id = SQLSTATS_RMS_STATS_RESET_TIMESTAMP;
           rmsStatsItems_[32].statsItem_id = SQLSTATS_RMS_STATS_NUM_SQL_SIK;
-          // maxRMSStatsItems_ is set to 33
+          rmsStatsItems_[33].statsItem_id = SQLSTATS_RMS_CONFIGURED_PID_MAX;
+          // maxRMSStatsItems_ is set to 34
           rmsStatsItems_[0].str_value = new (getGlobals()->getDefaultHeap())
             char[MAX_SEGMENT_NAME_LEN+1];
           rmsStatsItems_[0].str_max_len = MAX_SEGMENT_NAME_LEN;
@@ -3880,7 +3881,10 @@
 			timestamp[3], timestamp[4], timestamp[5],
 			timestamp[6], timestamp[7]);
 	    break;
-
+          case SQLSTATS_RMS_CONFIGURED_PID_MAX:
+            sprintf(Int64Val, "%ld", rmsStatsItems_[i].int64_value);
+            sprintf(statsBuf_, "%-30s%s", "Configured Pid Max", Int64Val);
+            break;
           }
           if (strlen(statsBuf_) > 0)
             if (moveRowToUpQueue(statsBuf_, strlen(statsBuf_), &rc) == -1)
diff --git a/core/sql/executor/ExExeUtilLoad.cpp b/core/sql/executor/ExExeUtilLoad.cpp
index 160a6bb..960c31f 100644
--- a/core/sql/executor/ExExeUtilLoad.cpp
+++ b/core/sql/executor/ExExeUtilLoad.cpp
@@ -68,6 +68,7 @@
 #include "ExpHbaseInterface.h"
 #include "ExHbaseAccess.h"
 #include "ExpErrorEnums.h"
+#include "ExpLOBaccess.h"
 #include "HdfsClient_JNI.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -166,15 +167,16 @@
 		 ctaTdb().ctQuery_);
 	    if (cliRC < 0)
 	      {
-		if (((cliRC == -1055) || // SQ table err msg
-		     (cliRC == -1390)) && // Traf err msg
+		if (((cliRC == -1055) ||  // SQ table err msg
+		     (cliRC == -1390) ||  // Traf err msg
+		     (cliRC == -1387)) && // Hive err msg
 		    (ctaTdb().loadIfExists()))
 		  {
 		    SQL_EXEC_ClearDiagnostics(NULL);
 		    tableExists_ = TRUE;
 
 		    if (ctaTdb().deleteData())
-		      step_ = DELETE_DATA_;
+		      step_ = TRUNCATE_TABLE_;
 		    else
 		      step_ = ALTER_TO_NOAUDIT_;
 		    break;
@@ -200,14 +202,14 @@
 	  }
 	break;
 
-	case DELETE_DATA_:
-	case DELETE_DATA_AND_ERROR_:
+	case TRUNCATE_TABLE_:
+	case TRUNCATE_TABLE_AND_ERROR_:
 	  {
 	    char * ddQuery = 
-	      new(getMyHeap()) char[strlen("DELETE DATA FROM; ") + 
+	      new(getMyHeap()) char[strlen("TRUNCATE TABLE; ") + 
 				   strlen(ctaTdb().getTableName()) +
 				   100];
-	    strcpy(ddQuery, "DELETE DATA FROM ");
+	    strcpy(ddQuery, "TRUNCATE TABLE ");
 	    strcat(ddQuery, ctaTdb().getTableName());
 	    strcat(ddQuery, ";");
 	    cliRC = cliInterface()->executeImmediate(ddQuery, NULL,NULL,TRUE,NULL,TRUE);
@@ -217,7 +219,7 @@
 
 	    if (cliRC < 0)
 	      {
-		if (step_ == DELETE_DATA_)
+		if (step_ == TRUNCATE_TABLE_)
 		  {
 		    step_ = ERROR_;
 		    break;
@@ -230,7 +232,7 @@
 		break;
 	      }
 
-	    if (step_ == DELETE_DATA_AND_ERROR_)
+	    if (step_ == TRUNCATE_TABLE_AND_ERROR_)
 	      {
 
 		if (doSidetreeInsert_)
@@ -492,7 +494,7 @@
 	      {
 		// error case and 'load if exists' specified.
 		// Do not drop the table, only delete data from it.
-		step_ = DELETE_DATA_AND_ERROR_;
+		step_ = TRUNCATE_TABLE_AND_ERROR_;
 	      }
 	    else
 	      step_ = DROP_AND_ERROR_;
@@ -2544,14 +2546,7 @@
 
   requestTag_ = -1;
   lobLoc_[0] = '\0';
-  exLobGlobals_ = NULL;
- 
-  ExpLOBinterfaceInit(exLobGlobals_,currContext->exHeap(),currContext,TRUE,
-                      lobTdb().getLobHdfsServer(),
-                      lobTdb().getLobHdfsPort());
-                                     
-    
-
+  exLobGlobals_ = ExpLOBoper::initLOBglobal((NAHeap *)glob->getDefaultHeap(), currContext, exe_util_tdb.useLibHdfs());
 }
 
 void ExExeUtilLobExtractTcb::freeResources()
@@ -2586,8 +2581,7 @@
 	       lobDataLen_, lobData_, 
 	       3, // close
                0); // open type not applicable
-
-  ExpLOBinterfaceCleanup(exLobGlobals_);
+  ExpLOBoper::deleteLOBglobal(exLobGlobals_, (NAHeap *)(NAHeap *)getGlobals()->getDefaultHeap());
   exLobGlobals_ = NULL;
 }
 
@@ -3052,7 +3046,7 @@
 		    ExRaiseSqlError(getHeap(), &diagsArea_, 
 				    (ExeErrorCode)(8442), NULL, &intParam1, 
 				    &cliError, NULL, (char*)"ExpLOBInterfaceSelect",
-				    getLobErrStr(intParam1));
+		                    getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		    step_ = HANDLE_ERROR_;
 		    break;
 		  }
@@ -3098,7 +3092,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor",
-				getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -3151,7 +3145,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor",
-				getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -3219,7 +3213,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor",
-				getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      } 
@@ -3326,9 +3320,7 @@
   lobHandle_[0] = '\0';
   exLobGlobals_=NULL;
   memset(lobLockId_,'\0',LOB_LOCK_ID_SIZE);
-  ExpLOBinterfaceInit(exLobGlobals_,currContext->exHeap(),currContext,TRUE,
-                      lobTdb().getLobHdfsServer(),
-                      lobTdb().getLobHdfsPort());
+  exLobGlobals_ = ExpLOBoper::initLOBglobal((NAHeap *)glob->getDefaultHeap(), currContext, exe_util_lobupdate_tdb.useLibHdfs());
                                      
 }
 ExExeUtilLobUpdateTcb::~ExExeUtilLobUpdateTcb()
@@ -3338,10 +3330,7 @@
 
 void ExExeUtilLobUpdateTcb::freeResources()
 {
- ContextCli *currContext =
-    getGlobals()->castToExExeStmtGlobals()->castToExMasterStmtGlobals()->
-    getStatement()->getContext();
- ExpLOBinterfaceCleanup(exLobGlobals_);
+ ExpLOBoper::deleteLOBglobal(exLobGlobals_, (NAHeap *)getGlobals()->getDefaultHeap());
  exLobGlobals_ = NULL;
 }
 
@@ -3507,7 +3496,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceUpdate",
-				getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      }  
@@ -3590,7 +3579,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceUpdate",
-			 	getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      }  
@@ -3675,7 +3664,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceUpdate",
-				getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      }  
@@ -3848,7 +3837,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor/open",
-				getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -3894,7 +3883,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor/read",
-				getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -3949,7 +3938,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceSelectCursor/close",
-				getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -4084,7 +4073,7 @@
 		    ExRaiseSqlError(getHeap(), &diagsArea_, 
 				    (ExeErrorCode)(8442), NULL, &intParam1, 
 				    &cliError, NULL, (char*)"ExpLOBInterfaceCreate",
-				    getLobErrStr(intParam1));
+		                    getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		    step_ = HANDLE_ERROR_;
 		    break;
 		  }
@@ -4199,7 +4188,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceInsert",
-				getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
@@ -4229,7 +4218,7 @@
 		ExRaiseSqlError(getHeap(), &diagsArea_, 
 				(ExeErrorCode)(8442), NULL, &intParam1, 
 				&cliError, NULL, (char*)"ExpLOBInterfaceCloseFile",
-				getLobErrStr(intParam1));
+		                getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 		step_ = HANDLE_ERROR_;
 		break;
 	      }
diff --git a/core/sql/executor/ExExeUtilMisc.cpp b/core/sql/executor/ExExeUtilMisc.cpp
index dd4cd35..fd1477c 100644
--- a/core/sql/executor/ExExeUtilMisc.cpp
+++ b/core/sql/executor/ExExeUtilMisc.cpp
@@ -58,950 +58,9 @@
 //////////////////////////////////////////////////////////
 // classes defined in this file:
 //
-// class ExExeUtilFastDelete
-//
 //////////////////////////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////
-ex_tcb * ExExeUtilFastDeleteTdb::build(ex_globals * glob)
-{
-  ExExeUtilTcb * exe_util_tcb;
-
-  exe_util_tcb = new(glob->getSpace()) ExExeUtilFastDeleteTcb(*this, glob);
-  exe_util_tcb->registerSubtasks();
-
-  return (exe_util_tcb);
-}
-
-////////////////////////////////////////////////////////////////
-// Constructor for class ExExeUtilFastDeleteTcb
-///////////////////////////////////////////////////////////////
-ExExeUtilFastDeleteTcb::ExExeUtilFastDeleteTcb(
-     const ComTdbExeUtilFastDelete & exe_util_tdb,
-     ex_globals * glob)
-     : ExExeUtilTcb( exe_util_tdb, NULL, glob),
-       fastDelUsingResetEOF_(FALSE),
-       xnWasStarted_(FALSE)
-{
-  // Allocate the private state in each entry of the down queue
-  qparent_.down->allocatePstate(this);
-
-  step_ = INITIAL_;
-}
-
-ExExeUtilFastDeleteTcb::~ExExeUtilFastDeleteTcb()
-{
-}
-
-short ExExeUtilFastDeleteTcb::doPurgedataCat(char * stmt)
-{
-  Lng32 cliRC = 0;
-
-  ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
-
-  cliRC = holdAndSetCQD("EXE_PARALLEL_PURGEDATA", "OFF");
-  if (cliRC < 0)
-    {
-      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-      return -1;
-    }
-
-  cliRC = cliInterface()->executeImmediate(stmt);
-  //  NADELETEBASIC(stmt, getHeap());
-
-  if (cliRC < 0)
-    {
-      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-      restoreCQD("EXE_PARALLEL_PURGEDATA");
-      return -1;
-    }
-  
-  restoreCQD("EXE_PARALLEL_PURGEDATA");
-
-  return 0;
-}
-
-short ExExeUtilFastDeleteTcb::doLabelPurgedata(char * objectName,
-					       NABoolean isIndex)
-{
-  Lng32 cliRC;
-  short retcode = 0;
-
-  // Get the globals stucture of the master executor.
-  ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
-  ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
-
-  ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
-
-  SQL_EXEC_ClearDiagnostics(NULL);
-
-  char * stmt = NULL;
-
-  // set sqlparserflags to allow special label_purgedata syntax
-  masterGlob->getStatement()->getContext()->setSqlParserFlags(0x1); // ALLOW_SPECIALTABLETYPE
-
-  stmt = new(getHeap()) char[4000];
-
-  if (isIndex)
-    str_sprintf(stmt, "label_purgedata index_table %s parallel execution on",
-		objectName);
-  else
-    str_sprintf(stmt, "label_purgedata table %s parallel execution on",
-		objectName);
-    
-  cliRC = cliInterface()->executeImmediate(stmt);
-  NADELETEBASIC(stmt, getHeap());
-
-  masterGlob->getStatement()->getContext()->resetSqlParserFlags(0x1);
-
-  if (cliRC < 0)
-    {
-      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-      retcode = -1;
-      goto cleanUpAndReturn;
-    }
-  
-cleanUpAndReturn:
-
-  if (retcode == 0)
-    {
-      if (NOT isIndex)
-	// Inject error to cause fastdelete of table to fail.
-	retcode = injectError("13");
-      else
-	// Inject error to cause fastdelete of index to fail.
-	retcode = injectError("14");
-    }
-
-  if (retcode < 0)
-    {
-      strcpy(failReason_, "Error during fast delete using reset EOF operation.");
-    }
-
-  return retcode;
-}
-
-short ExExeUtilFastDeleteTcb::doFastDelete(char * objectName,
-					   NABoolean isIndex,
-					   NABoolean fastDelUsingResetEOF)
-{
-  Lng32 cliRC;
-  short retcode = 0;
-  char * stmt = NULL;
-  Lng32 pneBufLen = 0;
-
-  // Get the globals stucture of the master executor.
-  ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
-  ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
-
-  ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
-
-  SQL_EXEC_ClearDiagnostics(NULL);
-
-  // turn ON parallelism to force execution using ESPs.
-  // But first, hold and save the current value for attempt_esp_parallelism.
-  retcode = holdAndSetCQD("ATTEMPT_ESP_PARALLELISM", "ON");
-  if (retcode < 0)
-    {
-      goto cleanUpAndReturn_restore_CQS;
-    }
-
-
-  // Issue a control query shape to use ESPs.
-  // 'Hold' any previously issued CQS.
-  cliRC = 
-    cliInterface()->
-    executeImmediate("control query shape hold;");
-  if (cliRC < 0)
-    {
-      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-      retcode = -1;
-      goto cleanUpAndReturn;
-    }
-
-  cliRC = 
-    cliInterface()->executeImmediate("control query shape esp_exchange(cut);");
-  if (cliRC < 0)
-    {
-      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-      retcode = -1;
-      goto cleanUpAndReturn;
-    }
-  
-  if (fdTdb().isMV())
-    {
-      cliRC = 
-	cliInterface()->
-	executeImmediate("control query default mv_internal_ignore_uninitialized 'ON';");
-      if (cliRC < 0)
-	{
-          cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-	  retcode = -1;
-	  goto cleanUpAndReturn;
-	}
-    }
-
-  stmt = new(getHeap()) char[strlen("delete ")
-			    + (fastDelUsingResetEOF ? strlen("using purgedata ")
-			       : strlen("no purgedata "))
-			    + strlen("from table ( ") 
-			    + (isIndex ? strlen("index_table ") 
-			       : strlen("table "))
-			    + strlen(objectName) + 
-			    + strlen (" ) ") 
-			    + 200];
-  strcpy(stmt, "delete ");
-  if (fastDelUsingResetEOF)
-    strcat(stmt, "using purgedata ");
-  else
-    strcat(stmt, "no purgedata ");
-  strcat(stmt, "from table ( ");
-  if (isIndex)
-    strcat(stmt, "index_table ");
-  else
-    strcat(stmt, "table ");
-  
-  strcat(stmt, objectName);
-  strcat(stmt, " ) ;");
-
-  // set sqlparserflags to allow special INDEX_TABLE name
-  if (isIndex)
-    masterGlob->getStatement()->getContext()->setSqlParserFlags(0x1); // ALLOW_SPECIALTABLETYPE
-  
-  cliRC = cliInterface()->executeImmediate(stmt,NULL,NULL,TRUE,NULL,TRUE);
-
-  if (isIndex)
-   masterGlob->getStatement()->getContext()->resetSqlParserFlags(0x1); // ALLOW_SPECIALTABLETYPE
-
-  if (cliRC < 0)
-    {
-      cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-      retcode = -1;
-      goto cleanUpAndReturn;
-    }
-  
-cleanUpAndReturn:
-
-  // restore original value for attempt_esp_parallelism
-  cliRC = restoreCQD("attempt_esp_parallelism");
-
-
-cleanUpAndReturn_restore_CQS:
-
-  // restore original CQS
-  cliRC = 
-    cliInterface()->
-    executeImmediate("control query shape restore;");
-
-  if (fdTdb().isMV())
-    {
-      cliRC = 
-	cliInterface()->
-	executeImmediate("control query default mv_internal_ignore_uninitialized 'OFF';");
-    }
-
-  if (retcode == 0)
-    {
-      if (NOT isIndex)
-	// Inject error to cause fastdelete of table to fail.
-	retcode = injectError("13");
-      else
-	// Inject error to cause fastdelete of index to fail.
-	retcode = injectError("14");
-    }
-
-  if (retcode < 0)
-    {
-      if (fastDelUsingResetEOF)
-	strcpy(failReason_, "Error during fast delete using reset EOF operation.");
-      else
-	strcpy(failReason_, "Error during fast delete operation.");
-    }
-
-  return retcode;
-}
-
-short ExExeUtilFastDeleteTcb::injectError(const char * val)
-{
-  // Get the globals stucture of the master executor.
-  ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
-  ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
-
-  char * e1 = masterGlob->getCliGlobals()->getEnv("SQLMX_TEST_POINT");
-  char * e2 = masterGlob->getCliGlobals()->getEnv("SQLMX_PPD_ERR_TEST_POINT");
-  if (((e1) && (strcmp(e1, val) == 0)) ||
-      ((e2) && (strcmp(e2, val) == 0)))
-    {
-      Lng32 errNumParam = ((Lng32)str_atoi(val, strlen(val)));
-      ExRaiseSqlError(getHeap(), &diagsArea_, -EXE_ERROR_INJECTED,
-          &errNumParam, NULL, NULL,   
-	  (e1 ? "SQLMX_TEST_POINT" : "SQLMX_PPD_ERR_TEST_POINT"));
-      return -EXE_ERROR_INJECTED;
-    }
-  return 0;
-}
-
-
-short ExExeUtilFastDeleteTcb::purgedataLOBs()
-{
-  // purgedata from lobs for this table
-  if (fdTdb().numLOBs() > 0)
-    {
-      for (Lng32 i = 1; i <= fdTdb().numLOBs(); i++)
-	{
-	  Lng32 rc = ExpLOBoper::purgedataLOB
-	    (NULL, NULL, fdTdb().getObjectUID(), fdTdb().getLOBnum(i));
-	}
-    }
-
-  return 0;
-}
-
-
-//////////////////////////////////////////////////////
-// work() for ExExePurgedataUtilTcb
-//////////////////////////////////////////////////////
-short ExExeUtilFastDeleteTcb::work()
-{
-  short rc = 0;
-  Lng32 cliRC = 0;
-
-  // if no parent request, return
-  if (qparent_.down->isEmpty())
-    return WORK_OK;
-  
-  // if no room in up queue, won't be able to return data/status.
-  // Come back later.
-  if (qparent_.up->isFull())
-    return WORK_OK;
-  
-  ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
-  ExExeUtilPrivateState & pstate =
-    *((ExExeUtilPrivateState*) pentry_down->pstate);
-
-  // Get the globals stucture of the master executor.
-  ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
-  ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
-  ExTransaction *ta = masterGlob->getStatement()->getContext()->getTransaction();
-
-  char buf[4000];
-
-  while (1)
-    {
-      switch (step_)
-	{
-	case INITIAL_:
-	  {
-	    fastDelUsingResetEOF_ = FALSE;
-	    xnWasStarted_ = FALSE;
-	    parallelDeleteDone_ = FALSE;
-	    strcpy(failReason_, " ");
-
-	    if (fdTdb().doPurgedataCat())
-	      step_ = PURGEDATA_CAT_;
-	    else if (fdTdb().doParallelDelete())
-	      {
-		if (NOT ta->xnInProgress())
-		  {
-		    cliRC = cliInterface()->beginWork();
-		    if (cliRC < 0)
-		      {
-                        cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-			step_ = ERROR_;
-			break;
-		      }
-		    
-		    xnWasStarted_ = TRUE;
-		  }
-
-		step_ = FASTDEL_TABLE_;
-
-		parallelDeleteDone_ = TRUE;
-	      }
-	    else if (NOT ta->xnInProgress())
-	      {
-		fastDelUsingResetEOF_ = TRUE;
-		step_ = ADD_DDL_LOCK_;
-	      }
-	    else
-	      {
-		// User transaction is in progress.
-		// We need to do fast delete without purgedata mode unless
-		// it has been turned off.
-		if (fdTdb().doParallelDeleteIfXn())
-		  {
-		    parallelDeleteDone_ = TRUE;
-		    step_ = FASTDEL_TABLE_;
-		  }
-		else
-		  step_ = PURGEDATA_CAT_;
-	      }
-
-	    if (step_ != PURGEDATA_CAT_)
-	      {
-		if (cliRC < 0)
-		  {
-                    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		    step_ = ERROR_;
-		    break;
-		  }
-	      }
-	  }
-	break;
-
-	case ADD_DDL_LOCK_:
-	  {
-	    cliRC = cliInterface()->beginWork();
-	    if (cliRC < 0)
-	      {
-                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		step_ = ERROR_;
-		break;
-	      }
-
-	    xnWasStarted_ = TRUE;
-
-	    // first drop this ddl lock, if it exists. Ignore errors.
-	    rc = alterDDLLock(FALSE, fdTdb().getTableName(), failReason_,
-			      fdTdb().isMV(), COM_UTIL_PURGEDATA);
-	    if (rc < 0)
-	      {
-		SQL_EXEC_ClearDiagnostics(NULL);
-		
-		strcpy(failReason_, " ");
-
-		rc = 0;
-
-		// if this table was offline, and there was no ddl lock,
-		// let catman purgedata handle it.
-		// In this case, don't want to change the table back to
-		// online which is what will happen if exe purgedata is
-		// used.
-
-		if (fdTdb().offlineTable())
-		  {
-		    // Abort transaction which was started.
-		    // Ignore errors, and clear diags area.
-		    if ((xnWasStarted_) &&
-			(ta->xnInProgress()))
-		      {
-			cliRC = cliInterface()->rollbackWork();
-			
-			SQL_EXEC_ClearDiagnostics(NULL);
-			
-			xnWasStarted_ = FALSE;
-		      }
-		    
-		    step_ = PURGEDATA_CAT_;
-		    break;
-		  }
-	      }
-
-	    // now add a ddl lock.
-	    rc = alterDDLLock(TRUE, fdTdb().getTableName(), failReason_,
-			      fdTdb().isMV(), COM_UTIL_PURGEDATA);
-	    if (rc == 0)
-	      rc = injectError("10");
-	    if (rc < 0)
-	      {
-                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		// could not acquire a ddl lock.
-		// try to purgedata using catman sequential purgedata.
-
-		// Abort transaction which was started.
-		// Ignore errors, and clear diags area.
-		if ((xnWasStarted_) &&
-		    (ta->xnInProgress()))
-		  {
-		    cliRC = cliInterface()->rollbackWork();
-		    
-		    SQL_EXEC_ClearDiagnostics(NULL);
-		    
-		    xnWasStarted_ = FALSE;
-		  }
-
-		// see if catman seq purgedata can fix this.
-		step_ = PURGEDATA_CAT_;
-		break;
-	      }
-
-	    step_ = MAKE_OBJECT_OFFLINE_;
-	  }
-	break;
-
-	case MAKE_OBJECT_OFFLINE_:
-	  {
-	    // make object offline
-	    rc = alterObjectState(FALSE, fdTdb().getTableName(), 
-				  failReason_, TRUE);
-	    NABoolean rollbackNoPDErr = FALSE;
-	    if (rc == 0)
-	      {
-		rc = injectError("11");
-		if (rc == 0)
-		  {
-		    rc = injectError("18");
-		    if (rc < 0)
-		      rollbackNoPDErr = TRUE;
-		  }
-	      }
-	    if (rc < 0)
-	      {
-                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		// security validation failed
-		if ((getDiagsArea()->contains(-1017)) ||
-		    (rollbackNoPDErr))
-		  step_ = ROLLBACK_WORK_AND_NO_PD_ERROR_;
-		else
-		  step_ = ROLLBACK_WORK_AND_ERROR_;
-		break;
-	      }
-
-	    step_ = SET_CORRUPT_BIT_;
-	  }
-	break;
-
-	case SET_CORRUPT_BIT_:
-	  {
-	    // set the corrupt bit in the label of table and all indices
-	    rc = alterCorruptBit(1, fdTdb().getTableName(), failReason_,
-				 fdTdb().getIndexList());
-	    if (rc == 0)
-	      rc = injectError("12");
-	    if (rc < 0)
-	      {
-                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		step_ = ROLLBACK_WORK_AND_ERROR_;
-		break;
-	      }
-
-	    if ((xnWasStarted_) &&
-		(ta->xnInProgress()))
-	      {
-		cliRC = cliInterface()->commitWork();
-		
-		xnWasStarted_ = FALSE;
-		
-		if (cliRC < 0)
-		  {
-		    strcpy(failReason_, "Error during commit work.");
-
-                    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		    step_ = ROLLBACK_WORK_AND_ERROR_;
-		    break;
-		  }
-	      }
-
-	    // inject error to test RECOVER.
-	    // DDL lock has been acquired and object has been made offline
-	    // but operation has not yet begun.
-	    if (injectError("1") || injectError("2"))
-	      {
-		// kill mxcmp
-		strcpy(buf, "SELECT TESTEXIT;");
-		cliRC = cliInterface()->executeImmediate(buf);
-		if (cliRC < 0)
-                  cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		  
-		strcpy(failReason_, " ");
-
-		step_ = ROLLBACK_WORK_AND_ERROR_;
-		break;
-	      }
-
-	    // now start parallel purgedata
-	    step_ = BEGIN_WORK_;
-	  }
-	break;
-
-	case BEGIN_WORK_:
-	  {
-	    cliRC = cliInterface()->beginWork();
-	    if (cliRC < 0)
-	      {
-                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		step_ = ERROR_;
-		break;
-	      }
-
-	    xnWasStarted_ = TRUE;
-	    step_ = FASTDEL_TABLE_;
-	  }
-	break;
-
-	case FASTDEL_TABLE_:
-	  {
-	    if ((fdTdb().doLabelPurgedata()) &&
-		(fastDelUsingResetEOF_))
-	      rc = doLabelPurgedata(fdTdb().getTableName(), 
-				    FALSE);
-	    else
-	      rc = doFastDelete(fdTdb().getTableName(), 
-				FALSE, fastDelUsingResetEOF_);
-
-	    if (rc)
-	      {
-		if (fastDelUsingResetEOF_)
-		  step_ = KILL_MXCMP_AND_ERROR_;
-		else
-		  step_ = ROLLBACK_WORK_AND_ERROR_;
-		break;
-	      }
-	    
-	    if (fdTdb().getIndexList())
-	      {
-		fdTdb().getIndexList()->position();
-		step_ = FASTDEL_INDEX_;
-	      }
-	    else 
-	      step_ = COMMIT_WORK_;
-	  }
-	break;
-
-	case FASTDEL_INDEX_:
-	  {
-	    if (fdTdb().getIndexList()->atEnd())
-	      {
-		step_ = COMMIT_WORK_;
-		break;
-	      }
-
-	    char * indexName = (char*)fdTdb().getIndexList()->getNext();
-	    if ((fdTdb().doLabelPurgedata()) &&
-		(fastDelUsingResetEOF_))
-	      rc = doLabelPurgedata(indexName, 
-				    TRUE);
-	    else
-	      rc = doFastDelete(indexName, TRUE,
-				fastDelUsingResetEOF_);
-	    if (rc)
-	      {
-		if (fastDelUsingResetEOF_)
-		  step_ = KILL_MXCMP_AND_ERROR_;
-		else
-		  step_ = ROLLBACK_WORK_AND_ERROR_;
-		break;
-	      }
-	  }
-	break;
-
-	case KILL_MXCMP_AND_ERROR_:
-	  {
-	    // Abort transaction which was started.
-	    // Ignore errors, and clear diags area.
-	    if ((xnWasStarted_) &&
-		(ta->xnInProgress()))
-	      {
-		cliRC = cliInterface()->rollbackWork();
-		
-		SQL_EXEC_ClearDiagnostics(NULL);
-
-		xnWasStarted_ = FALSE;
-	      }
-
-	    // kill mxcmp so a subsequent recover operation
-	    // can succeed. Ignore errors.
-	    strcpy(buf, "SELECT TESTEXIT;");
-	    cliRC = cliInterface()->executeImmediate(buf);
-	    SQL_EXEC_ClearDiagnostics(NULL);
-
-	    step_ = ROLLBACK_WORK_AND_ERROR_;
-	  }
-	break;
-
-	case ROLLBACK_WORK_AND_ERROR_:
-	case ROLLBACK_WORK_AND_NO_PD_ERROR_:
-	  {
-	    // We come here only if fastDeleteUsingResetEOF failed.
-	    // Abort transaction which was started.
-	    // Ignore errors, and clear diags area.
-	    if ((xnWasStarted_) &&
-		(ta->xnInProgress()))
-	      {
-		cliRC = cliInterface()->rollbackWork();
-		
-		SQL_EXEC_ClearDiagnostics(NULL);
-
-		xnWasStarted_ = FALSE;
-	      }
-
-	    if (step_ == ROLLBACK_WORK_AND_ERROR_)
-	      {
-		ComDiagsArea * diagsArea = getDiagsArea();
-		// convert all errors into warnings
-		NegateAllErrors(diagsArea);
-                ExRaiseSqlError(getHeap(), &diagsArea_, -EXE_PARALLEL_PURGEDATA_FAILED,
-                    NULL, NULL, NULL,
-		    failReason_);
-	      }
-
-	    step_ = ERROR_;
-	  }
-	break;
-
-	case COMMIT_WORK_:
-	  {
-	    if ((xnWasStarted_) &&
-		(ta->xnInProgress()))
-	      {
-		cliRC = cliInterface()->commitWork();
-
-		xnWasStarted_ = FALSE;
-	      }
-
-	    if (injectError("3"))
-	      {
-		// kill mxcmp
-		strcpy(buf, "SELECT TESTEXIT;");
-		cliInterface()->executeImmediate(buf);
-		if (cliRC < 0)
-                  cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		
-		step_ = ERROR_;
-		break;
-	      }
-
-	    if (parallelDeleteDone_) //fdTdb().doParallelDelete())
-	      {
-		// raise a warning that parallel purgedata was performed.
-		if (fdTdb().returnPurgedataWarn())
-		  {
-                    ExRaiseSqlError(getHeap(), &diagsArea_, EXE_PURGEDATA_CAT,
-                        NULL, NULL, NULL,
-			"Parallel", "");
-		  }
-		step_ = DONE_;
-	      }
-	    else
-	      step_ = RESET_CORRUPT_BIT_;
-	  }
-	break;
-
-	case RESET_CORRUPT_BIT_:
-	  {
-	    cliRC = cliInterface()->beginWork();
-	    if (cliRC < 0)
-	      {
-                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		step_ = ERROR_;
-		break;
-	      }
-
-	    xnWasStarted_ = TRUE;
-
-	    // reset the corrupt bit in the label of table and all indices.
-	    rc = alterCorruptBit(0, fdTdb().getTableName(), failReason_,
-				 fdTdb().getIndexList());
-	    if (rc == 0)
-	      rc = injectError("15");
-
-	    if (rc < 0)
-	      {
-                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		step_ = KILL_MXCMP_AND_ERROR_;
-		break;
-	      }
-
-	    step_ = MAKE_OBJECT_ONLINE_;
-	  }
-	break;
-
-	case MAKE_OBJECT_ONLINE_:
-	  {
-	    rc = alterObjectState(TRUE, fdTdb().getTableName(), 
-				  failReason_, TRUE);
-	    if (rc == 0)
-	      rc = injectError("16");
-	    if (rc < 0)
-	      {
-                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		step_ = KILL_MXCMP_AND_ERROR_;
-		break;
-	      }
-	    
-	    step_ = DROP_DDL_LOCK_;
-	  }
-	break;
-
-	case DROP_DDL_LOCK_:
-	  {
-	    if (fastDelUsingResetEOF_)
-	      {
-		rc = alterDDLLock(FALSE, fdTdb().getTableName(), failReason_,
-				  fdTdb().isMV(), COM_UTIL_PURGEDATA);
-		if (rc == 0)
-		  rc = injectError("17");
-		if (rc < 0)
-		  {
-                    cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		    step_ = KILL_MXCMP_AND_ERROR_;
-		    break;
-		  }
-	      }
-
-	    cliRC = cliInterface()->commitWork();
-	    if (cliRC < 0)
-	      {
-                cliInterface()->allocAndRetrieveSQLDiagnostics(diagsArea_);
-		step_ = ERROR_;
-		break;
-	      }
-	    
-	    step_ = DONE_;
-
-	    // raise a warning that parallel purgedata was performed.
-	    if (fdTdb().returnPurgedataWarn())
-	      {
-                ExRaiseSqlError(getHeap(), &diagsArea_, EXE_PURGEDATA_CAT,
-                    NULL, NULL, NULL,
-		    "Parallel", "");
-	      }
-	  }
-	break;
-
-	case PURGEDATA_CAT_:
-	  {
-	    if ((getDiagsArea()) &&
-		(getDiagsArea()->getNumber(DgSqlCode::ERROR_) > 0))
-	      {
-		// convert all errors into warnings
-		NegateAllErrors(getDiagsArea());
-	      }
-
-	    // raise a warning that regular purgedata is being performed,
-	    // either because the query/object didn't meet the criteria
-	    // for parallel purgedata, or because parallel purgedata failed.
-	    if (fdTdb().returnPurgedataWarn())
-	      {
-		if (fdTdb().doPurgedataCat())
-                  ExRaiseSqlError(getHeap(), &diagsArea_, EXE_PURGEDATA_CAT,
-                     NULL, NULL, NULL,
-                     "Regular", "Reason: Query or the object did not meet the criteria for parallel purgedata.");
-		else
-                  ExRaiseSqlError(getHeap(), &diagsArea_, EXE_PURGEDATA_CAT,
-                     NULL, NULL, NULL,
-                     "Regular", "Reason: Parallel purgedata failed.");
-	      }
-
-	    rc = doPurgedataCat(fdTdb().purgedataStmt());
-	    if (rc)
-	      step_ = ERROR_;
-	    else
-	      step_ = DONE_;
-	  }
-	break;
-
-	case ERROR_:
-	  {
-	    if (qparent_.up->isFull())
-	      return WORK_OK;
-
-	    // Return EOF.
-	    ex_queue_entry * up_entry = qparent_.up->getTailEntry();
-	    
-	    up_entry->upState.parentIndex = 
-	      pentry_down->downState.parentIndex;
-	    
-	    up_entry->upState.setMatchNo(0);
-	    up_entry->upState.status = ex_queue::Q_SQLERROR;
-
-	    ComDiagsArea *diagsArea = up_entry->getDiagsArea();
-	    
-	    if (diagsArea == NULL)
-	      diagsArea = 
-		ComDiagsArea::allocate(this->getGlobals()->getDefaultHeap());
-            else
-              diagsArea->incrRefCount (); // setDiagsArea call below will decr ref count
-
-	    if (getDiagsArea())
-	      diagsArea->mergeAfter(*getDiagsArea());
-	    
-	    up_entry->setDiagsArea (diagsArea);
-
-	    getDiagsArea()->clear();
-
-	    // insert into parent
-	    qparent_.up->insert();
-	    
-	    step_ = DONE_;
-	  }
-	break;
-
-	case DONE_:
-	  {
-	    if (qparent_.up->isFull())
-	      return WORK_OK;
-
-
-	    // restore cqd and ignore errors
-	    SQL_EXEC_ClearDiagnostics(NULL);
-	    
-	    // Return EOF.
-	    ex_queue_entry * up_entry = qparent_.up->getTailEntry();
-	    
-	    up_entry->upState.parentIndex = 
-	      pentry_down->downState.parentIndex;
-	    
-	    up_entry->upState.setMatchNo(0);
-	    up_entry->upState.status = ex_queue::Q_NO_DATA;
-
-	    if (getDiagsArea()->getNumber(DgSqlCode::WARNING_) > 0) // must be a warning
-	      {
-		ComDiagsArea *diagsArea = up_entry->getDiagsArea();
-		
-		if (diagsArea == NULL)
-		  diagsArea = 
-		    ComDiagsArea::allocate(this->getGlobals()->getDefaultHeap());
-                else
-                  diagsArea->incrRefCount (); // setDiagsArea call below will decr ref count
-		
-		if (getDiagsArea())
-		  diagsArea->mergeAfter(*getDiagsArea());
-		
-		up_entry->setDiagsArea (diagsArea);
-	      }
-
-	    // insert into parent
-	    qparent_.up->insert();
-	    
-	    pstate.matches_ = 0;
-	    step_ = INITIAL_;
-	    qparent_.down->removeHead();
-	    
-	    return WORK_OK;
-	  }
-	break;
-
-	} // switch
-    } // while
-
-}
-
-////////////////////////////////////////////////////////////////////////
-// Redefine virtual method allocatePstates, to be used by dynamic queue
-// resizing, as well as the initial queue construction.
-////////////////////////////////////////////////////////////////////////
-ex_tcb_private_state * ExExeUtilFastDeleteTcb::allocatePstates(
-     Lng32 &numElems,      // inout, desired/actual elements
-     Lng32 &pstateLength)  // out, length of one element
-{
-  PstateAllocator<ExExeUtilFastDeletePrivateState> pa;
-
-  return pa.allocatePstates(this, numElems, pstateLength);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// Constructor and destructor for ExeUtil_private_state
-/////////////////////////////////////////////////////////////////////////////
-ExExeUtilFastDeletePrivateState::ExExeUtilFastDeletePrivateState()
-{
-}
-
-ExExeUtilFastDeletePrivateState::~ExExeUtilFastDeletePrivateState()
-{
-};
-
-///////////////////////////////////////////////////////////////////
 ex_tcb * ExExeUtilLongRunningTdb::build(ex_globals * glob)
 {
   ExExeUtilLongRunningTcb * exe_util_tcb;
@@ -2211,7 +1270,11 @@
 {
   ExExeUtilTcb * exe_util_tcb;
 
-  exe_util_tcb = new(glob->getSpace()) ExExeUtilHiveTruncateTcb(*this, glob);
+  if (getIsLegacy())
+    exe_util_tcb = new(glob->getSpace()) ExExeUtilHiveTruncateLegacyTcb(*this, glob);
+  else
+    exe_util_tcb = new(glob->getSpace()) ExExeUtilHiveTruncateTcb(*this, glob);
+    
   exe_util_tcb->registerSubtasks();
 
   return (exe_util_tcb);
@@ -2219,9 +1282,9 @@
 
 
 ////////////////////////////////////////////////////////////////
-// Constructor for class ExExeUtilHiveTruncateTcb
+// Constructor for class ExExeUtilHiveTruncateLegacyTcb
 ///////////////////////////////////////////////////////////////
-ExExeUtilHiveTruncateTcb::ExExeUtilHiveTruncateTcb(
+ExExeUtilHiveTruncateLegacyTcb::ExExeUtilHiveTruncateLegacyTcb(
      const ComTdbExeUtilHiveTruncate & exe_util_tdb,
      ex_globals * glob)
      : ExExeUtilTcb( exe_util_tdb, NULL, glob)
@@ -2234,12 +1297,12 @@
   step_ = INITIAL_;
 }
 
-ExExeUtilHiveTruncateTcb::~ExExeUtilHiveTruncateTcb()
+ExExeUtilHiveTruncateLegacyTcb::~ExExeUtilHiveTruncateLegacyTcb()
 {
   freeResources();
 }
 
-void ExExeUtilHiveTruncateTcb::freeResources()
+void ExExeUtilHiveTruncateLegacyTcb::freeResources()
 {
   if (htTdb().getDropOnDealloc())
   {
@@ -2255,7 +1318,7 @@
   }
 }
 
-Int32 ExExeUtilHiveTruncateTcb::fixup()
+Int32 ExExeUtilHiveTruncateLegacyTcb::fixup()
 {
   lobGlob_ = NULL;
 
@@ -2268,9 +1331,9 @@
   return 0;
 }
 //////////////////////////////////////////////////////
-// work() for ExExeUtilHiveTruncateTsb
+// work() for ExExeUtilHiveTruncateLegacyTcb
 //////////////////////////////////////////////////////
-short ExExeUtilHiveTruncateTcb::work()
+short ExExeUtilHiveTruncateLegacyTcb::work()
 {
   short rc = 0;
   Lng32 cliRC = 0;
@@ -2434,6 +1497,196 @@
 }
 
 
+ex_tcb_private_state * ExExeUtilHiveTruncateLegacyTcb::allocatePstates(
+     Lng32 &numElems,      // inout, desired/actual elements
+     Lng32 &pstateLength)  // out, length of one element
+{
+  PstateAllocator<ExExeUtilHiveTruncateLegacyPrivateState> pa;
+
+  return pa.allocatePstates(this, numElems, pstateLength);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Constructor and destructor for ExeUtil_private_state
+/////////////////////////////////////////////////////////////////////////////
+ExExeUtilHiveTruncateLegacyPrivateState::ExExeUtilHiveTruncateLegacyPrivateState()
+{
+}
+
+ExExeUtilHiveTruncateLegacyPrivateState::~ExExeUtilHiveTruncateLegacyPrivateState()
+{
+};
+
+////////////////////////////////////////////////////////////////
+// Constructor for class ExExeUtilHiveTruncateTcb
+///////////////////////////////////////////////////////////////
+ExExeUtilHiveTruncateTcb::ExExeUtilHiveTruncateTcb(
+     const ComTdbExeUtilHiveTruncate & exe_util_tdb,
+     ex_globals * glob)
+     : ExExeUtilTcb( exe_util_tdb, NULL, glob)
+{
+  // Allocate the private state in each entry of the down queue
+  qparent_.down->allocatePstate(this);
+
+  step_ = INITIAL_;
+}
+
+ExExeUtilHiveTruncateTcb::~ExExeUtilHiveTruncateTcb()
+{
+  freeResources();
+}
+
+void ExExeUtilHiveTruncateTcb::freeResources()
+{
+  if (htTdb().getDropOnDealloc())
+  {
+    NAString hiveDropDDL("drop table ");
+    hiveDropDDL += htTdb().getHiveTableName();
+
+    // TODO: is it ok to ignore the error 
+    HiveClient_JNI::executeHiveSQL(hiveDropDDL);
+  }
+}
+
+//////////////////////////////////////////////////////
+// work() for ExExeUtilHiveTruncateTcb
+//////////////////////////////////////////////////////
+short ExExeUtilHiveTruncateTcb::work()
+{
+  short rc = 0;
+  Lng32 cliRC = 0;
+
+  // if no parent request, return
+  if (qparent_.down->isEmpty())
+    return WORK_OK;
+
+  // if no room in up queue, won't be able to return data/status.
+  // Come back later.
+  if (qparent_.up->isFull())
+    return WORK_OK;
+
+  ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
+  ExExeUtilPrivateState & pstate = *((ExExeUtilPrivateState*) pentry_down->pstate);
+
+  while (1)
+    {
+      switch (step_)
+        {
+        case INITIAL_:
+          {
+            // if 'if exists' clause was specified and table does not exist
+            // during compile phase, return.
+            // If table was missing during compile and was created before
+            // execute, then QI/AQR/Timestamp check will recompile.
+            if (htTdb().getIfExists() && htTdb().getTableNotExists())
+              {
+                step_ = DONE_;
+                break;
+              }
+
+            if (htTdb().getIsExternal())
+              step_ = ALTER_TO_MANAGED_;
+            else
+              step_ = TRUNCATE_TABLE_;
+          }
+          break;
+          
+        case ALTER_TO_MANAGED_:
+          {
+            // A Hive table can be an External or Managed table.
+            // Currently, an External Hive table cannot be truncated.
+            // Maybe some future Hive version will allow that.
+            // Temporarily change the table attribute to be Managed,
+            // truncate the table and then change it back to be External.
+            NAString alterStmt("alter table ");
+            alterStmt += htTdb().getHiveTableName(); 
+            alterStmt += " set tblproperties ('EXTERNAL'='False')";
+            if (HiveClient_JNI::executeHiveSQL(alterStmt.data()) != HVC_OK)
+              {
+                // alter failed
+                ExRaiseSqlError(getHeap(), &diagsArea_, -1214,
+                                NULL, NULL, NULL,
+                                getSqlJniErrorStr(), htTdb().getHiveTruncQuery()); 
+                step_ = ERROR_;
+                break;
+              }
+            
+            step_ = TRUNCATE_TABLE_;
+          }
+          break;
+
+        case TRUNCATE_TABLE_:
+          {
+            if (HiveClient_JNI::executeHiveSQL(htTdb().getHiveTruncQuery()) != HVC_OK)
+              {
+                ExRaiseSqlError(getHeap(), &diagsArea_, -1214,
+                                NULL, NULL, NULL,
+                                getSqlJniErrorStr(), htTdb().getHiveTruncQuery());
+
+                if (htTdb().getIsExternal())
+                  {
+                    step_ = ALTER_TO_EXTERNAL_AND_ERROR_;
+                    break;
+                  }
+                
+                step_ = ERROR_;
+                break;
+              }
+ 
+            if (htTdb().getIsExternal())
+              step_ = ALTER_TO_EXTERNAL_;
+            else
+              step_= DONE_;
+          }
+          break;
+          
+         case ALTER_TO_EXTERNAL_:
+         case ALTER_TO_EXTERNAL_AND_ERROR_:
+          {
+            // table was altered to Managed. Alter it back to External.
+            NAString alterStmt("alter table ");
+            alterStmt += htTdb().getHiveTableName(); 
+            alterStmt += " set tblproperties ('EXTERNAL'='TRUE')";
+             if (HiveClient_JNI::executeHiveSQL(alterStmt.data()) != HVC_OK)
+              {
+                // alter failed
+                ExRaiseSqlError(getHeap(), &diagsArea_, -1214,
+                                NULL, NULL, NULL,
+                                getSqlJniErrorStr(), alterStmt.data());
+                step_ = ERROR_;
+                break;
+              }                    
+
+            if (step_ == ALTER_TO_EXTERNAL_AND_ERROR_)
+              step_ = ERROR_;
+            else
+              step_ = DONE_;
+          }
+          break;
+
+        case ERROR_:
+          {
+            if (handleError())
+              return WORK_OK;
+            step_ = DONE_;
+          }
+          break;
+          
+        case DONE_:
+          {
+            if (handleDone())
+              return WORK_OK;
+            step_ = INITIAL_;
+            
+            return WORK_OK;
+          }
+          break;
+          
+        } // switch
+    } // while
+  
+}
+
 ex_tcb_private_state * ExExeUtilHiveTruncateTcb::allocatePstates(
      Lng32 &numElems,      // inout, desired/actual elements
      Lng32 &pstateLength)  // out, length of one element
@@ -2454,6 +1707,9 @@
 {
 };
 
+///////////////////////////////////////////////////////////////////////
+// ExExeUtilHiveQueryTdb
+///////////////////////////////////////////////////////////////////////
 ex_tcb * ExExeUtilHiveQueryTdb::build(ex_globals * glob)
 {
   ExExeUtilTcb * exe_util_tcb;
diff --git a/core/sql/executor/ExHdfsScan.cpp b/core/sql/executor/ExHdfsScan.cpp
index 9c68aa7..4db5a1d 100644
--- a/core/sql/executor/ExHdfsScan.cpp
+++ b/core/sql/executor/ExHdfsScan.cpp
@@ -46,6 +46,7 @@
 #include "ExpORCinterface.h"
 #include "ComSmallDefs.h"
 #include "HdfsClient_JNI.h"
+#include "ExpLOB.h"
 
 ex_tcb * ExHdfsScanTdb::build(ex_globals * glob)
 {
@@ -374,10 +375,9 @@
 Int32 ExHdfsScanTcb::fixup()
 {
   lobGlob_ = NULL;
-
-  ExpLOBinterfaceInit
-    (lobGlob_, (NAHeap *)getGlobals()->getDefaultHeap(),getGlobals()->castToExExeStmtGlobals()->getContext(),TRUE, hdfsScanTdb().hostName_,hdfsScanTdb().port_);
-  
+  lobGlob_ = ExpLOBoper::initLOBglobal((NAHeap *)getGlobals()->getDefaultHeap(),
+                                         getGlobals()->castToExExeStmtGlobals()->getContext(), 
+                                         useLibhdfsScan_, TRUE);
   return 0;
 }
 
diff --git a/core/sql/executor/ExStats.cpp b/core/sql/executor/ExStats.cpp
index af762c9..663d2bf 100644
--- a/core/sql/executor/ExStats.cpp
+++ b/core/sql/executor/ExStats.cpp
@@ -10069,6 +10069,7 @@
   rmsStatsResetTimestamp_ = NA_JulianTimestamp();
   numQueryInvKeys_ = 0;
   nodesInCluster_ = 0;
+  configuredPidMax_ = 0;
 }
 
 void ExRMSStats::reset()
@@ -10217,7 +10218,7 @@
         "stmtStatsGCed: %d lastGCTime: %ld "
         "totalStmtStatsGCed: %ld ssmpReqMsgCnt: %ld ssmpReqMsgBytes: %ld ssmpReplyMsgCnt: %ld ssmpReplyMsgBytes: %ld "
         "sscpReqMsgCnt: %ld sscpReqMsgBytes: %ld sscpReplyMsgCnt: %ld sscpReplyMsgBytes: %ld resetTimestamp: %ld " 
-        "numQueryInvKeys: %d ",
+        "numQueryInvKeys: %d  configuredPidMax: %d",
         statType(),
         rmsVersion_,
         nodeName_,
@@ -10252,7 +10253,8 @@
         sscpReplyMsgCnt_,
         sscpReplyMsgBytes_,
         rmsStatsResetTimestamp_,
-        numQueryInvKeys_
+        numQueryInvKeys_,
+        configuredPidMax_
        );
   }
   buf += str_len(buf);
@@ -10384,6 +10386,9 @@
   case SQLSTATS_RMS_STATS_NUM_SQL_SIK:
     sqlStats_item->int64_value = numQueryInvKeys_;
     break;
+  case SQLSTATS_RMS_CONFIGURED_PID_MAX:
+    sqlStats_item->int64_value = configuredPidMax_;
+    break;
   default:
     sqlStats_item->error_code = -EXE_STAT_NOT_FOUND;
     break;
diff --git a/core/sql/executor/ExStats.h b/core/sql/executor/ExStats.h
index f6b074a..e244b4d 100644
--- a/core/sql/executor/ExStats.h
+++ b/core/sql/executor/ExStats.h
@@ -3283,6 +3283,7 @@
   }
   inline void setNumQueryInvKeys(Int32 n) { numQueryInvKeys_ = n; }
   inline void setNodesInCluster(short n) { nodesInCluster_ = n; }
+  inline void setConfiguredPidMax(pid_t pid) { configuredPidMax_ = pid; }
   Lng32 getStatsItem(SQLSTATS_ITEM* sqlStats_item);
   void reset();
 private: 
@@ -3320,6 +3321,7 @@
   Int64 rmsStatsResetTimestamp_;
   Int32 numQueryInvKeys_;
   short nodesInCluster_;
+  pid_t configuredPidMax_;
 };
 
 
diff --git a/core/sql/executor/HBaseClient_JNI.cpp b/core/sql/executor/HBaseClient_JNI.cpp
index 8726fb8..5a7cfe6 100644
--- a/core/sql/executor/HBaseClient_JNI.cpp
+++ b/core/sql/executor/HBaseClient_JNI.cpp
@@ -539,6 +539,7 @@
     jenv_->PopLocalFrame(NULL);
     return HBC_ERROR_CREATE_EXCEPTION;
   }
+
   jenv_->PopLocalFrame(NULL);
   return HBC_OK;
 }
@@ -604,6 +605,7 @@
   if (jresult == false) 
   {
     logError(CAT_SQL_HBASE, "HBaseClient_JNI::create()", getLastError());
+    GetCliGlobals()->setJniErrorStr(getLastError());
     jenv_->PopLocalFrame(NULL);
     return HBC_ERROR_CREATE_EXCEPTION;
   }
diff --git a/core/sql/executor/HdfsClient_JNI.cpp b/core/sql/executor/HdfsClient_JNI.cpp
index 72157bf..d5b5043 100644
--- a/core/sql/executor/HdfsClient_JNI.cpp
+++ b/core/sql/executor/HdfsClient_JNI.cpp
@@ -332,6 +332,8 @@
  ,"Java exception in HdfsClient::hdfsOpen()."
  ,"JNI NewStringUTF() in HdfsClient::hdfsWrite()."
  ,"Java exception in HdfsClient::hdfsWrite()."
+ ,"JNI NewStringUTF() in HdfsClient::hdfsWriteImmediate()."
+ ,"Java exception in HdfsClient::hdfsWriteImmediate()."
  ,"Error in HdfsClient::hdfsRead()."
  ,"Java exception in HdfsClient::hdfsRead()."
  ,"Java exception in HdfsClient::hdfsClose()."
@@ -353,6 +355,10 @@
  ,"Buffer is small in HdfsClient::getFsDefaultName()."
  ,"Error in HdfsClient::hdfsCreateDirectory()."
  ,"Java exception in HdfsClient::hdfsCreateDirectory()."
+ ,"Error in HdfsClient::hdfsRename()."
+ ,"Java exception in HdfsClient::hdfsRename()."
+ ,"Error in HdfsClient::hdfsSize()."
+ ,"Java exception in HdfsClient::hdfsSize()."
 };
 
 //////////////////////////////////////////////////////////////////////////////
@@ -364,6 +370,7 @@
    deleteHdfsFileInfo();
    if (path_ != NULL) 
       NADELETEBASIC(path_, getHeap());
+   path_ = NULL;
 }
 
 void HdfsClient::deleteHdfsFileInfo()
@@ -416,15 +423,10 @@
    return hdfsClient;
 }
 
-void HdfsClient::deleteInstance()
+void HdfsClient::deleteInstance(HdfsClient *hdfsClient)
 {
-   ContextCli *currContext = GetCliGlobals()->currContext();
-   HdfsClient *hdfsClient = currContext->getHDFSClient();
-   if (hdfsClient != NULL) {
-      NAHeap *heap = currContext->exHeap();
-      NADELETE(hdfsClient, HdfsClient, heap);
-      currContext->setHDFSClient(NULL);
-   }
+  hdfsClient->hdfsClose();
+  NADELETE(hdfsClient, HdfsClient, hdfsClient->getHeap());
 }
 
 HDFS_Client_RetCode HdfsClient::init()
@@ -452,8 +454,10 @@
     JavaMethods_[JM_HDFS_OPEN       ].jm_signature = "(Ljava/lang/String;Z)Z";
     JavaMethods_[JM_HDFS_WRITE      ].jm_name      = "hdfsWrite";
     JavaMethods_[JM_HDFS_WRITE      ].jm_signature = "([B)I";
+    JavaMethods_[JM_HDFS_WRITE_IMMEDIATE].jm_name      = "hdfsWriteImmediate";
+    JavaMethods_[JM_HDFS_WRITE_IMMEDIATE].jm_signature = "([B)J";
     JavaMethods_[JM_HDFS_READ       ].jm_name      = "hdfsRead";
-    JavaMethods_[JM_HDFS_READ       ].jm_signature = "(Ljava/nio/ByteBuffer;)I";
+    JavaMethods_[JM_HDFS_READ       ].jm_signature = "(JLjava/nio/ByteBuffer;)I";
     JavaMethods_[JM_HDFS_CLOSE      ].jm_name      = "hdfsClose";
     JavaMethods_[JM_HDFS_CLOSE      ].jm_signature = "()Z";
     JavaMethods_[JM_HDFS_MERGE_FILES].jm_name      = "hdfsMergeFiles";
@@ -472,6 +476,12 @@
     JavaMethods_[JM_GET_FS_DEFAULT_NAME].jm_signature = "()Ljava/lang/String;";
     JavaMethods_[JM_HDFS_CREATE_DIRECTORY].jm_name      = "hdfsCreateDirectory";
     JavaMethods_[JM_HDFS_CREATE_DIRECTORY].jm_signature = "(Ljava/lang/String;)Z";
+    JavaMethods_[JM_HDFS_RENAME].jm_name      = "hdfsRename";
+    JavaMethods_[JM_HDFS_RENAME].jm_signature = "(Ljava/lang/String;Ljava/lang/String;)Z";
+    JavaMethods_[JM_HDFS_SIZE].jm_name      = "hdfsSize";
+    JavaMethods_[JM_HDFS_SIZE].jm_signature = "()J";
+    JavaMethods_[JM_HDFS_SIZE_FOR_FILE].jm_name      = "hdfsSize";
+    JavaMethods_[JM_HDFS_SIZE_FOR_FILE].jm_signature = "(Ljava/lang/String;)J";
     rc = (HDFS_Client_RetCode)JavaObjectInterface::init(className, javaClass_, JavaMethods_, (Int32)JM_LAST, javaMethodsInitialized_);
     if (rc == HDFS_CLIENT_OK)
        javaMethodsInitialized_ = TRUE;
@@ -495,7 +505,7 @@
 {
    if (path_ != NULL) 
       NADELETEBASIC(path_, getHeap());
-   short len = strlen(path);
+   size_t len = strlen(path);
    path_ = new (getHeap()) char[len+1];
    strcpy(path_, path); 
 }
@@ -551,7 +561,7 @@
 
   if (initJNIEnv() != JOI_OK)
      return HDFS_CLIENT_ERROR_HDFS_OPEN_PARAM;
-
+  setPath(path);
   jstring js_path = jenv_->NewStringUTF(path);
   if (js_path == NULL) {
     GetCliGlobals()->setJniErrorStr(getErrorText(HDFS_CLIENT_ERROR_HDFS_OPEN_PARAM));
@@ -587,8 +597,37 @@
   return HDFS_CLIENT_OK;
 }
 
+Int64 HdfsClient::hdfsSize(HDFS_Client_RetCode &hdfsClientRetcode)
+{
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HdfsClient::hdfsSize() called.");
+   
+  if (initJNIEnv() != JOI_OK) {
+     hdfsClientRetcode = HDFS_CLIENT_ERROR_SIZE_PARAM;
+     return -1;
+  }
 
-Int32 HdfsClient::hdfsWrite(const char* data, Int64 len, HDFS_Client_RetCode &hdfsClientRetcode)
+  if (hdfsStats_ != NULL)
+     hdfsStats_->getHdfsTimer().start();
+  tsRecentJMFromJNI = JavaMethods_[JM_HDFS_SIZE].jm_full_name;
+  jlong jresult = jenv_->CallLongMethod(javaObj_, JavaMethods_[JM_HDFS_SIZE].methodID);
+  if (hdfsStats_ != NULL) {
+      hdfsStats_->incMaxHdfsIOTime(hdfsStats_->getHdfsTimer().stop());
+      hdfsStats_->incHdfsCalls();
+  }
+
+  if (jenv_->ExceptionCheck())
+  {
+    getExceptionDetails(__FILE__, __LINE__, "HdfsClient::hdfsSize()");
+    jenv_->PopLocalFrame(NULL);
+    hdfsClientRetcode = HDFS_CLIENT_ERROR_SIZE_EXCEPTION;
+    return -1;
+  }
+  hdfsClientRetcode = HDFS_CLIENT_OK;
+  return jresult;
+}
+
+
+Int32 HdfsClient::hdfsWrite(const char* data, Int64 len, HDFS_Client_RetCode &hdfsClientRetcode, int maxChunkSize)
 {
   QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HdfsClient::hdfsWrite(%ld) called.", len);
 
@@ -598,8 +637,9 @@
   }
   Int64 lenRemain = len;
   Int64 writeLen;
-  Int64 chunkLen = (ioByteArraySizeInKB_ > 0 ? ioByteArraySizeInKB_ * 1024 : 0);
+  Int64 chunkLen = (maxChunkSize > 0 ? maxChunkSize : (ioByteArraySizeInKB_ > 0 ? ioByteArraySizeInKB_ * 1024 : 0));
   Int64 offset = 0;
+  jint bytesWritten;
   do 
   {
      if ((chunkLen > 0) && (lenRemain > chunkLen))
@@ -621,7 +661,7 @@
 
      tsRecentJMFromJNI = JavaMethods_[JM_HDFS_WRITE].jm_full_name;
      // Java method returns the cumulative bytes written
-     jint totalBytesWritten = jenv_->CallIntMethod(javaObj_, JavaMethods_[JM_HDFS_WRITE].methodID, jbArray);
+     bytesWritten = jenv_->CallIntMethod(javaObj_, JavaMethods_[JM_HDFS_WRITE].methodID, jbArray);
 
      if (hdfsStats_ != NULL) {
          hdfsStats_->incMaxHdfsIOTime(hdfsStats_->getHdfsTimer().stop());
@@ -639,12 +679,70 @@
   } while (lenRemain > 0);
   jenv_->PopLocalFrame(NULL);
   hdfsClientRetcode = HDFS_CLIENT_OK;
-  return len; 
+  return bytesWritten; 
 }
 
-Int32 HdfsClient::hdfsRead(const char* data, Int64 len, HDFS_Client_RetCode &hdfsClientRetcode)
+Int64 HdfsClient::hdfsWriteImmediate(const char* data, Int64 len, HDFS_Client_RetCode &hdfsClientRetcode, int maxChunkSize)
 {
-   QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HdfsClient::hdfsWrite(%ld) called.", len);
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HdfsClient::hdfsWriteImmediate(%ld) called.", len);
+
+  if (initJNIEnv() != JOI_OK) {
+     hdfsClientRetcode = HDFS_CLIENT_ERROR_HDFS_WRITE_IMMEDIATE_EXCEPTION;
+     return 0;
+  }
+  Int64 lenRemain = len;
+  Int64 writeLen;
+  Int64 chunkLen = (maxChunkSize > 0 ? maxChunkSize : (ioByteArraySizeInKB_ > 0 ? ioByteArraySizeInKB_ * 1024 : 0));
+  Int64 offset = 0;
+  jlong writeOffset = -1;
+  jlong chunkWriteOffset;
+  do 
+  {
+     if ((chunkLen > 0) && (lenRemain > chunkLen))
+        writeLen = chunkLen; 
+     else
+        writeLen = lenRemain;
+     //Write the requisite bytes into the file
+     jbyteArray jbArray = jenv_->NewByteArray(writeLen);
+     if (!jbArray) {
+        GetCliGlobals()->setJniErrorStr(getErrorText(HDFS_CLIENT_ERROR_HDFS_WRITE_IMMEDIATE_PARAM));
+        jenv_->PopLocalFrame(NULL);
+        hdfsClientRetcode =  HDFS_CLIENT_ERROR_HDFS_WRITE_IMMEDIATE_PARAM;
+        return 0;
+     }
+     jenv_->SetByteArrayRegion(jbArray, 0, writeLen, (const jbyte*)(data+offset));
+
+     if (hdfsStats_ != NULL)
+         hdfsStats_->getHdfsTimer().start();
+
+     tsRecentJMFromJNI = JavaMethods_[JM_HDFS_WRITE_IMMEDIATE].jm_full_name;
+     // Java method returns the cumulative bytes written
+     chunkWriteOffset = jenv_->CallIntMethod(javaObj_, JavaMethods_[JM_HDFS_WRITE_IMMEDIATE].methodID, jbArray);
+     if (writeOffset == -1)
+        writeOffset = chunkWriteOffset;
+
+     if (hdfsStats_ != NULL) {
+         hdfsStats_->incMaxHdfsIOTime(hdfsStats_->getHdfsTimer().stop());
+         hdfsStats_->incHdfsCalls();
+     }
+     if (jenv_->ExceptionCheck())
+     {
+        getExceptionDetails(__FILE__, __LINE__, "HdfsClient::hdfsWrite()");
+        jenv_->PopLocalFrame(NULL);
+        hdfsClientRetcode = HDFS_CLIENT_ERROR_HDFS_WRITE_IMMEDIATE_EXCEPTION;
+        return 0;
+     }
+     lenRemain -= writeLen;
+     offset += writeLen;
+  } while (lenRemain > 0);
+  jenv_->PopLocalFrame(NULL);
+  hdfsClientRetcode = HDFS_CLIENT_OK;
+  return writeOffset;
+}
+
+Int32 HdfsClient::hdfsRead(Int64 pos, const char* data, Int64 len, HDFS_Client_RetCode &hdfsClientRetcode)
+{
+   QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HdfsClient::hdfsRead(%ld) called.", len);
 
    if (initJNIEnv() != JOI_OK) {
       hdfsClientRetcode = HDFS_CLIENT_ERROR_HDFS_READ_EXCEPTION;
@@ -661,7 +759,8 @@
 
   tsRecentJMFromJNI = JavaMethods_[JM_HDFS_READ].jm_full_name;
   jint bytesRead = 0;
-  bytesRead = jenv_->CallIntMethod(javaObj_, JavaMethods_[JM_HDFS_READ].methodID, j_buf);
+  jlong j_pos = pos;
+  bytesRead = jenv_->CallIntMethod(javaObj_, JavaMethods_[JM_HDFS_READ].methodID, j_pos, j_buf);
 
   if (hdfsStats_ != NULL) {
       hdfsStats_->incMaxHdfsIOTime(hdfsStats_->getHdfsTimer().stop());
@@ -714,6 +813,38 @@
   return HDFS_CLIENT_OK;
 }
 
+Int64 HdfsClient::hdfsSize(const char *filename, HDFS_Client_RetCode &hdfsClientRetcode)
+{
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HdfsClient::hdfsSize() called.");
+   
+  if (initJNIEnv() != JOI_OK) {
+     hdfsClientRetcode = HDFS_CLIENT_ERROR_SIZE_PARAM;
+     return -1;
+  }
+  if (getInstance() == NULL)
+     return HDFS_CLIENT_ERROR_SIZE_PARAM;
+
+  jstring j_filename = jenv_->NewStringUTF(filename);
+  if (j_filename == NULL) {
+    GetCliGlobals()->setJniErrorStr(getErrorText(HDFS_CLIENT_ERROR_SIZE_PARAM));
+    jenv_->PopLocalFrame(NULL);
+    return HDFS_CLIENT_ERROR_SIZE_PARAM;
+  }
+
+  tsRecentJMFromJNI = JavaMethods_[JM_HDFS_SIZE_FOR_FILE].jm_full_name;
+  jlong jresult = jenv_->CallStaticLongMethod(javaClass_, JavaMethods_[JM_HDFS_SIZE_FOR_FILE].methodID, j_filename);
+
+  if (jenv_->ExceptionCheck())
+  {
+    getExceptionDetails(__FILE__, __LINE__, "HdfsClient::hdfsSize()");
+    jenv_->PopLocalFrame(NULL);
+    hdfsClientRetcode = HDFS_CLIENT_ERROR_SIZE_EXCEPTION;
+    return -1;
+  }
+  hdfsClientRetcode = HDFS_CLIENT_OK;
+  return jresult;
+}
+
 HDFS_Client_RetCode HdfsClient::hdfsCleanUnloadPath( const NAString& uldPath)
 {
   QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HdfsClient::hdfsCleanUnloadPath(%s) called.",
@@ -978,7 +1109,47 @@
   {
     logError(CAT_SQL_HDFS, "HdfsClient::hdfsCreateDirectory()", getLastError());
     jenv_->PopLocalFrame(NULL);
-    return HDFS_CLIENT_ERROR_HDFS_DELETE_PATH_EXCEPTION;
+    return HDFS_CLIENT_ERROR_CREATE_DIRECTORY_EXCEPTION;
+  }
+  jenv_->PopLocalFrame(NULL);
+  return HDFS_CLIENT_OK;
+}
+
+HDFS_Client_RetCode HdfsClient::hdfsRename(const NAString &fromPath, const NAString &toPath)
+{
+  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "Enter HDFSClient_JNI::hdfsRename() called.");
+  if (initJNIEnv() != JOI_OK)
+     return HDFS_CLIENT_ERROR_RENAME_PARAM;
+  if (getInstance() == NULL)
+     return HDFS_CLIENT_ERROR_RENAME_PARAM;
+
+  jstring js_fromPath = jenv_->NewStringUTF(fromPath.data());
+  if (js_fromPath == NULL) {
+     jenv_->PopLocalFrame(NULL);
+     return HDFS_CLIENT_ERROR_RENAME_PARAM;
+  }
+
+  jstring js_toPath = jenv_->NewStringUTF(toPath.data());
+  if (js_toPath == NULL) {
+     jenv_->PopLocalFrame(NULL);
+     return HDFS_CLIENT_ERROR_RENAME_PARAM;
+  }
+
+  tsRecentJMFromJNI = JavaMethods_[JM_HDFS_RENAME].jm_full_name;
+  jstring jresult = 
+        (jstring)jenv_->CallStaticObjectMethod(javaClass_,
+                              JavaMethods_[JM_HDFS_RENAME].methodID, js_fromPath, js_toPath);
+  if (jenv_->ExceptionCheck())
+  {
+    getExceptionDetails(__FILE__, __LINE__, "HdfsClient::hdfsRename()");
+    jenv_->PopLocalFrame(NULL);
+    return HDFS_CLIENT_ERROR_RENAME_EXCEPTION;
+  }
+  if (jresult == false)
+  {
+    logError(CAT_SQL_HDFS, "HdfsClient::hdfsRename()", getLastError());
+    jenv_->PopLocalFrame(NULL);
+    return HDFS_CLIENT_ERROR_RENAME_EXCEPTION;
   }
   jenv_->PopLocalFrame(NULL);
   return HDFS_CLIENT_OK;
diff --git a/core/sql/executor/HdfsClient_JNI.h b/core/sql/executor/HdfsClient_JNI.h
index 888451c..3d12633 100644
--- a/core/sql/executor/HdfsClient_JNI.h
+++ b/core/sql/executor/HdfsClient_JNI.h
@@ -47,7 +47,6 @@
 class HdfsScan : public JavaObjectInterface
 {
 public:
-  // Default constructor - for creating a new JVM		
   HdfsScan(NAHeap *heap)
   :  JavaObjectInterface(heap) 
   , hdfsStats_(NULL)
@@ -129,6 +128,8 @@
  ,HDFS_CLIENT_ERROR_HDFS_OPEN_EXCEPTION
  ,HDFS_CLIENT_ERROR_HDFS_WRITE_PARAM
  ,HDFS_CLIENT_ERROR_HDFS_WRITE_EXCEPTION
+ ,HDFS_CLIENT_ERROR_HDFS_WRITE_IMMEDIATE_PARAM
+ ,HDFS_CLIENT_ERROR_HDFS_WRITE_IMMEDIATE_EXCEPTION
  ,HDFS_CLIENT_ERROR_HDFS_READ_PARAM
  ,HDFS_CLIENT_ERROR_HDFS_READ_EXCEPTION
  ,HDFS_CLIENT_ERROR_HDFS_CLOSE_EXCEPTION
@@ -151,13 +152,16 @@
  ,HDFS_CLIENT_ERROR_GET_FS_DEFAULT_NAME_BUFFER_TOO_SMALL
  ,HDFS_CLIENT_ERROR_CREATE_DIRECTORY_PARAM
  ,HDFS_CLIENT_ERROR_CREATE_DIRECTORY_EXCEPTION
+ ,HDFS_CLIENT_ERROR_RENAME_PARAM
+ ,HDFS_CLIENT_ERROR_RENAME_EXCEPTION
+ ,HDFS_CLIENT_ERROR_SIZE_PARAM
+ ,HDFS_CLIENT_ERROR_SIZE_EXCEPTION
  ,HDFS_CLIENT_LAST
 } HDFS_Client_RetCode;
 
 class HdfsClient : public JavaObjectInterface
 {
 public:
-  // Default constructor - for creating a new JVM		
   HdfsClient(NAHeap *heap)
   :  JavaObjectInterface(heap) 
     , path_(NULL)
@@ -171,7 +175,7 @@
   ~HdfsClient();
   static HdfsClient *newInstance(NAHeap *heap, ExHdfsScanStats *hdfsStats, HDFS_Client_RetCode &retCode, int hdfsIoByteArraySizeInKB = 0);
   static HdfsClient *getInstance();
-  static void deleteInstance();
+  static void deleteInstance(HdfsClient *hdfsClient);
   void setIoByteArraySize(int size)
       { ioByteArraySizeInKB_ = size; }
 
@@ -182,13 +186,16 @@
   HDFS_Client_RetCode    init();
   HDFS_Client_RetCode    hdfsCreate(const char* path, NABoolean overwrite, NABoolean compress);
   HDFS_Client_RetCode    hdfsOpen(const char* path, NABoolean compress);
-  Int32                  hdfsWrite(const char* data, Int64 size, HDFS_Client_RetCode &hdfsClientRetcode);
-  Int32                  hdfsRead(const char* data, Int64 size, HDFS_Client_RetCode &hdfsClientRetcode);
+  Int64                  hdfsSize(HDFS_Client_RetCode &hdfsClientRetcode);
+  Int32                  hdfsWrite(const char* data, Int64 size, HDFS_Client_RetCode &hdfsClientRetcode, int maxChunkSize = 0);
+  Int64                  hdfsWriteImmediate(const char* data, Int64 size, HDFS_Client_RetCode &hdfsClientRetcode, int maxChunkSize = 0);
+  Int32                  hdfsRead(Int64 offset, const char* data, Int64 size, HDFS_Client_RetCode &hdfsClientRetcode);
   HDFS_Client_RetCode    hdfsClose();
   HDFS_Client_RetCode    setHdfsFileInfo(JNIEnv *jenv, jint numFiles, jint fileNo, jboolean isDir, 
           jstring filename, jlong modTime, jlong len, jshort numReplicas, jlong blockSize, 
           jstring owner, jstring group, jshort permissions, jlong accessTime);
   HDFS_Client_RetCode    hdfsListDirectory(const char *pathStr, HDFS_FileInfo **hdfsFileInfo, int *numFiles);
+  static Int64                  hdfsSize(const char *filename, HDFS_Client_RetCode &hdfsClientRetcode);
   static HDFS_Client_RetCode    hdfsMergeFiles(const NAString& srcPath, const NAString& dstPath);
   static HDFS_Client_RetCode    hdfsCleanUnloadPath(const NAString& uldPath );
   static HDFS_Client_RetCode    hdfsExists(const NAString& uldPath,  NABoolean & exists );
@@ -199,6 +206,7 @@
   // buf_len is the length of the buffer in bytes
   static HDFS_Client_RetCode    getFsDefaultName(char* buffer, Int32 buf_len);
   static HDFS_Client_RetCode    hdfsCreateDirectory(const NAString& path);
+  static HDFS_Client_RetCode    hdfsRename(const NAString& fromPath, const NAString& toPath);
 
 private:  
   enum JAVA_METHODS {
@@ -206,6 +214,7 @@
     JM_HDFS_CREATE,
     JM_HDFS_OPEN,
     JM_HDFS_WRITE,
+    JM_HDFS_WRITE_IMMEDIATE,
     JM_HDFS_READ,
     JM_HDFS_CLOSE,
     JM_HDFS_MERGE_FILES,
@@ -216,6 +225,9 @@
     JM_HIVE_TBL_MAX_MODIFICATION_TS,
     JM_GET_FS_DEFAULT_NAME,
     JM_HDFS_CREATE_DIRECTORY,
+    JM_HDFS_RENAME,
+    JM_HDFS_SIZE,
+    JM_HDFS_SIZE_FOR_FILE,
     JM_LAST
   };
 
diff --git a/core/sql/executor/ex_control.cpp b/core/sql/executor/ex_control.cpp
index 4a23e30..f33d241 100644
--- a/core/sql/executor/ex_control.cpp
+++ b/core/sql/executor/ex_control.cpp
@@ -178,6 +178,54 @@
   char *dummyReply = NULL;
   ULng32 dummyLen;
   
+  // if this is SET SCHEMA stmt of a HIVE schema, check that the schema
+  // exists. This is to be consistent with USE <database> functionality
+  // of Hive where a schema must exist before USE stmt can be issued.
+  // An error is returned if it does not exist.
+  if ((controlTdb().isSetStmt()) &&
+      (controlTdb().isHiveSetSchema()))
+    {
+      // set schema hive.<sch> stmt
+      // Check that it exists in Hive.
+      ComSchemaName csn(value[2]);
+      NAString hiveDB = ComConvertTrafHiveNameToNativeHiveName
+        (csn.getCatalogNamePart().getInternalName(),
+         csn.getSchemaNamePart().getInternalName(),
+         NAString(""));
+
+      NAString useDB("use " + hiveDB);
+      if (HiveClient_JNI::executeHiveSQL(useDB.data()) != HVC_OK)
+        {
+          ComDiagsArea *da = 
+            ComDiagsArea::allocate(getGlobals()->getDefaultHeap());
+          if (NAString(getSqlJniErrorStr()).contains("Database does not exist:"))
+            *da << DgSqlCode(-1003)
+                << DgString0(HIVE_SYSTEM_CATALOG)
+                << DgString1(hiveDB);
+          else
+            *da << DgSqlCode(-1214)
+                << DgString0(getSqlJniErrorStr())
+                << DgString1(useDB.data());
+          
+          ExHandleArkcmpErrors(qparent_, pentry_down, 0,
+                               getGlobals(), da);
+
+          ex_queue_entry * up_entry = qparent_.up->getTailEntry();
+          
+          up_entry->upState.parentIndex = 
+            pentry_down->downState.parentIndex;
+          
+          up_entry->upState.setMatchNo(0);
+          up_entry->upState.status = ex_queue::Q_NO_DATA;
+          
+          // insert into parent
+          qparent_.up->insert();
+          
+          qparent_.down->removeHead();
+          
+          return WORK_OK;
+        }      
+    }
 
   // Only a STATIC compile will actually affect Arkcmp's context.
   CmpCompileInfo c(buf, usedlen, sqlTextCharSet, NULL, 0, 0, 0);
@@ -387,6 +435,13 @@
                 currContext->getSessionDefaults()->
                   setSchema(value[2], strlen(value[2]));
               }
+            else if (strcmp(value[1], "USE_LIBHDFS") == 0)
+              {
+                if (strcmp(value[2], "ON") == 0)
+                  currContext->getSessionDefaults()->setUseLibHdfs(TRUE);
+                else 
+                  currContext->getSessionDefaults()->setUseLibHdfs(FALSE);
+              } 
             else if (strcmp(value[1], "USER_EXPERIENCE_LEVEL") == 0)
               {
                 currContext->getSessionDefaults()->
diff --git a/core/sql/executor/ex_ddl.cpp b/core/sql/executor/ex_ddl.cpp
index f221abd..30181b9 100644
--- a/core/sql/executor/ex_ddl.cpp
+++ b/core/sql/executor/ex_ddl.cpp
@@ -479,6 +479,8 @@
             currEntry_ = 0;
             currPtr_ = NULL;
 
+            queryStartTime_ = NA_JulianTimestamp();
+
             if (ddlTdb().hbaseDDL())
               {
                 if (ddlTdb().hbaseDDLNoUserXn())
@@ -530,6 +532,9 @@
                 if (ddlTdb().getReturnDetails())
                   mdi_->setReturnDetails(TRUE);
               }
+            else if (ddlTdb().getInitTraf())
+              mdi_->setInitTraf(TRUE);
+
             mdi_->setHbaseDDL(TRUE);            
 
             if (ddlTdb().inputExpr_)
@@ -562,9 +567,6 @@
                 callEmbeddedCmp_ = FALSE;
               }
 
-            // TEMP, until embedded call is fixed to handle returning status.
-            callEmbeddedCmp_ = FALSE;
-
             step_ = SETUP_NEXT_STEP_;
          }
           break;
@@ -608,8 +610,9 @@
                currContext->getSqlParserFlags(),
                parentQid, str_len(parentQid), cpDiagsArea);
 
-            getHeap()->deallocateMemory(data_);
- 
+            if (currContext->getDiagsArea())
+              currContext->getDiagsArea()->clear();
+
             if ((cpDiagsArea) &&
                 ((cpDiagsArea->getNumber(DgSqlCode::WARNING_) > 0) ||
                  (cpDiagsArea->getNumber(DgSqlCode::ERROR_) > 0)))
@@ -680,15 +683,18 @@
                 
                 replyDWS_ = (CmpDDLwithStatusInfo*)(new(getHeap()) char[replyBufLen_]);
                 memcpy((char*)replyDWS_, replyBuf_, replyBufLen_);
-                cmp_->getHeap()->deallocateMemory((void*)replyBuf_);
+                if (cmp_)
+                  cmp_->getHeap()->deallocateMemory((void*)replyBuf_);
+                else
+                  currContext->exHeap()->deallocateMemory((void*)replyBuf_);
                 replyBuf_ = NULL;
                 replyBufLen_ = 0;
 
                 replyDWS_->unpack((char*)replyDWS_);
 
-                if (mdi_->computeST())
+                if (replyDWS_->computeST())
                   startTime_ = NA_JulianTimestamp();
-                else if (mdi_->computeET())
+                else if (replyDWS_->computeET())
                   endTime_ = NA_JulianTimestamp();
               }
             
@@ -719,7 +725,19 @@
             char buf[1000];
             if (strlen(replyDWS_->msg()) > 0)
               {
-                str_sprintf(buf, "%s", replyDWS_->msg());
+                if (replyDWS_->returnET())
+                  {
+                    if (replyDWS_->done())
+                      startTime_ = queryStartTime_;
+
+                    char timeBuf[100];
+                    ExExeUtilTcb::getTimeAsString((endTime_-startTime_), timeBuf,
+                                                  TRUE);
+                    str_sprintf(buf, "%s {ET: %s}", replyDWS_->msg(),
+                                timeBuf);
+                  }
+                else
+                  str_sprintf(buf, "%s", replyDWS_->msg());
                 if (moveRowToUpQueue(&qparent_, ddlTdb().tuppIndex(), buf, 0, &rc))
                   return rc;
               }
diff --git a/core/sql/executor/ex_ddl.h b/core/sql/executor/ex_ddl.h
index efb3eac..5d72f74 100644
--- a/core/sql/executor/ex_ddl.h
+++ b/core/sql/executor/ex_ddl.h
@@ -275,6 +275,7 @@
 
   Int64 startTime_;
   Int64 endTime_;
+  Int64 queryStartTime_;
 
   char * data_;
   size_t dataLen_;
diff --git a/core/sql/executor/ex_esp_frag_dir.cpp b/core/sql/executor/ex_esp_frag_dir.cpp
index 81ee824..e0205f0 100644
--- a/core/sql/executor/ex_esp_frag_dir.cpp
+++ b/core/sql/executor/ex_esp_frag_dir.cpp
@@ -101,11 +101,19 @@
   pid_ = phandle.getPin();
 
   tid_ = syscall(SYS_gettid);
-  if (statsGlobals_ == NULL
-    || (statsGlobals_ != NULL && 
-      statsGlobals_->getVersion() != StatsGlobals::CURRENT_SHARED_OBJECTS_VERSION_))
+  NABoolean reportError = FALSE;
+  char msg[256];;
+  if ((statsGlobals_ == NULL)
+     || ((statsGlobals_ != NULL) &&  (statsGlobals_->getInitError(pid_, reportError))))
   {
+    if (reportError) {
+         snprintf(msg, sizeof(msg), 
+          "Version mismatch or Pid %d,%d is higher than the configured pid max %d",
+           cpu_, pid_, statsGlobals_->getConfiguredPidMax()); 
+         SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, msg, 0);
+    }
     statsGlobals_ = NULL;
+
     statsHeap_ = new (heap_) 
         NAHeap("Process Stats Heap", (NAHeap *)heap_,
         8192,
diff --git a/core/sql/executor/ex_globals.cpp b/core/sql/executor/ex_globals.cpp
index df7e9ef..673690f 100644
--- a/core/sql/executor/ex_globals.cpp
+++ b/core/sql/executor/ex_globals.cpp
@@ -89,11 +89,9 @@
   return exLobGlobals_;
 }
 
-void ex_globals::initLOBglobal(ContextCli *context)
+void ex_globals::initLOBglobal(ContextCli *context, NABoolean useLibHdfs)
 {
-  // initialize lob interface
-  ExpLOBoper::initLOBglobal(exLobGlobals_, (NAHeap *)heap_, context, (char *)"default", (Int32)0);
-
+  exLobGlobals_ = ExpLOBoper::initLOBglobal((NAHeap *)heap_, context, useLibHdfs);
 }
 
 void ex_globals::reAllocate(short create_gui_sched)
@@ -135,9 +133,9 @@
   statsArea_ = NULL;
   cleanupTcbs();
   tcbList_.deallocate();
-  ExpLOBinterfaceCleanup(exLobGlobals_);
+  if (exLobGlobals_ != NULL)
+     ExpLOBoper::deleteLOBglobal(exLobGlobals_, (NAHeap *)heap_);
   exLobGlobals_ = NULL;
-
 }
 
 void ex_globals::deleteMemory(void *mem)
diff --git a/core/sql/executor/ex_globals.h b/core/sql/executor/ex_globals.h
index 536c76f..f6b3a94 100644
--- a/core/sql/executor/ex_globals.h
+++ b/core/sql/executor/ex_globals.h
@@ -183,7 +183,7 @@
 
   ExLobGlobals *&getExLobGlobal();
   
-  void initLOBglobal(ContextCli *context);
+  void initLOBglobal(ContextCli *context, NABoolean useLibHdfs);
   
   SequenceValueGenerator * seqGen();
   
@@ -191,6 +191,7 @@
 
   void setRollupColumnNum(Int16 v) { rollupColumnNum_ = v; }
   Int16 getRollupColumnNum() { return rollupColumnNum_; }
+  ExLobGlobals *getLobGlobals() {return exLobGlobals_; }
 
 private:
   enum FlagsTypeEnum 
diff --git a/core/sql/executor/ex_root.cpp b/core/sql/executor/ex_root.cpp
index 1a6fba5..aa1b870 100644
--- a/core/sql/executor/ex_root.cpp
+++ b/core/sql/executor/ex_root.cpp
@@ -299,7 +299,7 @@
 
   if (processLOB())
     {
-      glob->initLOBglobal(cliGlobals->currContext());
+      glob->initLOBglobal(cliGlobals->currContext(), useLibHdfs());
     }
 
   return (root_tcb);
diff --git a/core/sql/executor/ex_split_bottom.cpp b/core/sql/executor/ex_split_bottom.cpp
index 77324f3..4e1084a 100644
--- a/core/sql/executor/ex_split_bottom.cpp
+++ b/core/sql/executor/ex_split_bottom.cpp
@@ -50,7 +50,7 @@
 #include  "str.h"
 #include  "exp_clause_derived.h"
 #include "ExSMGlobals.h"
-
+#include "ExpLOBaccess.h"
 
 // -----------------------------------------------------------------------
 // Methods for class ex_split_bottom_tdb
@@ -163,7 +163,7 @@
 
   if (processLOB())
     {
-      glob->initLOBglobal(glob->getCliGlobals()->currContext());
+      glob->initLOBglobal(glob->getCliGlobals()->currContext(), useLibHdfs());
     }
 
   return result;
diff --git a/core/sql/executor/ex_transaction.cpp b/core/sql/executor/ex_transaction.cpp
index 0f326db..f2b2fb0 100644
--- a/core/sql/executor/ex_transaction.cpp
+++ b/core/sql/executor/ex_transaction.cpp
@@ -433,7 +433,8 @@
   short retcode = FEOK;
   if (transid_ != -1 && transtag_ != -1)
   {
-     retcode = RESUMETRANSACTION(0);
+    //     retcode = RESUMETRANSACTION(0);
+    retcode = SUSPENDTRANSACTION((short*)&transid_);
      if (retcode == FENOTRANSID)
         retcode = FEOK;
   }
diff --git a/core/sql/executor/hiveHook.cpp b/core/sql/executor/hiveHook.cpp
index aac76a9..bc3ef1b 100644
--- a/core/sql/executor/hiveHook.cpp
+++ b/core/sql/executor/hiveHook.cpp
@@ -495,47 +495,44 @@
   fieldTerminator  = '\001';  // this the Hive default ^A or ascii code 1
   recordTerminator = '\n';    // this is the Hive default
 
-  std::size_t foundB ;
   if (!findAToken(md, tblStr, pos, "serdeInfo:",
                   "populateSerDeParams::serdeInfo:###"))
     return FALSE;
 
-  std::size_t foundE = pos ;
+  std::size_t foundB = pos;
+  std::size_t foundE = pos;
+
   if (!findAToken(md, tblStr, foundE, "}),",
                   "populateSerDeParams::serDeInfo:)},###"))
     return FALSE;
   
+  NAText serdeStr = tblStr->substr(foundB, foundE-foundB);
+
   const char * nullStr = "serialization.null.format=";
-  const char * fieldStr = "field.delim" ;
-  const char * lineStr = "line.delim" ;
+  const char * fieldStr = "field.delim=" ;
+  const char * lineStr = "line.delim=" ;
 
   nullFormatSpec = FALSE;
-  foundB = tblStr->find(nullStr,pos);
-  if ((foundB != std::string::npos) && (foundB < foundE))
+  foundB = serdeStr.find(nullStr);
+  if (foundB != std::string::npos)
     {
       nullFormatSpec = TRUE;
       std::size_t foundNB = foundB + strlen(nullStr);
-      std::size_t foundNE = std::string::npos;
-      std::size_t foundNE1 = tblStr->find("}), ", foundNB);
-      std::size_t foundNE2 = tblStr->find(", ", foundNB);
-      if (foundNE1 == std::string::npos)
-        foundNE = foundNE2;
-      else if (foundNE2 == std::string::npos)
-        foundNE = foundNE1;
-      else
-        foundNE = MINOF(foundNE1, foundNE2);
-
-      if (foundNE != std::string::npos)
-        nullFormat = NAString(tblStr->substr(foundNB, (foundNE-foundNB)));
+      std::size_t foundNE = serdeStr.find(", ", foundNB);
+      if (foundNE == std::string::npos)
+        {
+          foundNE = serdeStr.length();
+        }
+      nullFormat = NAString(serdeStr.substr(foundNB, (foundNE-foundNB)));
     }
 
-  foundB = tblStr->find(fieldStr,pos);
-  if ((foundB != std::string::npos) && (foundB < foundE))
-    fieldTerminator = tblStr->at(foundB+strlen(fieldStr)+1);
-  
-  foundB = tblStr->find("line.delim=",pos);
-  if ((foundB != std::string::npos) && (foundB < foundE))
-    recordTerminator = tblStr->at(foundB+strlen(lineStr)+1);
+  std::size_t foundDelim = serdeStr.find(fieldStr);
+  if ((foundDelim != std::string::npos))
+    fieldTerminator = serdeStr.at(foundDelim+strlen(fieldStr));
+
+  foundDelim = serdeStr.find(lineStr);
+  if ((foundDelim != std::string::npos))
+    recordTerminator = serdeStr.at(foundDelim+strlen(lineStr));
   
   pos = foundE;
   
diff --git a/core/sql/exp/ExpConvMxcs.cpp b/core/sql/exp/ExpConvMxcs.cpp
index 0f7d3ee..7b9d3fb 100644
--- a/core/sql/exp/ExpConvMxcs.cpp
+++ b/core/sql/exp/ExpConvMxcs.cpp
@@ -1329,7 +1329,7 @@
 	    }
 	  else
 	    {
-	      *(UInt32 *)target = (UInt32) interm;
+              fraction = (UInt32) interm;
 	    }
 	};
 
diff --git a/core/sql/exp/ExpErrorEnums.h b/core/sql/exp/ExpErrorEnums.h
index 2068c75..ef17b71 100644
--- a/core/sql/exp/ExpErrorEnums.h
+++ b/core/sql/exp/ExpErrorEnums.h
@@ -62,8 +62,6 @@
   EXE_EXPLAIN_BAD_DATA			= 8019,
 
   EXE_INITIALIZE_MAINTAIN               = 8020,
-  EXE_PURGEDATA_CAT                     = 8021,
-  EXE_PARALLEL_PURGEDATA_FAILED         = 8022,
 
   EXE_QUERY_LIMITS_CPU                  = 8023,
   EXE_QUERY_LIMITS_CPU_DEBUG            = 8024,
@@ -164,6 +162,7 @@
   EXE_ERROR_FROM_LOB_INTERFACE          = 8442,
   EXE_INVALID_LOB_HANDLE                = 8443,
   EXE_ERROR_HDFS_SCAN                   = 8447,
+  EXE_INVALID_INTERVAL_RESULT           = 8453,
   EXE_LAST_EXPRESSIONS_ERROR		= 8499,
 
   // ---------------------------------------------------------------------
@@ -264,6 +263,11 @@
   //-------------------------------------------------------------
   EXE_INVALID_CHAR_IN_TRANSLATE_FUNC    = 8690,
 
+  //-------------------------------------------------------------
+  // Errors codes split_part function.
+  //-------------------------------------------------------------
+  EXE_INVALID_FIELD_POSITION            = 8691,
+  
   // ---------------------------------------------------------------------
   // Parallel execution
   // ---------------------------------------------------------------------
diff --git a/core/sql/exp/ExpHbaseDefs.h b/core/sql/exp/ExpHbaseDefs.h
index 598328c..b3f8475 100644
--- a/core/sql/exp/ExpHbaseDefs.h
+++ b/core/sql/exp/ExpHbaseDefs.h
@@ -74,6 +74,7 @@
     HBASE_SPLIT_POLICY                = 22,   //   "
     HBASE_CACHE_DATA_IN_L1            = 23,   // column family
     HBASE_PREFETCH_BLOCKS_ON_OPEN     = 24,   //   "
+    HBASE_HDFS_STORAGE_POLICY         = 25,   //   "
     HBASE_MAX_OPTIONS
   };
 
diff --git a/core/sql/exp/ExpLOB.cpp b/core/sql/exp/ExpLOB.cpp
index 10b2bc1..5fb0fc2 100644
--- a/core/sql/exp/ExpLOB.cpp
+++ b/core/sql/exp/ExpLOB.cpp
@@ -55,15 +55,32 @@
 #include "ex_globals.h"
 #include "ex_god.h"
 
+ExLobGlobals *ExpLOBoper::initLOBglobal(NAHeap *parentHeap, ContextCli *currContext, NABoolean useLibHdfs, NABoolean isHiveRead)
+{
+  NAHeap *lobHeap = new (parentHeap) NAHeap("LOB Heap", parentHeap);
+  ExLobGlobals *exLobGlobals = new (lobHeap) ExLobGlobals(lobHeap);
+  exLobGlobals->setUseLibHdfs(useLibHdfs);
+  exLobGlobals->initialize();
+  // initialize lob interface
+  ExpLOBoper::initLOBglobal(exLobGlobals, lobHeap, currContext, (char *)"default", (Int32)0, isHiveRead);
+  return exLobGlobals; 
+}
 
-Lng32 ExpLOBoper::initLOBglobal(ExLobGlobals *& exLobGlobals, NAHeap *parentHeap, ContextCli *currContext, char *hdfsServer ,Int32 port)
+
+Lng32 ExpLOBoper::initLOBglobal(ExLobGlobals *& exLobGlobals, NAHeap *heap, ContextCli *currContext, char *hdfsServer ,Int32 port, NABoolean isHiveRead)
 {
   // call ExeLOBinterface to initialize lob globals
-  ExpLOBinterfaceInit(exLobGlobals, parentHeap,currContext,FALSE, hdfsServer,  port);
-
+  ExpLOBinterfaceInit(exLobGlobals, heap, currContext, isHiveRead, hdfsServer, port);
   return 0;
 }
 
+void ExpLOBoper::deleteLOBglobal(ExLobGlobals *exLobGlobals, NAHeap *heap)
+{
+  NAHeap *lobHeap = exLobGlobals->getHeap();
+  NADELETE(exLobGlobals, ExLobGlobals, lobHeap);
+  NADELETE(lobHeap, NAHeap, heap);
+}
+
 char * ExpLOBoper::ExpGetLOBname(Int64 uid, Lng32 num, char * outBuf, Lng32 outBufLen)
 {
   if (outBufLen < 31)
@@ -860,7 +877,7 @@
       ExRaiseSqlError(h, diagsArea, 
 		      (ExeErrorCode)(8442), NULL, &intParam1, 
 		      &cliError, NULL, (char*)"ExpLOBInterfaceInsert",
-		      (char*)"ExpLOBInterfaceInsert",getLobErrStr(intParam1));
+		      getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
       return ex_expr::EXPR_ERROR;
     }
 
@@ -1010,7 +1027,7 @@
       ExRaiseSqlError(h, diagsArea, 
 		      (ExeErrorCode)(8442), NULL, &intParam1, 
 		      &cliError, NULL, (char*)"ExpLOBInterfaceInsert",
-		      (char*)"ExpLOBInterfaceInsert",getLobErrStr(intParam1));
+		      getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
       return ex_expr::EXPR_ERROR;
     }
 
@@ -1166,7 +1183,7 @@
       ExRaiseSqlError(h, diagsArea, 
 		      (ExeErrorCode)(8442), NULL, &intParam1, 
 		      &cliError, NULL, (char*)"ExpLOBInterfaceDelete",
-		      (char*)"ExpLOBInterfaceDelete",getLobErrStr(intParam1));
+		      getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
       return ex_expr::EXPR_ERROR;
     }
 
@@ -1472,7 +1489,7 @@
       ExRaiseSqlError(h, diagsArea, 
 		      (ExeErrorCode)(8442), NULL, &intParam1, 
 		      &cliError, NULL, (char*)"ExpLOBInterfaceUpdate",
-		      (char*)"ExpLOBInterfaceUpdate",getLobErrStr(intParam1));
+		      getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
       return ex_expr::EXPR_ERROR;
      }
 
@@ -1611,7 +1628,7 @@
        ExRaiseSqlError(h, diagsArea, 
 			  (ExeErrorCode)(8442), NULL, &intParam1, 
 			  &cliError, NULL, (char*)"ExpLOBInterfaceSelect",
-			  (char*)"ExpLOBInterfaceSelect",getLobErrStr(intParam1));
+		          getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 	  return ex_expr::EXPR_ERROR;
     }
   if(toFile())
@@ -1669,7 +1686,7 @@
 	  ExRaiseSqlError(h, diagsArea, 
 			  (ExeErrorCode)(8442), NULL, &intParam1, 
 			  &cliError, NULL, (char*)"ExpLOBInterfaceSelect",
-			  (char*)"ExpLOBInterfaceSelect",getLobErrStr(intParam1));
+		          getLobErrStr(intParam1), (char*)getSqlJniErrorStr());
 	  return ex_expr::EXPR_ERROR;
 	}
 
diff --git a/core/sql/exp/ExpLOB.h b/core/sql/exp/ExpLOB.h
index 231fa20..8764660 100644
--- a/core/sql/exp/ExpLOB.h
+++ b/core/sql/exp/ExpLOB.h
@@ -136,7 +136,9 @@
 			    char * lobLob,
 			    Int64 uid, Lng32 lobNum);
 
-  static Lng32 initLOBglobal(ExLobGlobals *& lobGlob, NAHeap *heap, ContextCli *currContext,char *server, Int32 port );
+  static Lng32 initLOBglobal(ExLobGlobals *& lobGlob, NAHeap *heap, ContextCli *currContext,char *server, Int32 port, NABoolean isHiveRead = FALSE);
+  static ExLobGlobals *initLOBglobal(NAHeap *parentHeap, ContextCli *currContext, NABoolean useLibHdfs, NABoolean isHiveRead = FALSE);
+  static void deleteLOBglobal(ExLobGlobals *lobGlob, NAHeap *parentHeap);
   static void genLobLockId(Int64 objUid,Int32 lobNum, char *llid);
 
   // Extracts values from the LOB handle stored at ptr
diff --git a/core/sql/exp/ExpLOBaccess.cpp b/core/sql/exp/ExpLOBaccess.cpp
index a804959..a24018a 100644
--- a/core/sql/exp/ExpLOBaccess.cpp
+++ b/core/sql/exp/ExpLOBaccess.cpp
@@ -85,7 +85,9 @@
     fs_(NULL),
     fdData_(NULL),
     openFlags_(0),
-    lobTrace_(FALSE)
+    lobTrace_(FALSE),
+    useLibHdfs_(FALSE),
+    hdfsClient_(NULL)    
 {
   // nothing else to do
 }
@@ -97,6 +99,10 @@
       hdfsCloseFile(fs_, fdData_);
       fdData_ = NULL;
     }
+    if (hdfsClient_ != NULL) {
+       HdfsClient::deleteInstance(hdfsClient_);
+       hdfsClient_ = NULL;
+    }
    
 }
 
@@ -113,6 +119,7 @@
   struct timespec endTime;
   Int64 secs, nsecs, totalnsecs;
  
+  useLibHdfs_ = lobGlobals->useLibHdfs_;
   if (lobStorageLocation) 
     {
       if (lobStorageLocation_.empty()) 
@@ -148,12 +155,21 @@
   hdfsPort_ = hdfsPort;
   // lobLocation_ = lobLocation;
   clock_gettime(CLOCK_MONOTONIC, &startTime);
-  
-  if (lobGlobals->getHdfsFs() == NULL)     
-    return LOB_HDFS_CONNECT_ERROR;
-  else 
-    fs_ = lobGlobals->getHdfsFs();
-    
+  lobGlobalHeap_ = lobGlobals->getHeap();    
+  HDFS_Client_RetCode hdfsClientRetcode;
+  if (useLibHdfs_) { 
+     if (lobGlobals->getHdfsFs() == NULL)     
+        return LOB_HDFS_CONNECT_ERROR;
+     else 
+        fs_ = lobGlobals->getHdfsFs();
+     hdfsClient_ = NULL;
+  }
+  else {
+     hdfsClient_ = HdfsClient::newInstance(lobGlobalHeap_, NULL, hdfsClientRetcode);
+     fs_ = NULL;
+     if (hdfsClient_ == NULL)
+        return LOB_HDFS_CONNECT_ERROR;
+  }
 
   clock_gettime(CLOCK_MONOTONIC, &endTime);
 
@@ -166,7 +182,20 @@
     }
   totalnsecs = (secs * NUM_NSECS_IN_SEC) + nsecs;
   stats_.hdfsConnectionTime += totalnsecs;
-    
+   
+  if (! useLibHdfs_) {
+     if (mode == EX_LOB_CREATE) {
+        hdfsClientRetcode = hdfsClient_->hdfsCreate(lobDataFile_.data(), FALSE, FALSE); 
+        if (hdfsClientRetcode != HDFS_CLIENT_OK)
+            return LOB_DATA_FILE_CREATE_ERROR;
+     }
+     hdfsClientRetcode = hdfsClient_->hdfsOpen(lobDataFile_.data(), FALSE);
+     if (hdfsClientRetcode != HDFS_CLIENT_OK)
+        return LOB_DATA_FILE_OPEN_ERROR;
+     fdData_ = NULL;
+  }
+  else
+  {
   if (mode == EX_LOB_CREATE) 
     { 
       // check if file is already created
@@ -184,9 +213,8 @@
 	}
       hdfsCloseFile(fs_, fdData_);
       fdData_ = NULL;
-     
     }
-  lobGlobalHeap_ = lobGlobals->getHeap();    
+  }
   return LOB_OPER_OK;
     
 }
@@ -297,6 +325,16 @@
 Ex_Lob_Error ExLob::writeData(Int64 offset, char *data, Int32 size, Int64 &operLen)
 { 
     Ex_Lob_Error err;
+    HDFS_Client_RetCode hdfsClientRetcode = HDFS_CLIENT_OK;
+    Int64 writeOffset;
+
+    if (! useLibHdfs_ ) {
+       writeOffset = hdfsClient_->hdfsWriteImmediate(data, size, hdfsClientRetcode); 
+       if (hdfsClientRetcode != HDFS_CLIENT_OK)
+          return LOB_DATA_WRITE_ERROR;
+       operLen = size;
+       return LOB_OPER_OK;
+    }
     lobDebugInfo("In ExLob::writeData",0,__LINE__,lobTrace_);
     if (!fdData_ || (openFlags_ != (O_WRONLY | O_APPEND))) // file is not open for write
     {
@@ -329,7 +367,8 @@
                                     int bufferSize , short replication , int blockSize)
 { 
     Ex_Lob_Error err;
-
+    if (! useLibHdfs_)
+       return writeData(0,data, size, operLen);
 
     if (!fdData_ || (openFlags_ != (O_WRONLY | O_APPEND))) // file is not open for write
     {
@@ -424,7 +463,14 @@
                                    ExLobGlobals *lobGlobals)
 {
   int retcode = 0;
-
+  HDFS_Client_RetCode hdfsClientRetcode;
+  if (! useLibHdfs_) {
+     hdfsClientRetcode = HdfsClient::hdfsDeletePath(dirPath);
+     if (hdfsClientRetcode != HDFS_CLIENT_OK)
+        return LOB_DATA_FILE_DELETE_ERROR;
+     return LOB_OPER_OK;
+  }
+      
   hdfsFileInfo *fileInfos = hdfsGetPathInfo(fs_, dirPath);
   if (fileInfos == NULL)
     {
@@ -521,8 +567,16 @@
    lobDebugInfo("In ExLob::statSourceFile",0,__LINE__,lobTrace_);
    // check if the source file is a hdfs file or from local file system.
   LobInputOutputFileType srcType = fileType(srcfile);
+   HDFS_Client_RetCode hdfsClientRetcode;
    if (srcType == HDFS_FILE)
      {
+       if (! useLibHdfs_) {
+          sourceEOF = HdfsClient::hdfsSize(srcfile, hdfsClientRetcode);
+          if (hdfsClientRetcode != HDFS_CLIENT_OK)
+             return LOB_SOURCE_FILE_OPEN_ERROR;
+          ex_assert(sourceEOF >= 0, "Offset is -1 possibly due to path being directory");
+       }
+       else {
        hdfsFile sourceFile = hdfsOpenFile(fs_,srcfile,O_RDONLY,0,0,0);   
        if (!sourceFile)	           
          return LOB_SOURCE_FILE_OPEN_ERROR;
@@ -536,8 +590,8 @@
        
        str_sprintf(logBuf,"Returning EOF of %ld for file %s", sourceEOF,srcfile);
        lobDebugInfo(logBuf, 0,__LINE__,lobTrace_);
+       }
      }
-
    else if (srcType == LOCAL_FILE)
      {
        int openFlags = O_RDONLY;
@@ -554,11 +608,7 @@
        if (stat(srcfile, &statbuf) != 0) {
 	 return LOB_SOURCE_FILE_STAT_ERROR;
        }
-
        sourceEOF = statbuf.st_size;
-
-       
-
        flock(fdSrcFile, LOCK_UN);
        close(fdSrcFile);
        str_sprintf(logBuf,"Returning EOF of %ld for file %s", sourceEOF,srcfile);
@@ -638,8 +688,32 @@
      char logBuf[4096];
      str_sprintf(logBuf,"Calling ::readHdfsSourceFile: %s Offset:%ld, Size: %d",srcfile, offset,size);
      lobDebugInfo(logBuf, 0,__LINE__,lobTrace_);
-  
-   
+     HDFS_Client_RetCode hdfsClientRetcode; 
+     Int64 bytesRead;
+     if (!useLibHdfs_) {
+        HdfsClient *srcHdfsClient = HdfsClient::newInstance(getLobGlobalHeap(), NULL, hdfsClientRetcode);
+        ex_assert(hdfsClientRetcode == HDFS_CLIENT_OK, "Internal error: HdfsClient::newInstance returned an error");
+        hdfsClientRetcode  = srcHdfsClient->hdfsOpen(srcfile, FALSE);
+        if (hdfsClientRetcode != HDFS_CLIENT_OK) {
+           HdfsClient::deleteInstance(srcHdfsClient);
+           return LOB_SOURCE_FILE_OPEN_ERROR;
+        }
+        fileData = (char *) (getLobGlobalHeap())->allocateMemory(size);
+        if (fileData == (char *)-1) {
+           HdfsClient::deleteInstance(srcHdfsClient);
+           return LOB_SOURCE_DATA_ALLOC_ERROR;
+        }
+        bytesRead = srcHdfsClient->hdfsRead(offset, fileData, size, hdfsClientRetcode);
+        if (hdfsClientRetcode != HDFS_CLIENT_OK) {
+           HdfsClient::deleteInstance(srcHdfsClient);
+           getLobGlobalHeap()->deallocateMemory(fileData);
+           return LOB_SOURCE_FILE_READ_ERROR;
+        }  
+        size = bytesRead;
+        // Memory growth/leak
+        HdfsClient::deleteInstance(srcHdfsClient);
+        return LOB_OPER_OK;
+     }
      int openFlags = O_RDONLY;
      hdfsFile fdSrcFile = hdfsOpenFile(fs_,srcfile, openFlags,0,0,0);
      if (fdSrcFile == NULL) 
@@ -662,6 +736,7 @@
      
      return LOB_OPER_OK;
  }
+
 Ex_Lob_Error ExLob::readLocalSourceFile(char *srcfile, char *&fileData, Int32 &size, Int64 offset)
    {  
      char logBuf[4096];
@@ -952,11 +1027,14 @@
     Ex_Lob_Error err=LOB_OPER_OK; 
     char logBuf[4096];
     lobDebugInfo("In ExLob::writeLobData",0,__LINE__,lobTrace_);
+    HDFS_Client_RetCode hdfsClientRetcode = HDFS_CLIENT_OK;
+    Int64 writeOffset;
+
     char *inputAddr = source;
     Int64 readOffset = 0;
     Int32 allocMemSize = 0;
     Int64 inputSize = sourceLen;
-    Int64 writeOffset = tgtOffset;
+    writeOffset = tgtOffset;
     if (subOperation == Lob_External_File)
       return LOB_OPER_OK;
     while(inputSize > 0)
@@ -1003,8 +1081,10 @@
 	  }
       }
     lobDebugInfo("Leaving ExLob::writeLobData",0,__LINE__,lobTrace_);	
-    hdfsCloseFile(fs_, fdData_);
-    fdData_=NULL;
+    if (useLibHdfs_) {
+       hdfsCloseFile(fs_, fdData_);
+       fdData_=NULL;
+    }
     return err;
 }
 
@@ -1439,6 +1519,13 @@
 Ex_Lob_Error ExLob::purgeLob()
 {
     char logBuf[4096];
+    if (! useLibHdfs_) {
+       HDFS_Client_RetCode hdfsClientRetcode;
+       hdfsClientRetcode = HdfsClient::hdfsDeletePath(lobDataFile_.data());
+       if (hdfsClientRetcode != HDFS_CLIENT_OK)
+	  return LOB_DATA_FILE_DELETE_ERROR;
+       return LOB_OPER_OK;
+    }
      if (hdfsDelete(fs_, lobDataFile_.data(), 0) != 0)
        {
          // extract a substring small enough to fit into logBuf
@@ -1693,6 +1780,27 @@
     char logBuf[4096];
     lobDebugInfo("In ExLob::allocateDesc",0,__LINE__,lobTrace_);
     Int32 openFlags = O_RDONLY ;   
+    HDFS_Client_RetCode hdfsClientRetcode;
+
+    if (! useLibHdfs_) {
+       if (size == 0) {
+          // Delete and Create the Hdfs file by passing overwrite to TRUE
+          hdfsClientRetcode = hdfsClient_->hdfsCreate(lobDataFile_.data(), TRUE, FALSE); 
+          if (hdfsClientRetcode != HDFS_CLIENT_OK)
+             return LOB_DATA_FILE_WRITE_ERROR;
+          else {
+             dataOffset = 0;
+             return LOB_OPER_OK; 
+          }
+       }
+       else {
+         dataOffset = hdfsClient_->hdfsSize(hdfsClientRetcode); 
+         if (hdfsClientRetcode != HDFS_CLIENT_OK)
+            return LOB_DATA_FILE_WRITE_ERROR;
+         ex_assert(dataOffset >= 0, "Offset is -1 possibly due to path being directory");
+         return  LOB_OPER_OK;
+       }
+    }
     if (size == 0) //we are trying to empty this lob.
       {
         //rename lob datafile
@@ -1793,12 +1901,13 @@
      
       return LOB_OPER_OK;    
 }
+
 Ex_Lob_Error ExLob::compactLobDataFile(ExLobInMemoryDescChunksEntry *dcArray,Int32 numEntries)
 {
   Ex_Lob_Error rc = LOB_OPER_OK;
   char logBuf[4096];
   lobDebugInfo("In ExLob::compactLobDataFile",0,__LINE__,lobTrace_);
-  Int64 maxMemChunk = 100*1024*1024; //100 MB limit for intermediate buffer for transfering data
+  Int64 maxMemChunk = 64*1024*1024; //64 MB limit for intermediate buffer for transfering data
 
   // make some temporary file names
   size_t len = lobDataFile_.length();
@@ -1827,14 +1936,15 @@
               lobDataFileSubstr,tmpLobDataFileSubstr, saveLobDataFileSubstr);
 
   lobDebugInfo(logBuf,0,__LINE__,lobTrace_);
-  hdfsFS fs = hdfsConnect(hdfsServer_,hdfsPort_);
-  if (fs == NULL)
-    return LOB_DATA_FILE_OPEN_ERROR;
+
+  HDFS_Client_RetCode hdfsClientRetcode = HDFS_CLIENT_OK;
+  HdfsClient *srcHdfsClient = HdfsClient::newInstance(getLobGlobalHeap(), NULL, hdfsClientRetcode);
+  ex_assert(hdfsClientRetcode == HDFS_CLIENT_OK, "Internal error: HdfsClient::newInstance returned an error");
+  HdfsClient *dstHdfsClient = HdfsClient::newInstance(getLobGlobalHeap(), NULL, hdfsClientRetcode);
+  ex_assert(hdfsClientRetcode == HDFS_CLIENT_OK, "Internal error: HdfsClient::newInstance returned an error");
   
- 
-  hdfsFile  fdData = hdfsOpenFile(fs, lobDataFile_.data(), O_RDONLY, 0, 0,0);
-  
-  if (!fdData)
+  hdfsClientRetcode  = srcHdfsClient->hdfsOpen(lobDataFile_.data(), FALSE); 
+  if (hdfsClientRetcode != HDFS_CLIENT_OK)
     {
       // extract substring small enough to fit in logBuf
       len = MINOF(lobDataFile_.length(),sizeof(logBuf) - 40); 
@@ -1844,14 +1954,11 @@
 
       str_sprintf(logBuf,"Could not open file:%s",lobDataFileSubstr2);
       lobDebugInfo(logBuf,0,__LINE__,lobTrace_);
-      hdfsCloseFile(fs,fdData);
-      fdData = NULL;
       return LOB_DATA_FILE_OPEN_ERROR;
     }
-                          
         
-  hdfsFile fdTemp = hdfsOpenFile(fs, tmpLobDataFile,O_WRONLY|O_CREAT,0,0,0);
-  if (!fdTemp) 
+  hdfsClientRetcode  = dstHdfsClient->hdfsCreate(tmpLobDataFile, TRUE, FALSE); 
+  if (hdfsClientRetcode != HDFS_CLIENT_OK)
     {
       // extract substring small enough to fit in logBuf
       len = MINOF(sizeof(tmpLobDataFile),sizeof(logBuf)/3 - 20); 
@@ -1861,8 +1968,8 @@
 
       str_sprintf(logBuf,"Could not open file:%s",tmpLobDataFileSubstr2);
       lobDebugInfo(logBuf,0,__LINE__,lobTrace_);
-      hdfsCloseFile(fs,fdTemp);
-      fdTemp = NULL;
+      srcHdfsClient->hdfsClose();
+      HdfsClient::deleteInstance(srcHdfsClient);
       return LOB_DATA_FILE_OPEN_ERROR;
     }
 
@@ -1871,112 +1978,86 @@
    Int64 bytesWritten = 0;
    Int64 size = 0;
    Int64 chunkLen = 0;
+   Int64 readLen = 0;
+   Int64 offset;
    char * tgt = NULL;
-   while (i < numEntries)
-     {
-       chunkLen = dcArray[i].getChunkLen();
-       if (chunkLen > maxMemChunk)
-         {
-           tgt = (char *)(getLobGlobalHeap())->allocateMemory(maxMemChunk);
-           while (chunkLen > maxMemChunk)
-             {             
-               bytesRead = hdfsPread(fs,fdData,dcArray[i].getCurrentOffset(),tgt,maxMemChunk);
-               if (bytesRead != maxMemChunk)
-                 {
-                   lobDebugInfo("Problem reading from  data file",0,__LINE__,lobTrace_);
-                   getLobGlobalHeap()->deallocateMemory(tgt);
-                   return LOB_DATA_READ_ERROR;
-                 }
-               bytesWritten = hdfsWrite(fs,fdTemp, tgt,maxMemChunk);
-               if (bytesWritten != size)
-                 {
-                   lobDebugInfo("Problem writing temp data file",0,__LINE__,lobTrace_);
-                   getLobGlobalHeap()->deallocateMemory(tgt);
-                   return LOB_TARGET_FILE_WRITE_ERROR;
-                 }
-               chunkLen -= maxMemChunk;
-             }
-          
-         }
-       else
-         {
-           tgt = (char *)(getLobGlobalHeap())->allocateMemory(chunkLen);
-            bytesRead = hdfsPread(fs,fdData,dcArray[i].getCurrentOffset(),tgt,chunkLen);
-               if (bytesRead != chunkLen)
-                 {
-                   lobDebugInfo("Problem reading from  data file",0,__LINE__,lobTrace_);
-                   getLobGlobalHeap()->deallocateMemory(tgt);
-                   return LOB_DATA_READ_ERROR;
-                 }
-               bytesWritten = hdfsWrite(fs,fdTemp, tgt,chunkLen);
-               if (bytesWritten != chunkLen)
-                 {
-                   lobDebugInfo("Problem writing to temp data file",0,__LINE__,lobTrace_);
-                   getLobGlobalHeap()->deallocateMemory(tgt);
-                   return LOB_TARGET_FILE_WRITE_ERROR;
-                 }
-         }
-       if (hdfsFlush(fs, fdTemp)) {
-          lobDebugInfo("Problem flushing to temp data file",0,__LINE__,lobTrace_);
-         return LOB_DATA_FLUSH_ERROR;
+   Ex_Lob_Error  saveError = LOB_OPER_OK;
+   tgt = (char *)(getLobGlobalHeap())->allocateMemory(maxMemChunk);
+   while ((i < numEntries) && (saveError == LOB_OPER_OK)) 
+   {
+       readLen = dcArray[i].getChunkLen();
+       offset = dcArray[i].getCurrentOffset(); 
+       while (readLen > 0) 
+       {             
+          if (readLen > maxMemChunk)
+             chunkLen = maxMemChunk;
+          else
+             chunkLen = readLen;  
+          bytesRead = srcHdfsClient->hdfsRead(offset, tgt, chunkLen, hdfsClientRetcode);
+          if (hdfsClientRetcode != HDFS_CLIENT_OK) {
+             lobDebugInfo("Problem reading from  data file",0,__LINE__,lobTrace_);
+             saveError = LOB_SOURCE_FILE_READ_ERROR;
+             break;
+          }
+          bytesWritten = dstHdfsClient->hdfsWrite(tgt, chunkLen, hdfsClientRetcode);
+          if (hdfsClientRetcode != HDFS_CLIENT_OK || bytesWritten != chunkLen) {
+             lobDebugInfo("Problem writing temp data file",0,__LINE__,lobTrace_);
+             saveError = LOB_DATA_FILE_WRITE_ERROR;
+             break;
+          }
+          readLen -= chunkLen;
+          offset += chunkLen;
        }
-       getLobGlobalHeap()->deallocateMemory(tgt);
        i++;
-     }
-   hdfsCloseFile(fs,fdTemp);
-   hdfsCloseFile(fs,fdData);
-  
+   }
+   getLobGlobalHeap()->deallocateMemory(tgt);
+   srcHdfsClient->hdfsClose(); 
+   dstHdfsClient->hdfsClose();  
+   HdfsClient::deleteInstance(srcHdfsClient);
+   HdfsClient::deleteInstance(dstHdfsClient);
+   if (saveError != LOB_OPER_OK)
+      return saveError;
    //Now save the data file and rename the tempfile to the original datafile
 
-   Int32 rc2 = hdfsRename(fs,lobDataFile_.data(),saveLobDataFile);
-   if (rc2 == -1)
-     {
+   hdfsClientRetcode = HdfsClient::hdfsRename(lobDataFile_.data(),saveLobDataFile);
+   if (hdfsClientRetcode != HDFS_CLIENT_OK) {
        lobDebugInfo("Problem renaming datafile to save data file",0,__LINE__,lobTrace_);
        return LOB_DATA_FILE_WRITE_ERROR;
-     }
-   rc2 = hdfsRename(fs,tmpLobDataFile, lobDataFile_.data());
-   if (rc2 == -1)
-     {
+   }
+   hdfsClientRetcode = HdfsClient::hdfsRename(tmpLobDataFile, lobDataFile_.data());
+   if (hdfsClientRetcode != HDFS_CLIENT_OK) {
        lobDebugInfo("Problem renaming temp datafile to data file",0,__LINE__,lobTrace_);
        return LOB_DATA_FILE_WRITE_ERROR;
-     }
+   }
    return LOB_OPER_OK;
 }
 
 Ex_Lob_Error ExLob::restoreLobDataFile()
 {
-  Ex_Lob_Error rc = LOB_OPER_OK;
   lobDebugInfo("In ExLob::restoreLobDataFile",0,__LINE__,lobTrace_);
-  
-  hdfsFS fs = hdfsConnect(hdfsServer_,hdfsPort_);
-  if (fs == NULL)
-    return LOB_DATA_FILE_OPEN_ERROR;
+  HDFS_Client_RetCode hdfsClientRetcode; 
   char saveLobDataFile[lobDataFile_.length() + sizeof("_save")]; // sizeof includes room for null terminator
   strcpy(saveLobDataFile,lobDataFile_.data());
   strcpy(saveLobDataFile+lobDataFile_.length(),"_save");
-  Int32 rc2 = hdfsDelete(fs,lobDataFile_.data(),FALSE);//ok to ignore error.
-  rc2 = hdfsRename(fs,saveLobDataFile, lobDataFile_.data());
-  if (rc2)
+  hdfsClientRetcode = HdfsClient::hdfsDeletePath(lobDataFile_.data());
+  hdfsClientRetcode = HdfsClient::hdfsRename(saveLobDataFile, lobDataFile_.data());
+  if (hdfsClientRetcode != HDFS_CLIENT_OK)
      {
        lobDebugInfo("Problem renaming savedatafile to data file",0,__LINE__,lobTrace_);
        return LOB_OPER_ERROR; 
      }
-  return rc;
+  return LOB_OPER_OK;
 
 } 
 
 Ex_Lob_Error ExLob::purgeBackupLobDataFile()
 {
   Ex_Lob_Error rc = LOB_OPER_OK;
-   lobDebugInfo("In ExLob::purgeBackupLobDataFile",0,__LINE__,lobTrace_);
-  hdfsFS fs = hdfsConnect(hdfsServer_,hdfsPort_);
-  if (fs == NULL)
-    return LOB_DATA_FILE_OPEN_ERROR;
+  lobDebugInfo("In ExLob::purgeBackupLobDataFile",0,__LINE__,lobTrace_);
   char saveLobDataFile[lobDataFile_.length() + sizeof("_save")]; // sizeof includes room for null terminator
   strcpy(saveLobDataFile,lobDataFile_.data());
   strcpy(saveLobDataFile+lobDataFile_.length(),"_save");
-  Int32 rc2 = hdfsDelete(fs,saveLobDataFile,FALSE);//ok to ignore error.
-   
+  HDFS_Client_RetCode hdfsClientRetcode  = HdfsClient::hdfsDeletePath(saveLobDataFile);//ok to ignore error.
   return rc;
 }
 ///////////////////////////////////////////////////////////////////////////////
@@ -2055,6 +2136,29 @@
       bytesAvailable = cursor.descSize_ - cursor.bytesRead_;
       bytesToCopy = min(bytesAvailable, tgtSize - operLen);
       offset = cursor.descOffset_ + cursor.bytesRead_;
+      if (!useLibHdfs_) {
+         HDFS_Client_RetCode hdfsClientRetcode;
+         if (storage_ == Lob_External_HDFS_File) {
+            HdfsClient *srcHdfsClient = HdfsClient::newInstance(getLobGlobalHeap(), NULL, hdfsClientRetcode);
+            ex_assert(hdfsClientRetcode == HDFS_CLIENT_OK, "Internal error: HdfsClient::newInstance returned an error");
+            hdfsClientRetcode  = srcHdfsClient->hdfsOpen(lobDataFile_.data(), FALSE);
+            if (hdfsClientRetcode != HDFS_CLIENT_OK)
+               return LOB_SOURCE_FILE_OPEN_ERROR;
+            bytesRead = srcHdfsClient->hdfsRead(offset, tgt, bytesToCopy, hdfsClientRetcode);
+            if (hdfsClientRetcode != HDFS_CLIENT_OK) {
+               HdfsClient::deleteInstance(srcHdfsClient);
+               return LOB_SOURCE_FILE_READ_ERROR;
+            } 
+            HdfsClient::deleteInstance(srcHdfsClient);
+          }
+          else {
+               bytesRead = hdfsClient_->hdfsRead(offset, tgt, bytesToCopy, hdfsClientRetcode);
+               if (hdfsClientRetcode != HDFS_CLIENT_OK)
+                  return LOB_DATA_READ_ERROR;
+          }
+      }
+      else {
+
       // #endif
 
       if (!fdData_ || (openFlags_ != O_RDONLY)) 
@@ -2089,7 +2193,7 @@
       }
       Int64 totalnsecs = (secs * NUM_NSECS_IN_SEC) + nsecs;
       stats_.CumulativeReadTime += totalnsecs;
-
+      } // useLibHdfs
       if (bytesRead == -1) {
          return LOB_DATA_READ_ERROR;
       } else if (bytesRead == 0) {
@@ -2102,9 +2206,10 @@
       operLen += bytesRead;
       tgt += bytesRead;
    }
-  
-   hdfsCloseFile(fs_, fdData_);
-   fdData_ = NULL;
+   if (useLibHdfs_) {
+      hdfsCloseFile(fs_, fdData_);
+      fdData_ = NULL;
+   }
    return LOB_OPER_OK;
 }
 
@@ -2133,6 +2238,8 @@
     return err;
   
 
+  if (useLibHdfs_) 
+  {
   if (fdData_)// we may have a stale handle. close and open to refresh 
     {
       hdfsCloseFile(fs_, fdData_);
@@ -2161,10 +2268,37 @@
           
     }
 	
-
+  } // useLibHdfs_
      
   if (!multipleChunks)
     {
+      if (! useLibHdfs_) {
+         HDFS_Client_RetCode hdfsClientRetcode;
+         Int32 readLen;
+         if (storage_ == Lob_External_HDFS_File) {
+            HdfsClient *srcHdfsClient = HdfsClient::newInstance(getLobGlobalHeap(), NULL, hdfsClientRetcode);
+            ex_assert(hdfsClientRetcode == HDFS_CLIENT_OK, "Internal error: HdfsClient::newInstance returned an error");
+            hdfsClientRetcode  = srcHdfsClient->hdfsOpen(lobDataFile_.data(), FALSE);
+            if (hdfsClientRetcode != HDFS_CLIENT_OK) {
+               HdfsClient::deleteInstance(srcHdfsClient);
+               return LOB_SOURCE_FILE_OPEN_ERROR;
+            }
+            readLen = srcHdfsClient->hdfsRead(offset, memAddr, size, hdfsClientRetcode);
+            if (hdfsClientRetcode != HDFS_CLIENT_OK) {
+               HdfsClient::deleteInstance(srcHdfsClient);
+               return LOB_SOURCE_FILE_READ_ERROR;
+            }  
+            HdfsClient::deleteInstance(srcHdfsClient);
+            operLen = readLen;
+         } 
+         else {
+            readLen = hdfsClient_->hdfsRead(offset, memAddr, size, hdfsClientRetcode);
+            if (hdfsClientRetcode != HDFS_CLIENT_OK)
+               return LOB_DATA_READ_ERROR;
+            operLen = readLen;
+         }
+         return LOB_OPER_OK;
+      }
       lobDebugInfo("Reading in single chunk",0,__LINE__,lobTrace_);
       if ((bytesRead = hdfsPread(fs_, fdData_, offset, 
 				 memAddr, size)) == -1) {
@@ -2972,28 +3106,8 @@
 
 void cleanupLOBDataDescFiles(const char *lobHdfsServer,int lobHdfsPort,const char *lobHdfsLoc)
 { 
-  int numExistingFiles=0;
-  hdfsFS fs;
-  int err = 0;
-  fs = hdfsConnect(lobHdfsServer, lobHdfsPort);
-  if (fs == NULL)
-    return;
-  // Get this list of all data and desc files in the lob sotrage location
-  hdfsFileInfo *fileInfos = hdfsListDirectory(fs, lobHdfsLoc, &numExistingFiles);
-  if (fileInfos == NULL)
-      return ;
-    
-  //Delete each one in a loop
-  for (int i = 0; i < numExistingFiles; i++)  
-    {    
-      err = hdfsDelete(fs, fileInfos[i].mName, 0);
-    }
-    
-  // *Note* : delete the memory allocated by libhdfs for the file info array  
-  if (fileInfos)
-    {
-      hdfsFreeFileInfo(fileInfos, numExistingFiles);
-    }
+  HDFS_Client_RetCode hdfsClientRetcode  = HdfsClient::hdfsDeletePath(lobHdfsLoc);//ok to ignore error.
+  return;
 }
 
 
@@ -3392,7 +3506,8 @@
     threadTraceFile_(NULL),
     lobTrace_(FALSE),
     numWorkerThreads_(0),
-    heap_(lobHeap)
+    heap_(lobHeap),
+    useLibHdfs_(FALSE)
 {
   //initialize the log file
   if (getenv("TRACE_HDFS_THREAD_ACTIONS"))
@@ -3481,17 +3596,22 @@
     //delete the lobMap AFTER the worker threads have finished their pending 
     //work since they may still be using an objetc that was fetched off the lobMap_
     if (lobMap_) 
-      {
+    {
+        lobMap_it it2; 
+        for (it2 = lobMap_->begin(); it2 != lobMap_->end() ; ++it2)
+        {
+           ExLob *lobPtr = it2->second; 
+           NADELETE(lobPtr, ExLob, heap_);
+        } 
+        lobMap_->clear();
         NADELETE(lobMap_,lobMap_t,heap_);
         lobMap_ = NULL;
-      }
+    }
     
     //msg_mon_close_process(&serverPhandle);
     if (threadTraceFile_)
       fclose(threadTraceFile_);
     threadTraceFile_ = NULL;
-
-   
 }
 
 
@@ -3504,11 +3624,6 @@
     lobMap_ = (lobMap_t *) new (getHeap())lobMap_t;  
     if (lobMap_ == NULL)
       return LOB_INIT_ERROR;
-    // No need to start them here for LOB usage.These worker threads are needed 
-    // only for hive access so moving them to the ExpLOBInterfaceInit function 
-    // where they will get started only in case of hive access.
-    // start the worker threads
-    //startWorkerThreads();
 
     return err;
 }
diff --git a/core/sql/exp/ExpLOBaccess.h b/core/sql/exp/ExpLOBaccess.h
index 3c5e93e..416c3cc 100644
--- a/core/sql/exp/ExpLOBaccess.h
+++ b/core/sql/exp/ExpLOBaccess.h
@@ -397,6 +397,10 @@
     ExLob(NAHeap * heap);  // default constructor
     virtual ~ExLob(); // default desctructor
 
+    void setUseLibHdfs(NABoolean useLibHdfs)
+       { useLibHdfs_ = useLibHdfs; } 
+
+    NABoolean useLibHdfs() { return useLibHdfs_; }
     Ex_Lob_Error initialize(const char *lobFile, Ex_Lob_Mode mode, char *dir, 
                             LobsStorage storage, char *hdfsServer, Int64 hdfsPort,
                             char *lobLocation,
@@ -515,6 +519,8 @@
     bool prefetchQueued_;
     NAHeap *lobGlobalHeap_;
     NABoolean lobTrace_;
+    NABoolean useLibHdfs_;
+    HdfsClient *hdfsClient_;
 };
 
 typedef map<string, ExLob *> lobMap_t;
@@ -619,6 +625,11 @@
     {
       return heap_;
     }
+    
+    NABoolean useLibHdfs() { return useLibHdfs_; }
+    void setUseLibHdfs(NABoolean useLibHdfs)
+       { useLibHdfs_ = useLibHdfs; } 
+
   void traceMessage(const char *logMessage, ExLobCursor *c, int line);
   
   public :
@@ -639,6 +650,7 @@
     NAHeap *heap_;
     NABoolean lobTrace_;
     long numWorkerThreads_; 
+    NABoolean useLibHdfs_;
 };
 
 
diff --git a/core/sql/exp/ExpLOBinterface.cpp b/core/sql/exp/ExpLOBinterface.cpp
index 1a6d6ed..93035ed 100644
--- a/core/sql/exp/ExpLOBinterface.cpp
+++ b/core/sql/exp/ExpLOBinterface.cpp
@@ -34,7 +34,7 @@
 #include "ExpLOBinterface.h"
 #include "ex_globals.h"
 
-Lng32 ExpLOBinterfaceInit(ExLobGlobals *& exLobGlob, NAHeap * parentHeap,
+Lng32 ExpLOBinterfaceInit(ExLobGlobals *& exLobGlob, NAHeap *lobHeap,
                           ContextCli *currContext,NABoolean isHiveRead,
                           char *hdfsServer, 
                           Int32 port)
@@ -46,8 +46,6 @@
   Ex_Lob_Error status;
   Int32 dummyParam2 = 0;
 
-  NAHeap *lobHeap = new ((NAHeap *)parentHeap) NAHeap("LOB Heap", (NAHeap *)parentHeap);
- 
   err = ExLobsOper((char*)"dummy",
 		   NULL, 0,
 		   NULL, 0, 
@@ -65,16 +63,17 @@
 		   0);
   if (exLobGlob)
     {
-    
-      if (isHiveRead)
+      if (exLobGlob->useLibHdfs_) 
+      {
+        if (isHiveRead)
         {
           ((ExLobGlobals *)exLobGlob)->startWorkerThreads();
           lobHeap->setThreadSafe();
         }
-      
-      
+      }
     }
-
+  if (exLobGlob->useLibHdfs_)
+  {
   //set hdfsConnection from context global 
   ContextCli *localContext = (ContextCli *)currContext;
   if (localContext)
@@ -89,7 +88,8 @@
           ((ExLobGlobals *)exLobGlob)->setHdfsFs(fs);
         }
     }
-
+  }
+ 
   if (err != LOB_OPER_OK)
     return err;
   else
diff --git a/core/sql/exp/ExpPCodeClauseGen.cpp b/core/sql/exp/ExpPCodeClauseGen.cpp
index 04d88e0..2d07a84 100644
--- a/core/sql/exp/ExpPCodeClauseGen.cpp
+++ b/core/sql/exp/ExpPCodeClauseGen.cpp
@@ -4797,6 +4797,7 @@
   // fractional precision - this requires slightly more work.
   if ((attrs[1]->getDatatype() != REC_DATETIME) ||
       (getExtractField() > REC_DATE_MAX_SINGLE_FIELD) ||
+      (getExtractField()>=REC_DATE_CENTURY && getExtractField()<=REC_DATE_WOM) ||
       ((getExtractField() == REC_DATE_SECOND) && (attrs[1]->getScale() > 0)))
     return ex_clause::pCodeGenerate(space, f);
 
diff --git a/core/sql/exp/ExpPackDefs.cpp b/core/sql/exp/ExpPackDefs.cpp
index b8e6d6b..617e820 100644
--- a/core/sql/exp/ExpPackDefs.cpp
+++ b/core/sql/exp/ExpPackDefs.cpp
@@ -244,6 +244,11 @@
   return packClause(space_, sizeof(ex_function_upper));
 }  
 
+Long ex_function_split_part::pack(void * space_)
+{
+  return packClause(space_, sizeof(ex_function_split_part));
+}  
+
 Long ex_function_translate::pack(void * space_)
 {
   return packClause(space_, sizeof(ex_function_translate));
diff --git a/core/sql/exp/exp_arith.cpp b/core/sql/exp/exp_arith.cpp
index efe9b92..0e08354 100644
--- a/core/sql/exp/exp_arith.cpp
+++ b/core/sql/exp/exp_arith.cpp
@@ -48,14 +48,18 @@
 #include "exp_ovfl_ptal.h"
 #include "exp_ieee.h"
 
-
-Int64 EXP_FIXED_OV_ADD(Int64 op1, Int64 op2, short * ov)
+Int64 EXP_FIXED_ARITH_OV_OPER(short operation,
+                              Int64 op1, Int64 op2, short * ov)
 {
+  if (NOT ((operation == ITM_PLUS) || (operation == ITM_MINUS) ||
+           (operation == ITM_TIMES) || (operation == ITM_DIVIDE)))
+    return -1; // invalid operation
+
   short rc = 0;
   *ov = 0;
 
-  BigNum op1BN(16, 20, 0, 0);
-  BigNum op2BN(16, 20, 0, 0);
+  BigNum op1BN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
+  BigNum op2BN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
 
   char op1BNdata[100];
   char op2BNdata[100];
@@ -79,15 +83,46 @@
   op1BN.castFrom(&op1ST, op1_data, NULL, NULL);
   op2BN.castFrom(&op2ST, op2_data, NULL, NULL);
 
-  char * add_data[3];
-  char addBNdata[100];
-  add_data[0] = addBNdata;
-  add_data[1] = op1BNdata;
-  add_data[2] = op2BNdata;
+  char * oper_data[3];
+  char operBNdata[100];
+  oper_data[0] = operBNdata;
+  oper_data[1] = op1BNdata;
+  oper_data[2] = op2BNdata;
 
-  BigNum addBN(16, 20, 0, 0);
+  BigNum operBN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
 
-  rc = addBN.add(&op1BN, &op2BN, add_data);
+  switch (operation)
+    {
+    case ITM_PLUS:
+      {
+        rc = operBN.add(&op1BN, &op2BN, oper_data);
+      }
+      break;
+
+    case ITM_MINUS:
+      {
+        rc = operBN.sub(&op1BN, &op2BN, oper_data);
+      }
+      break;
+
+    case ITM_TIMES:
+      {
+        rc = operBN.mul(&op1BN, &op2BN, oper_data);
+      }
+      break;
+
+    case ITM_DIVIDE:
+      {
+        char tempSpace[200];
+        operBN.setTempSpaceInfo(ITM_DIVIDE, (ULong)tempSpace, 200);
+        rc = operBN.div(&op1BN, &op2BN, oper_data, NULL, NULL);
+      }
+      break;
+
+    default:
+      return -1;
+    } // switch
+
   if (rc)
     {
       *ov = 1;
@@ -96,82 +131,15 @@
 
   SimpleType resultST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
 		      ExpTupleDesc::SQLMX_FORMAT,
-		      8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
+		      sizeof(Int64), 0, 0, 0, Attributes::NO_DEFAULT, 0);
   
   Int64 result;
   op1_data[0] = (char*)&result; 
-  op1_data[1] = add_data[0];
+  op1_data[1] = oper_data[0];
 
-  //  rc = addBN.castTo(&resultST, op1_data);
-  rc = convDoIt(op1_data[1], 16, REC_NUM_BIG_SIGNED, 20, 0,
-		op1_data[0],  8, REC_BIN64_SIGNED, 0, 0,
-		NULL, 0, NULL, NULL);
-
-  if (rc)
-    {
-      *ov = 1;
-      return -1;
-    }
-
-  return result;
-}
-
-Int64 EXP_FIXED_OV_SUB(Int64 op1, Int64 op2, short * ov)
-{
-  short rc = 0;
-  *ov = 0;
-
-  BigNum op1BN(16, 20, 0, 0);
-  BigNum op2BN(16, 20, 0, 0);
-
-  char op1BNdata[100];
-  char op2BNdata[100];
-
-  SimpleType op1ST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
-		   ExpTupleDesc::SQLMX_FORMAT,
-		   8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
-  SimpleType op2ST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
-		   ExpTupleDesc::SQLMX_FORMAT,
-		   8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
-
-  char * op1_data[2];
-  char * op2_data[2];
-
-  op1_data[0] = op1BNdata;
-  op1_data[1] = (char*)&op1;
-
-  op2_data[0] = op2BNdata;
-  op2_data[1] = (char*)&op2;
-
-  op1BN.castFrom(&op1ST, op1_data, NULL, NULL);
-  op2BN.castFrom(&op2ST, op2_data, NULL, NULL);
-
-  char * sub_data[3];
-  char subBNdata[100];
-  sub_data[0] = subBNdata;
-  sub_data[1] = op1BNdata;
-  sub_data[2] = op2BNdata;
-
-  BigNum subBN(16, 20, 0, 0);
-
-  rc = subBN.sub(&op1BN, &op2BN, sub_data);
-  if (rc)
-    {
-      *ov = 1;
-      return -1;
-    }
-
-  SimpleType resultST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
-		      ExpTupleDesc::SQLMX_FORMAT,
-		      8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
-  
-  Int64 result;
-  op1_data[0] = (char*)&result; 
-  op1_data[1] = sub_data[0];
-
-  //  rc = subBN.castTo(&resultST, op1_data);
-  rc = convDoIt(op1_data[1], 16, REC_NUM_BIG_SIGNED, 20, 0,
-		op1_data[0],  8, REC_BIN64_SIGNED, 0, 0,
+  rc = convDoIt(op1_data[1], BigNum::BIGNUM_TEMP_LEN, REC_NUM_BIG_SIGNED, 
+                BigNum::BIGNUM_TEMP_PRECISION, 0,
+		op1_data[0],  sizeof(Int64), REC_BIN64_SIGNED, 0, 0,
 		NULL, 0, NULL, NULL);
   if (rc)
     {
@@ -182,159 +150,48 @@
   return result;
 }
 
-Int64 EXP_FIXED_OV_MUL(Int64 op1, Int64 op2, short * ov)
+Int64 EXP_FIXED_OV_ADD(Int64 op1,Int64 op2, short * ov)
 {
-  short rc = 0;
-  *ov = 0;
-
-  BigNum op1BN(16, 38, 0, 0);
-  BigNum op2BN(16, 38, 0, 0);
-
-  char op1BNdata[100];
-  char op2BNdata[100];
-
-  SimpleType op1ST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
-		   ExpTupleDesc::SQLMX_FORMAT,
-		   8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
-  SimpleType op2ST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
-		   ExpTupleDesc::SQLMX_FORMAT,
-		   8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
-
-  char * op1_data[2];
-  char * op2_data[2];
-
-  op1_data[0] = op1BNdata;
-  op1_data[1] = (char*)&op1;
-
-  op2_data[0] = op2BNdata;
-  op2_data[1] = (char*)&op2;
-
-  op1BN.castFrom(&op1ST, op1_data, NULL, NULL);
-  op2BN.castFrom(&op2ST, op2_data, NULL, NULL);
-
-  char * mul_data[3];
-  char mulBNdata[100];
-  mul_data[0] = mulBNdata;
-  mul_data[1] = op1BNdata;
-  mul_data[2] = op2BNdata;
-
-  BigNum mulBN(16, 38, 0, 0);
-
-  rc = mulBN.mul(&op1BN, &op2BN, mul_data);
-  if (rc)
-    {
-      *ov = 1;
-      return -1;
-    }
-
-  SimpleType resultST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
-		      ExpTupleDesc::SQLMX_FORMAT,
-		      8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
-  
-  Int64 result;
-  op1_data[0] = (char*)&result; 
-  op1_data[1] = mul_data[0];
-
-  //  rc = mulBN.castTo(&resultST, op1_data);
-  rc = convDoIt(op1_data[1], 16, REC_NUM_BIG_SIGNED, 38, 0,
-		op1_data[0],  8, REC_BIN64_SIGNED, 0, 0,
-		NULL, 0, NULL, NULL);
-  if (rc)
-    {
-      *ov = 1;
-      return -1;
-    }
-
-  return result;
+  return EXP_FIXED_ARITH_OV_OPER(ITM_PLUS, op1, op2, ov);
 }
 
-Int64 EXP_FIXED_OV_DIV(Int64 op1, Int64 op2, short * ov)
+Int64 EXP_FIXED_OV_SUB(Int64 op1,Int64 op2, short * ov)
 {
-  short rc = 0;
-  *ov = 0;
-
-  BigNum op1BN(16, 38, 0, 0);
-  BigNum op2BN(16, 38, 0, 0);
-
-  char op1BNdata[100];
-  char op2BNdata[100];
-
-  SimpleType op1ST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
-		   ExpTupleDesc::SQLMX_FORMAT,
-		   8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
-  SimpleType op2ST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
-		   ExpTupleDesc::SQLMX_FORMAT,
-		   8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
-
-  char * op1_data[2];
-  char * op2_data[2];
-
-  op1_data[0] = op1BNdata;
-  op1_data[1] = (char*)&op1;
-
-  op2_data[0] = op2BNdata;
-  op2_data[1] = (char*)&op2;
-
-  op1BN.castFrom(&op1ST, op1_data, NULL, NULL);
-  op2BN.castFrom(&op2ST, op2_data, NULL, NULL);
-
-  char * div_data[3];
-  char divBNdata[100];
-  div_data[0] = divBNdata;
-  div_data[1] = op1BNdata;
-  div_data[2] = op2BNdata;
-
-  BigNum divBN(16, 38, 0, 0);
-  char tempSpace[200];
-  divBN.setTempSpaceInfo(ITM_DIVIDE, (ULong)tempSpace, 200);
-  rc = divBN.div(&op1BN, &op2BN, div_data, NULL, NULL);
-  if (rc)
-    {
-      *ov = 1;
-      return -1;
-    }
-
-  SimpleType resultST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
-		      ExpTupleDesc::SQLMX_FORMAT,
-		      8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
-  
-  Int64 result;
-  op1_data[0] = (char*)&result; 
-  op1_data[1] = div_data[0];
-
-  //rc = divBN.castTo(&resultST, op1_data);
-  rc = convDoIt(op1_data[1], 16, REC_NUM_BIG_SIGNED, 38, 0,
-		op1_data[0],  8, REC_BIN64_SIGNED, 0, 0,
-		NULL, 0, NULL, NULL);
-  if (rc)
-    {
-      *ov = 1;
-      return -1;
-    }
-
-  return result;
+  return EXP_FIXED_ARITH_OV_OPER(ITM_MINUS, op1, op2, ov);
 }
 
-//Int64 EXP_FIXED_OV_SUB(Int64 op1, Int64 op2, short * ov);
-//Int64 EXP_FIXED_OV_MUL(Int64 op1, Int64 op2, short * ov);
-//Int64 EXP_FIXED_OV_DIV(Int64 op1, Int64 op2, short * ov);
-
-
-short EXP_FIXED_BIGN_OV_MUL(Attributes * op1,
-                        Attributes * op2,
-                        char * op_data[])
+Int64 EXP_FIXED_OV_MUL(Int64 op1,Int64 op2, short * ov)
 {
+  return EXP_FIXED_ARITH_OV_OPER(ITM_TIMES, op1, op2, ov);
+}
+
+Int64 EXP_FIXED_OV_DIV(Int64 op1,Int64 op2, short * ov)
+{
+  return EXP_FIXED_ARITH_OV_OPER(ITM_DIVIDE, op1, op2, ov);
+}
+
+
+///////////////////////////////////////////////////////////////
+short EXP_BIGN_ARITH_OPER(short operation,
+                          Attributes * op1,
+                          Attributes * op2,
+                          char * op_data[])
+{
+  if (NOT ((operation == ITM_PLUS) || (operation == ITM_MINUS) ||
+           (operation == ITM_TIMES) || (operation == ITM_DIVIDE)))
+    return -1; // invalid operation
+
   short rc = 0;
-  BigNum op1BN(16, 38, 0, 0);
-  BigNum op2BN(16, 38, 0, 0);
+  BigNum op1BN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
+  BigNum op2BN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
 
   char op1BNdata[100];
   char op2BNdata[100];
 
-  char * mul_data[3];
+  char * oper_data[3];
 
   //initialize result place holder.
-  mul_data[0] = op_data[0];
+  oper_data[0] = op_data[0];
 
   //convert op1 & op2 to bignum if not already bignum
   if(op1->isSimpleType())
@@ -345,10 +202,10 @@
     rc = op1BN.castFrom(op1, op1_data, NULL, NULL);
     if(rc)
       return -1;
-    mul_data[1] = op1BNdata;
+    oper_data[1] = op1BNdata;
   }
   else
-    mul_data[1] = op_data[1]; 
+    oper_data[1] = op_data[1]; 
 
   if(op2->isSimpleType())
   {
@@ -358,84 +215,91 @@
     rc = op2BN.castFrom(op2, op2_data, NULL, NULL);
     if(rc)
       return -1;
-    mul_data[2] = op2BNdata;
+    oper_data[2] = op2BNdata;
   }
   else
-    mul_data[2] = op_data[2]; 
+    oper_data[2] = op_data[2]; 
 
-  BigNum mulBN(16, 38, 0, 0);
+  BigNum operBN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
 
-  rc = mulBN.mul(&op1BN, &op2BN, mul_data);
+  switch (operation)
+    {
+    case ITM_PLUS:
+      {
+        rc = operBN.add(&op1BN, &op2BN, oper_data);
+      }
+      break;
+
+    case ITM_MINUS:
+      {
+        rc = operBN.sub(&op1BN, &op2BN, oper_data);
+      }
+      break;
+
+    case ITM_TIMES:
+      {
+        rc = operBN.mul(&op1BN, &op2BN, oper_data);
+      }
+      break;
+
+    case ITM_DIVIDE:
+      {
+        char tempSpace[200];
+        operBN.setTempSpaceInfo(ITM_DIVIDE, (ULong)tempSpace, 200);
+
+        rc = operBN.div(&op1BN, &op2BN, oper_data, NULL, NULL);
+      }
+      break;
+
+    default:
+      return -1;
+    }
+
   if (rc)
     return -1;
 
   return 0;
 }
 
+short EXP_FIXED_BIGN_OV_ADD(Attributes * op1,
+                            Attributes * op2,
+                            char * op_data[])
+{
+  return EXP_BIGN_ARITH_OPER(ITM_PLUS, op1, op2, op_data);
+}
+
+short EXP_FIXED_BIGN_OV_SUB(Attributes * op1,
+                            Attributes * op2,
+                            char * op_data[])
+{
+  return EXP_BIGN_ARITH_OPER(ITM_MINUS, op1, op2, op_data);
+}
+
+short EXP_FIXED_BIGN_OV_MUL(Attributes * op1,
+                            Attributes * op2,
+                            char * op_data[])
+{
+  return EXP_BIGN_ARITH_OPER(ITM_TIMES, op1, op2, op_data);
+}
+
 short EXP_FIXED_BIGN_OV_DIV(Attributes * op1,
-                        Attributes * op2,
-                        char * op_data[])
+                            Attributes * op2,
+                            char * op_data[])
 {
-  short rc = 0;
-  
-  BigNum op1BN(16, 38, 0, 0);
-  BigNum op2BN(16, 38, 0, 0);
-
-  char op1BNdata[100];
-  char op2BNdata[100];
-
-  char * div_data[3];
-
-  //initialize result place holder.
-  div_data[0] = op_data[0];
-
-  //convert op1 & op2 to bignum if not already bignum
-  if(op1->isSimpleType())
-  {
-    char * op1_data[2];
-    op1_data[0] = op1BNdata;
-    op1_data[1] = op_data[1];
-    rc = op1BN.castFrom(op1, op1_data, NULL, NULL);
-    if(rc)
-      return -1;
-    div_data[1] = op1BNdata;
-  }
-  else
-    div_data[1] = op_data[1]; 
-
-  if(op2->isSimpleType())
-  {
-    char * op2_data[2];
-    op2_data[0] = op2BNdata;
-    op2_data[1] = op_data[2];
-    rc = op2BN.castFrom(op2, op2_data, NULL, NULL);
-    if(rc)
-      return -1;
-    div_data[2] = op2BNdata;
-  }
-  else
-    div_data[2] = op_data[2]; 
-
-  BigNum divBN(16, 38, 0, 0);
-  char tempSpace[200];
-  divBN.setTempSpaceInfo(ITM_DIVIDE, (ULong)tempSpace, 200);
-  rc = divBN.div(&op1BN, &op2BN, div_data, NULL, NULL);
-  if (rc)
-    return -1;
-
-  return 0;
+  return EXP_BIGN_ARITH_OPER(ITM_DIVIDE, op1, op2, op_data);
 }
 
 Int64 EXP_FIXED_BIGN_OV_MOD(Attributes * op1,
-                        Attributes * op2,
-                        char * op_data[],
-                        short * ov)
+                            Attributes * op2,
+                            char * op_data[],
+                            short * ov,
+                            Int64 * quotient)
 {
   short rc = 0;
   *ov = 0;
 
-  BigNum op1BN(16, 38, 0, 0);
-  BigNum op2BN(16, 38, 0, 0);
+  BigNum op1BN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
+  BigNum op2BN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
 
   char op1BNdata[100];
   char op2BNdata[100];
@@ -479,7 +343,7 @@
   //using basic operators:
   //z=MOD(x,y) then z = x - ((x/y)*(y))
 
-  BigNum modBN(16, 38, 0, 0);
+  BigNum modBN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
   char * temp_data[3];
   
   //calculate (x/y)
@@ -496,6 +360,26 @@
     return -1;
   }
 
+  SimpleType resultST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
+                      ExpTupleDesc::SQLMX_FORMAT,
+                      8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
+  
+  // if quotient(x/y) is to be returned, return it
+  if (quotient)
+    {
+      temp_data[0] = (char*)quotient; 
+      temp_data[1] = xByY; //mod_data[0];
+      
+      rc = convDoIt(temp_data[1], BigNum::BIGNUM_TEMP_LEN, REC_NUM_BIG_SIGNED, BigNum::BIGNUM_TEMP_PRECISION, 0,
+                    temp_data[0],  8, REC_BIN64_SIGNED, 0, 0,
+                    NULL, 0, NULL, NULL);
+      if (rc)
+        {
+          *ov = 1;
+          return -1;
+        }
+    }
+
   //calculate (x/y) * y
   char xByYTimesY[100];
   temp_data[0] = xByYTimesY;
@@ -521,16 +405,12 @@
     return -1;
   }
 
-  SimpleType resultST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
-		      ExpTupleDesc::SQLMX_FORMAT,
-		      8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
-  
   Int64 result;
   temp_data[0] = (char*)&result; 
   temp_data[1] = mod_data[0];
 
   //rc = divBN.castTo(&resultST, op1_data);
-  rc = convDoIt(temp_data[1], 16, REC_NUM_BIG_SIGNED, 38, 0,
+  rc = convDoIt(temp_data[1], BigNum::BIGNUM_TEMP_LEN, REC_NUM_BIG_SIGNED, BigNum::BIGNUM_TEMP_PRECISION, 0,
 		temp_data[0],  8, REC_BIN64_SIGNED, 0, 0,
 		NULL, 0, NULL, NULL);
   if (rc)
@@ -1124,7 +1004,7 @@
 		                         ExpTupleDesc::SQLMX_FORMAT,
 		                         8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
                           
-                          BigNum opBN(16, 38, 0, 0);                          
+                          BigNum opBN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);                          
                           
                           while(!vGT5)
 		           {
@@ -1132,8 +1012,8 @@
                             op_data[1] = (char *) &dividend;
                             op_data[2] = (char *) &multiplier; 
                             rc = EXP_FIXED_BIGN_OV_MUL(&opST,
-                                                    &opST,
-			                              op_data);
+                                                       &opST,
+                                                       op_data);
                            if (rc)
 	                    {
 	                      //end of digits.
@@ -1144,8 +1024,8 @@
                            op_data[1] = result1;
                            op_data[2] = (char *) &divisor;
                            rc = EXP_FIXED_BIGN_OV_DIV(&opBN,
-				                    &opST,
-				                    op_data);
+                                                      &opST,
+                                                      op_data);
 	                    if (rc)
 	                    {
 	                      //Something went wrong, lets consider
diff --git a/core/sql/exp/exp_bignum.h b/core/sql/exp/exp_bignum.h
index 5ae29e0..2f228c9 100644
--- a/core/sql/exp/exp_bignum.h
+++ b/core/sql/exp/exp_bignum.h
@@ -65,6 +65,11 @@
   ULong              tempSpacePtr_;         // 24-31 //Put on 8-byte boundary
 
 public:
+  // some internal computation use bignum as temp storage.
+  // Use 38 digit precision and 16 bytes length for them.
+  enum {BIGNUM_TEMP_LEN = 16 };
+  enum {BIGNUM_TEMP_PRECISION = 38 };
+
   BigNum(Lng32 length, Lng32 precision, short scale, short unSigned);
 
   BigNum();
@@ -181,10 +186,18 @@
                         char * op_data[]);
 
 Int64 EXP_FIXED_BIGN_OV_MOD(Attributes * op1,
-                        Attributes * op2,
-                        char * op_data[],
-                        short * ov);
+                            Attributes * op2,
+                            char * op_data[],
+                            short * ov,
+                            Int64 * quotient = NULL);
 
+short EXP_FIXED_BIGN_OV_ADD(Attributes * op1,
+                        Attributes * op2,
+                        char * op_data[]);
+
+short EXP_FIXED_BIGN_OV_SUB(Attributes * op1,
+                        Attributes * op2,
+                        char * op_data[]);
 
  
 
diff --git a/core/sql/exp/exp_clause.cpp b/core/sql/exp/exp_clause.cpp
index 0b918e5..d8708d0 100644
--- a/core/sql/exp/exp_clause.cpp
+++ b/core/sql/exp/exp_clause.cpp
@@ -224,6 +224,9 @@
 	case ITM_POSITION_DOUBLEBYTE:
 	  setClassID(FUNC_POSITION_DOUBLEBYTE_ID);
 	  break;
+	case ITM_SPLIT_PART:
+	  setClassID(FUNC_SPLIT_PART_ID);
+	  break;
 	case ITM_CONCAT:
 	  setClassID(FUNC_CONCAT_ID);
 	  break;
@@ -724,6 +727,9 @@
     case ex_clause::FUNC_POSITION_DOUBLEBYTE_ID:
       GetVTblPtr(vtblPtr, ex_function_position_doublebyte);
       break;
+    case ex_clause::FUNC_SPLIT_PART_ID:
+      GetVTblPtr(vtblPtr, ex_function_split_part);
+      break;
     case ex_clause::FUNC_CONCAT_ID:
       GetVTblPtr(vtblPtr, ex_function_concat);
       break;
diff --git a/core/sql/exp/exp_clause.h b/core/sql/exp/exp_clause.h
index fda7269..ad51e4f 100644
--- a/core/sql/exp/exp_clause.h
+++ b/core/sql/exp/exp_clause.h
@@ -211,7 +211,8 @@
     FUNC_AES_DECRYPT         = 130,
     FUNC_REVERSE_ID         = 131,
     FUNC_SLEEP_ID           = 132,
-    FUNC_UNIX_TIMESTAMP_ID = 133
+    FUNC_UNIX_TIMESTAMP_ID = 133,
+    FUNC_SPLIT_PART_ID     = 134
   };
 
   // max number of operands (including result) in a clause.
diff --git a/core/sql/exp/exp_conv.cpp b/core/sql/exp/exp_conv.cpp
index 41b0a67..f4265b7 100644
--- a/core/sql/exp/exp_conv.cpp
+++ b/core/sql/exp/exp_conv.cpp
@@ -11493,6 +11493,12 @@
       //move null to target
       if(tgt->getNullFlag())
       {
+        // clear diags area since this error is not being returned
+        if (diagsArea && *diagsArea && ((*diagsArea)->getNumber(DgSqlCode::ERROR_) > 0))
+          {
+            (*diagsArea)->clear();
+          }
+
         ExpTupleDesc::setNullValue( op_data[-2*MAX_OPERANDS],
                                     tgt->getNullBitIndex(),
                                     tgt->getTupleFormat() );
diff --git a/core/sql/exp/exp_datetime.cpp b/core/sql/exp/exp_datetime.cpp
index 3a899e7..926cde2 100644
--- a/core/sql/exp/exp_datetime.cpp
+++ b/core/sql/exp/exp_datetime.cpp
@@ -45,7 +45,7 @@
 #include "exp_interval.h"
 #include "exp_clause_derived.h"
 #include "NAAssert.h"
-
+#include "exp_bignum.h"
 
 
 #undef DllImport
@@ -160,10 +160,54 @@
     {ExpDatetime::DATETIME_FORMAT_NUM1,      "99:99:99:99",           11, 11},
     {ExpDatetime::DATETIME_FORMAT_NUM2,      "-99:99:99:99",          12, 12},
 
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_HH,  "HH",                     2,  2},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_HH12,"HH12",                   2,  2},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_HH24,"HH24",                   2,  2},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_MI,  "MI",                     2,  2},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_SS,  "SS",                     2,  2},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_YYYY,"YYYY",                   4,  4},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_YYY, "YYY",                    3,  3},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_YY,  "YY",                     2,  2},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_Y,   "Y",                      1,  1},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_MON, "MON",                    3,  3},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_MM,  "MM",                     2,  2},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_DY,  "DY",                     3,  3},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_DAY, "DAY",                    6,  9},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_CC,  "CC",                     2,  2},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_D,   "D",                      1,  1},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_DD,  "DD",                     2,  2},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_DDD, "DDD",                    1,  3},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_W,   "W",                      1,  1},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_WW,  "WW",                     1,  2},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_J,   "J",                      7,  7},
+    {ExpDatetime::DATETIME_FORMAT_EXTRA_Q,   "Q",                      1,  1},
+
     // formats that are replaced by one of the other formats at bind time
     {ExpDatetime::DATETIME_FORMAT_UNSPECIFIED,   "UNSPECIFIED",       11, 11}
   };
 
+UInt32 Date2Julian(int y, int m ,int d)
+{
+  int myjulian = 0;
+  int mycentury = 0;
+  if ( m <= 2)
+    {
+      m = m+13;
+      y = y+4799;
+    }
+  else
+    {
+      m = m+1;
+      y = y+4800;
+    }
+
+  mycentury = y / 100;
+  myjulian = y * 365 - 32167;
+  myjulian += y/4 - mycentury + mycentury / 4;
+  myjulian += 7834 * m / 256 + d;
+  return myjulian;
+}
+
 ExpDatetime::ExpDatetime()
 {
   setClassID(SimpleTypeID);
@@ -325,6 +369,9 @@
   return 0;
 }
 
+static const Lng32 powersOfTen[] = {1, 10 ,100, 1000, 10000, 100000, 1000000,
+                                    10000000, 100000000, 1000000000};
+
 void ExpDatetime::convertDatetimeToInterval
 ( rec_datetime_field datetimeStartField
 , rec_datetime_field datetimeEndField
@@ -332,8 +379,14 @@
 , rec_datetime_field intervalEndField
 , char *datetimeOpData
 , Int64 &interval
+, char * intervalBignum
+, NABoolean &isBignum
 ) const
 {
+  short rc = 0;
+
+  isBignum = FALSE;
+
   interval = 0;
   short year;
   char month;
@@ -375,18 +428,58 @@
       break;
     case REC_DATE_SECOND:
       interval *= 60;
+
       if (field <= datetimeEndField) {
         char second;
         str_cpy_all((char *) &second, datetimeOpData, sizeof(second));
         datetimeOpData += sizeof(second);
         interval = interval + second;
         if (fractionPrecision > 0) {
-          do {
-            interval *= 10;
-          } while (--fractionPrecision > 0);
           Lng32 fraction;
+          Int64 fraction64;
+
           str_cpy_all((char *) &fraction, datetimeOpData, sizeof(fraction));
-          interval = interval + fraction;
+
+          Int64 multiplicator = powersOfTen[fractionPrecision];
+          if (fractionPrecision <= MAX_DATETIME_MICROS_FRACT_PREC) 
+            {
+              interval *= multiplicator;
+              interval = interval + fraction;
+            }
+          else
+            {
+              // Int64 may run into an overflow if fract precision is > 6
+              // Use bignum computation to do:
+              //   interval = interval * multiplicator
+              //   interval = interval + fraction
+              SimpleType op1ST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
+                               ExpTupleDesc::SQLMX_FORMAT,
+                               8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
+
+              char *op_data[3];
+              char mulBignum[BigNum::BIGNUM_TEMP_LEN]; // 16 bytes bignum result length
+
+              op_data[0] = mulBignum; // result
+              op_data[1] = (char*) &interval;
+              op_data[2] = (char*) &multiplicator;
+              rc = EXP_FIXED_BIGN_OV_MUL(&op1ST, &op1ST, op_data);
+
+              BigNum op1BN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
+              
+              char addBignum[BigNum::BIGNUM_TEMP_LEN];
+              fraction64 = fraction;
+
+              op_data[0] = addBignum;
+              op_data[1] = mulBignum;
+              op_data[2] = (char*)&fraction64;
+              rc = EXP_FIXED_BIGN_OV_ADD(&op1BN, &op1ST, op_data);
+              
+              if (intervalBignum)
+                {
+                  str_cpy_all(intervalBignum, addBignum, BigNum::BIGNUM_TEMP_LEN);
+                  isBignum = TRUE;
+                }
+            }
         }
       }
       break;
@@ -450,11 +543,14 @@
 }
 
 short ExpDatetime::convertIntervalToDatetime(Int64 interval,
+                                             char * intervalBignum,
                                              rec_datetime_field startField,
                                              rec_datetime_field endField,
                                              short fractionPrecision,
                                              char *datetimeOpData) const
 {
+  short rc = 0;
+
   short year;
   char month;
   char day;
@@ -467,22 +563,44 @@
     switch (field) {
     case REC_DATE_SECOND:
       if (fractionPrecision > 0) {
-        Lng32 divisor = 1;
-        short fp = fractionPrecision;
-        do {
-          divisor *= 10;
-        } while (--fp > 0);
-        Int64 dividend = interval;
-        interval = dividend / (Int64) divisor;
-        dividend -= interval * (Int64) divisor;
-        //
-        // Underflow is allowed for time types, so wrap around if necessary.
-        //
-        if (dividend < 0) {
-          dividend += divisor;
-          interval -= 1;
-        }
-        fraction = int64ToInt32(dividend);
+
+        //Int64 multiplicator = powersOfTen[fractionPrecision];
+        Int64 divisor = powersOfTen[fractionPrecision];
+        Int64 dividend = 0;
+        if (fractionPrecision <= MAX_DATETIME_MICROS_FRACT_PREC)
+          {
+            Int64 dividend = interval;
+            interval = dividend / divisor;
+            dividend = dividend - (interval * divisor);
+            //
+            // Underflow is allowed for time types, so wrap around if necessary.
+            //
+            if (dividend < 0) {
+              dividend += divisor;
+              interval -= 1;
+            }
+            fraction = int64ToInt32(dividend);
+          }
+        else
+          {
+            SimpleType opST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
+                            ExpTupleDesc::SQLMX_FORMAT,
+                            8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
+            BigNum opBN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
+            
+            char *op_data[2];
+            
+            op_data[0] = intervalBignum;
+            op_data[1] = (char*) &divisor;
+            Int64 quotient = -1;
+            short ov;
+            dividend = 
+              EXP_FIXED_BIGN_OV_MOD(&opBN, &opST, op_data, &ov, &quotient);
+            interval = quotient;
+
+            fraction = int64ToInt32(dividend);
+          }
+
       }
       //
       // Underflow is allowed for time types, so wrap around if necessary.
@@ -935,6 +1053,7 @@
                                    CollHeap *heap,
                                    ComDiagsArea** diagsArea)
 {
+  short rc = 0;
 
   if (operation != DATETIME_ADD && 
       operation != DATETIME_SUB) {
@@ -1016,33 +1135,39 @@
   // (endField) as the Interval operand.  We want to make sure we
   // add/subtract MONTHs to MONTHs, etc.
   //
-  Int64 value;
+  Int64 value = -1;
+  char intervalBignum[BigNum::BIGNUM_TEMP_LEN];
+  char resultBignum[BigNum::BIGNUM_TEMP_LEN];
+  NABoolean isBignum = FALSE;
   convertDatetimeToInterval(datetimeStartField,
                             datetimeEndField,
                             datetimeOpType->getScale(),
                             intervalEndField,
                             dateTimeValue,
-                            value);
+                            value,
+                            intervalBignum,
+                            isBignum);
 
   // Perform the arithmetic operation.
   //
+  Int64 interval64 = 0;
   switch (intervalOpType->getLength()) {
   case SQL_SMALL_SIZE: {
     short interval;
     str_cpy_all((char *) &interval, intervalOpData, sizeof(interval));
-    value += ((operation == DATETIME_ADD) ? interval : -interval);
+    interval64 = interval;
     break;
   }
   case SQL_INT_SIZE: {
     Lng32 interval;
     str_cpy_all((char *) &interval, intervalOpData, sizeof(interval));
-    value += ((operation == DATETIME_ADD) ? interval : -interval);
+    interval64 = interval;
     break;
   }
   case SQL_LARGE_SIZE: {
     Int64 interval;
     str_cpy_all((char *) &interval, intervalOpData, sizeof(interval));
-    value += ((operation == DATETIME_ADD) ? interval : -interval);
+    interval64 = interval;
     break;
   }
   default:
@@ -1050,20 +1175,43 @@
     return -1;
   }
 
+  if (NOT isBignum) { // result is not a bignum  
+    value += ((operation == DATETIME_ADD) ? interval64 : -interval64);
+  } else {
+    // result is a bignum
+    char *op_data[3];
+    
+    BigNum op1BN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
+    SimpleType intST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
+                     ExpTupleDesc::SQLMX_FORMAT,
+                     8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
+
+    op_data[0] = resultBignum;
+    op_data[1] = intervalBignum;
+    op_data[2] = (char*)&interval64;
+    
+    if (operation == DATETIME_ADD) {
+      rc = EXP_FIXED_BIGN_OV_ADD(&op1BN, &intST, op_data);
+    } else {
+      rc = EXP_FIXED_BIGN_OV_SUB(&op1BN, &intST, op_data);
+    }
+  }
+
   // Underflow is ok for time only datetime types.  Arithmetic on the
   // hour field is computed modulo 24.  For datetime types containing
   // a date portion, underflow is an error.
   //
-  if ((value < 0) && (datetimeStartField < REC_DATE_HOUR)) {
+  if ((NOT isBignum) && (value < 0) && 
+      (datetimeStartField < REC_DATE_HOUR)) {
     ExRaiseSqlError(heap, diagsArea, EXE_DATETIME_FIELD_OVERFLOW);
     return -1;
   }
 
-
   // Convert result back to datetime.  Note that this is overlaying the
   // local copy of the datetime value.
   //
   if (convertIntervalToDatetime(value,
+                                (isBignum ?  resultBignum : NULL),
                                 datetimeStartField,
                                 intervalEndField,
                                 datetimeOpType->getScale(),
@@ -1115,6 +1263,8 @@
                                        CollHeap *heap,
                                        ComDiagsArea** diagsArea) const
 {
+  short rc = 0;
+
   rec_datetime_field datetimeStartField;
   rec_datetime_field datetimeEndField;
   if (getDatetimeFields(datetimeOpType->getPrecision(),
@@ -1146,20 +1296,81 @@
     }
 
   Int64 value1;
+  char intervalBignum1[BigNum::BIGNUM_TEMP_LEN];
+  NABoolean isBignum1 = FALSE;
+  NABoolean isBignum2 = FALSE;
   convertDatetimeToInterval(datetimeStartField,
                             datetimeEndField,
                             datetimeOpType->getScale(),
                             intervalEndField,
                             datetimeOpData1,
-                            value1);
+                            value1,
+                            intervalBignum1,
+                            isBignum1);
+
   Int64 value2;
+  char intervalBignum2[BigNum::BIGNUM_TEMP_LEN];
   convertDatetimeToInterval(datetimeStartField,
                             datetimeEndField,
                             datetimeOpType->getScale(),
                             intervalEndField,
                             datetimeOpData2,
-                            value2);
-  Int64 result = value1 - value2;
+                            value2,
+                            intervalBignum2,
+                            isBignum2);
+
+  Int64 result = 0;
+
+  if ((NOT isBignum1) && (NOT isBignum2)) // neither is bignum
+    result = value1 - value2;
+  else
+    {
+      BigNum opBN(BigNum::BIGNUM_TEMP_LEN, BigNum::BIGNUM_TEMP_PRECISION, 0, 0);
+      SimpleType opST(REC_BIN64_SIGNED, sizeof(Int64), 0, 0,
+                      ExpTupleDesc::SQLMX_FORMAT,
+                      8, 0, 0, 0, Attributes::NO_DEFAULT, 0);
+
+      char *op_data[3];
+
+      char resultBN[BigNum::BIGNUM_TEMP_LEN];
+      op_data[0] = resultBN;
+      op_data[1] = (isBignum1 ? intervalBignum1 : (char*)&value1);
+      op_data[2] = (isBignum2 ? intervalBignum2 : (char*)&value2);
+     
+      rc = EXP_FIXED_BIGN_OV_SUB((isBignum1 ? (Attributes*)&opBN : (Attributes*)&opST), 
+                                 (isBignum2 ? (Attributes*)&opBN : (Attributes*)&opST), 
+                                 op_data); 
+      if (rc)
+        {
+          ExRaiseSqlError(heap, diagsArea, EXE_INTERNAL_ERROR);
+          return -1;
+        }
+
+      rc = convDoIt(op_data[0], BigNum::BIGNUM_TEMP_LEN, REC_NUM_BIG_SIGNED, BigNum::BIGNUM_TEMP_PRECISION, 0,
+                    (char*)&result,  8, REC_BIN64_SIGNED, 0, 0,
+                    NULL, 0, NULL, NULL);
+      if (rc)
+        {
+          // convert interval value to ascii format
+          char invalidVal[BigNum::BIGNUM_TEMP_PRECISION+1];
+          Int32 len = BigNum::BIGNUM_TEMP_PRECISION;
+          memset(invalidVal, ' ', len);
+          convDoIt(op_data[0], BigNum::BIGNUM_TEMP_LEN, REC_NUM_BIG_SIGNED, BigNum::BIGNUM_TEMP_PRECISION, 0,
+                   invalidVal, BigNum::BIGNUM_TEMP_PRECISION, REC_BYTE_F_ASCII, 0, 0,
+                   NULL, 0, NULL, NULL);
+          len--;
+          while (invalidVal[len] == ' ')
+            len--;
+          len++;
+          invalidVal[len]  = 0;
+
+          ExRaiseSqlError(heap, diagsArea, EXE_INVALID_INTERVAL_RESULT,
+                          NULL, NULL, NULL, NULL,
+                          invalidVal);
+          return -1;
+        }
+    }
+
   //
   // Scale the result to the interval qualifier's fractional precision.
   //
@@ -1222,8 +1433,6 @@
 
   Lng32 fraction = 0;
  
-  static const Lng32 powersOfTen[] = {1, 10 ,100, 1000, 10000, 100000, 1000000};
-
   // If there is a fraction value in the destination and there is a
   // fraction value in the source, scale the fraction to the
   // destination precision.
@@ -1546,7 +1755,6 @@
     return -1;
   }
 
-
   // Skip over source fields that are not in the destination.
   //
   srcData += sizeofDatetimeFields(srcStartField, 
@@ -1841,9 +2049,9 @@
   // The maximum lengths of the various fields.  Since the value of
   // REC_DATE_YEAR is 1, the first entry is just a place holder.
   //
-  static const Lng32 maxLens[] =  { 0,    4,  2,  2,  2,  2,  2,      6 };
-  static const Lng32 minValue[] = { 0, 0001, 01, 01, 00, 00, 00, 000000 };
-  static const Lng32 maxValue[] = { 0, 9999, 12, 31, 23, 59, 59, 999999 };
+  static const Lng32 maxLens[] =  { 0,    4,  2,  2,  2,  2,  2,         9 };
+  static const Lng32 minValue[] = { 0, 0001, 01, 01, 00, 00, 00, 000000000 };
+  static const Lng32 maxValue[] = { 0, 9999, 12, 31, 23, 59, 59, 999999999 };
 
   // The length of the scanned field.
   //
@@ -2290,9 +2498,10 @@
     // timezone specified. Compute the new datetime value.
 
     // first, convert current datetime value to juliantimestamp
+    Lng32 jtsFraction = fraction / 1000;
     short timestamp[] = {
       year, month, day, hour, minute, second, 
-      (short)(fraction / 1000), (short)(fraction % 1000)
+      (short)(jtsFraction / 1000), (short)(jtsFraction % 1000)
     };
     
     short error;
@@ -2302,11 +2511,11 @@
       return -1;
     }
 
-    Int64 msec = (hh*60L + mm) * 60L * 1000000L;
+    Int64 usec = (hh*60L + mm) * 60L * 1000000L;
     if (isAdd)
-      juliantimestamp += msec;
+      juliantimestamp += usec;
     else
-      juliantimestamp -= msec;
+      juliantimestamp -= usec;
 
     INTERPRETTIMESTAMP(juliantimestamp, timestamp);
     
@@ -2340,7 +2549,7 @@
         second = (char) timestamp[5];
         *dst++ = second;
         if (scale) {
-          fraction = timestamp[6] * 1000 + timestamp[7];
+          //fraction = timestamp[6] * 1000 + timestamp[7];
           str_cpy_all(dst, (char *)&fraction, sizeof(fraction));
           dst += sizeof(fraction);
         }
@@ -3129,6 +3338,39 @@
   result += width;
 }
 
+static void
+convertDayOfWeekToStr(Lng32 value, char *&result, NABoolean bAbbreviation, UInt32 width)
+{
+  const char* dayofweek[] =
+  {
+    "SUNDAY   ",
+    "MONDAY   ",
+    "TUESDAY  ",
+    "WEDNESDAY",
+    "THURSDAY ",
+    "FRIDAY   ",
+    "SATURDAY "
+  };
+
+  const char* dayofweek_abb[] =
+  {
+    "SUN",
+    "MON",
+    "TUE",
+    "WED",
+    "THU",
+    "FRI",
+    "SAT"
+  };
+
+  if (bAbbreviation)
+    strcpy(result, dayofweek_abb[value-1]);
+  else
+    strcpy(result, dayofweek[value-1]);
+  // Update result pointer to point to end of string.
+  result += width;
+}
+
 static void 
 convertMonthToStrLongFormat(Lng32 value, char *&result, UInt32 width)
 {
@@ -3435,10 +3677,170 @@
     }
   break;
 
+  case DATETIME_FORMAT_EXTRA_HH:
+  case DATETIME_FORMAT_EXTRA_HH24:
+  case DATETIME_FORMAT_EXTRA_HH12:
+    {
+      char hour = *srcData++;
+      if ( DATETIME_FORMAT_EXTRA_HH12 == format )
+        {
+          if (hour > 12)
+            hour = hour - 12;
+        }
+      convertToAscii(hour, dstDataPtr, 2);
+      return (dstDataPtr - dstData);
+    }
+    break;
+
+  case DATETIME_FORMAT_EXTRA_MI:
+    {
+      char minute = *(srcData+1);
+      convertToAscii(minute, dstDataPtr, 2);
+      return (dstDataPtr - dstData);
+    }
+    break;
+
+  case DATETIME_FORMAT_EXTRA_SS:
+    {
+      char second = *(srcData+2);
+      convertToAscii(second, dstDataPtr, 2);
+      return (dstDataPtr - dstData);
+    }
+    break;
+
+  case DATETIME_FORMAT_EXTRA_YYYY:
+  case DATETIME_FORMAT_EXTRA_YYY:
+  case DATETIME_FORMAT_EXTRA_YY:
+  case DATETIME_FORMAT_EXTRA_Y:
+    {
+      UInt32 nw = 4; //DATETIME_FORMAT_EXTRA_YYYY
+      if ( DATETIME_FORMAT_EXTRA_YYY == format )
+        {
+          nw = 3;
+          year = year % 1000;
+        }
+      else if ( DATETIME_FORMAT_EXTRA_YY == format )
+        {
+          nw = 2;
+          year = year % 100;
+        }
+      else if ( DATETIME_FORMAT_EXTRA_Y == format )
+        {
+          nw = 1;
+          year = year % 10;
+        }
+      convertToAscii(year, dstDataPtr, nw);
+      return (dstDataPtr - dstData);
+    }
+    break;
+  case DATETIME_FORMAT_EXTRA_CC:
+    {
+      year = (year+99)/100;
+      convertToAscii(year, dstDataPtr,2);
+      return (dstDataPtr - dstData);
+    }
+    break;
+  case DATETIME_FORMAT_EXTRA_MON:
+  case DATETIME_FORMAT_EXTRA_MM:
+    {
+      if (DATETIME_FORMAT_EXTRA_MM == format)
+        convertToAscii(month, dstDataPtr,2);
+      else if (DATETIME_FORMAT_EXTRA_MON == format)
+        {
+          if (0 == month)
+            return -1;
+          convertMonthToStr(month, dstDataPtr, 3);
+        }
+      return (dstDataPtr - dstData);
+    }
+    break;
+  case DATETIME_FORMAT_EXTRA_DY:
+  case DATETIME_FORMAT_EXTRA_DAY:
+  case DATETIME_FORMAT_EXTRA_D:
+    {
+      Int64 interval = getTotalDays(year, month, day);
+      short dayofweek = (short)(((interval + 1) % 7) + 1);
+      if (DATETIME_FORMAT_EXTRA_D == format)
+        {
+          convertToAscii(dayofweek,dstDataPtr,1);
+        }
+      else if (DATETIME_FORMAT_EXTRA_DAY == format
+               || DATETIME_FORMAT_EXTRA_DY == format)
+        {
+          if (0 == day)
+            return -1;
+          //SUNDAY or SUN
+          NABoolean bAbbr = (DATETIME_FORMAT_EXTRA_DY == format ? TRUE:FALSE);
+          UInt32 width = 9;
+          if (bAbbr)
+            width = 3;
+          convertDayOfWeekToStr(dayofweek, dstDataPtr, bAbbr, width);
+        }
+      return (dstDataPtr - dstData);
+    }
+    break;
+  case DATETIME_FORMAT_EXTRA_DD:
+    {
+      convertToAscii(day, dstDataPtr, 2);
+      return (dstDataPtr - dstData);
+    }
+    break;
+  case DATETIME_FORMAT_EXTRA_DDD:
+    {
+      int dayofyear = 0;
+      if( day )
+        dayofyear = Date2Julian(year,month,day)-Date2Julian(year,1,1)+1;
+      convertToAscii(dayofyear,dstDataPtr,3);
+      return (dstDataPtr - dstData);
+    }
+    break;
+  case DATETIME_FORMAT_EXTRA_W:
+    {
+      int weekofmonth = 0;
+      if (day)
+        weekofmonth = (day-1)/7+1;
+      convertToAscii(weekofmonth,dstDataPtr,1);
+      return (dstDataPtr - dstData);
+    }
+    break;
+  case DATETIME_FORMAT_EXTRA_WW:
+    {
+      //same with built-in function week
+      int weekofmonth = 0;
+      if ( day )
+        {
+          Int64 interval = getTotalDays(year, 1, 1);
+          int dayofweek = (int)(((interval + 1) % 7) + 1);
+          int dayofyear = Date2Julian(year,month,day)-Date2Julian(year,1,1)+1;
+          weekofmonth = (dayofyear-1+dayofweek-1)/7+1;
+        }
+      convertToAscii(weekofmonth,dstDataPtr,2);
+      return (dstDataPtr - dstData);
+    }
+    break;
+  case DATETIME_FORMAT_EXTRA_J:
+    {
+      int julianday = Date2Julian(year,month,day);
+      convertToAscii(julianday,dstDataPtr,7);
+      return (dstDataPtr - dstData);
+    }
+    break;
+  case DATETIME_FORMAT_EXTRA_Q:
+    {
+      if (month)
+        {
+          month = (month-1)/3+1;
+        }
+      convertToAscii(month,dstDataPtr,1);
+      return (dstDataPtr - dstData);
+    }
+    break;
+
   default:
     return -1;
   }
 
+
   // Add a delimiter between the date and time portion if required.
   //
   if (field > startField && field <= endField)
diff --git a/core/sql/exp/exp_datetime.h b/core/sql/exp/exp_datetime.h
index c665d21..3cca57f 100644
--- a/core/sql/exp/exp_datetime.h
+++ b/core/sql/exp/exp_datetime.h
@@ -44,6 +44,7 @@
 #include "exp_attrs.h"
 #include "Int64.h"
 
+UInt32 Date2Julian(int y, int m ,int d);
 
 class ExpDatetime : public SimpleType {
 
@@ -94,9 +95,32 @@
     DATETIME_FORMAT_NUM2,     // -99:99:99:99
     DATETIME_FORMAT_MAX_NUM = DATETIME_FORMAT_NUM2,
 
+    DATETIME_FORMAT_EXTRA_MIN = DATETIME_FORMAT_MAX_NUM,
+    DATETIME_FORMAT_EXTRA_HH,   // hour of day(00-23)
+    DATETIME_FORMAT_EXTRA_HH12, // hour of day(01-12)
+    DATETIME_FORMAT_EXTRA_HH24, // hour of day(00-23)
+    DATETIME_FORMAT_EXTRA_MI,   // minute(00-59)
+    DATETIME_FORMAT_EXTRA_SS,   // second(00-59)
+    DATETIME_FORMAT_EXTRA_YYYY, // year(4 digits)
+    DATETIME_FORMAT_EXTRA_YYY,  // year(last 3 digits of year)
+    DATETIME_FORMAT_EXTRA_YY,   // year(last 2 digits of year)
+    DATETIME_FORMAT_EXTRA_Y,    // year(last digit of year)
+    DATETIME_FORMAT_EXTRA_MON,  // month(3 chars in English)
+    DATETIME_FORMAT_EXTRA_MM,   // month(01-12)
+    DATETIME_FORMAT_EXTRA_DY,   // name of day(3 chars in English) exp. SUN
+    DATETIME_FORMAT_EXTRA_DAY,  // name of day,padded with blanks to length of 9 characters. exp. SUNDAY
+    DATETIME_FORMAT_EXTRA_CC,   // century
+    DATETIME_FORMAT_EXTRA_D,    // day of week(Sunday(1) to Saturday(7))
+    DATETIME_FORMAT_EXTRA_DD,   // day of month(01-31)
+    DATETIME_FORMAT_EXTRA_DDD,  // day of year(1-366)
+    DATETIME_FORMAT_EXTRA_W,    // week of month(1-5)
+    DATETIME_FORMAT_EXTRA_WW,   // week number of year(1-53)
+    DATETIME_FORMAT_EXTRA_J,    //number of days since January 1, 4713 BC
+    DATETIME_FORMAT_EXTRA_Q,    // the quarter of year(1-4)
+    DATETIME_FORMAT_EXTRA_MAX = DATETIME_FORMAT_EXTRA_Q,
     // the following are intended for binder time resolution based 
     // on operand type to one of the formats above
-    DATETIME_FORMAT_MIN_UNRESOLVED = DATETIME_FORMAT_MAX_NUM,
+    DATETIME_FORMAT_MIN_UNRESOLVED = DATETIME_FORMAT_EXTRA_MAX,
     DATETIME_FORMAT_UNSPECIFIED,  // Default format for TO_CHAR; resolved at bind time
                                   // based on the datatype of the operand
     DATETIME_FORMAT_MAX_UNRESOLVED = DATETIME_FORMAT_UNSPECIFIED,
@@ -120,7 +144,9 @@
   enum { DATETIME_MAX_NUM_FIELDS = 7 };
   enum { MAX_DATETIME_SIZE = 11 };
 
-  enum { MAX_DATETIME_FRACT_PREC = 6 };
+  enum { MAX_DATETIME_MICROS_FRACT_PREC = 6 };
+  enum { MAX_DATETIME_NANOS_FRACT_PREC = 9 };
+  enum { MAX_DATETIME_FRACT_PREC = 9 };
 
   // MAX Length of Datetime string is 50 -
   // "DATE 'YYYY-MM-DD';"
@@ -143,12 +169,17 @@
                                  rec_datetime_field &startField,
                                  rec_datetime_field &endField);
 
+  static NABoolean fractionStoredAsNanos(rec_datetime_field endField,
+                                         short fractionPrecision);
+
   void convertDatetimeToInterval(rec_datetime_field datetimeStartField,
                                  rec_datetime_field datetimeEndField,
                                  short fractionPrecision,
                                  rec_datetime_field intervalEndField,
                                  char *datetimeOpData,
-                                 Int64 &interval) const;
+                                 Int64 &interval,
+                                 char * intervalBignum,
+                                 NABoolean &isBignum) const;
 
   static short getYearMonthDay(Int64 totalDays,
                                short &year,
@@ -156,6 +187,7 @@
                                char &day);
 
   short convertIntervalToDatetime(Int64 interval,
+                                  char * intervalBignum,
                                   rec_datetime_field startField,
                                   rec_datetime_field endField,
                                   short fractionPrecision,
@@ -335,6 +367,17 @@
           }
       }
 
+    for (Lng32 i = DATETIME_FORMAT_EXTRA_MIN; i <= DATETIME_FORMAT_EXTRA_MAX; i++)
+      {
+        if (stricmp(formatStr, datetimeFormat[i].str) == 0)
+          {
+            if (datetimeFormat[i].format != i)
+              return -1;
+
+            return i;
+          }
+      }
+
     for (Lng32 i = DATETIME_FORMAT_MIN_UNRESOLVED; i <= DATETIME_FORMAT_MAX_UNRESOLVED; i++)
       {
         if (stricmp(formatStr, datetimeFormat[i].str) == 0)
@@ -373,6 +416,12 @@
             (frmt <= DATETIME_FORMAT_MAX_TIME));
   }
 
+  static NABoolean isExtraFormat(Lng32 frmt)
+  {
+    return ((frmt >= DATETIME_FORMAT_EXTRA_MIN) &&
+            (frmt <= DATETIME_FORMAT_EXTRA_MAX));
+  }
+
   static NABoolean isNumericFormat(Lng32 frmt)
   {
     return ((frmt == DATETIME_FORMAT_NUM1) || (frmt == DATETIME_FORMAT_NUM2));
diff --git a/core/sql/exp/exp_fixup.cpp b/core/sql/exp/exp_fixup.cpp
index 756612e..479ff44 100644
--- a/core/sql/exp/exp_fixup.cpp
+++ b/core/sql/exp/exp_fixup.cpp
@@ -536,9 +536,9 @@
 {
   ArithInstruction instruction = ARITH_NOT_SUPPORTED;
 
-  short type_op1;
-  short type_op2;
-  short type_result;
+  short type_op1 = -1;
+  short type_op2 = -1;
+  short type_result = -1;
   getCaseDatatypes(attr1->getDatatype(), attr1->getLength(), type_op1,
                    result->getDatatype(), result->getLength(), type_result,
                    0 /* don't need to take scale difference into account here */);
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index 9aba9b1..b859956 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -69,6 +69,7 @@
 #include "ComDiags.h"
 #include "ComAnsiNamePart.h"
 #include "ComSqlId.h"
+#include "ComCextdecs.h"
 #include "ex_globals.h"
 
 #include "NAUserId.h"
@@ -191,6 +192,7 @@
 ex_function_nullifzero::ex_function_nullifzero(){};
 ex_function_nvl::ex_function_nvl(){};
 ex_function_json_object_field_text::ex_function_json_object_field_text(){};
+ex_function_split_part::ex_function_split_part(){};
 
 ex_function_queryid_extract::ex_function_queryid_extract(){};
 ExFunctionUniqueId::ExFunctionUniqueId(){};
@@ -828,6 +830,13 @@
 
 };
 
+ex_function_split_part::ex_function_split_part(OperatorTypeEnum oper_type
+            , Attributes **attr
+                    , Space *space)
+      : ex_function_clause(oper_type, 4, attr, space)
+{
+
+}
 
 // Triggers
 ex_expr::exp_return_type ex_function_get_bit_value_at::eval(char *op_data[],
@@ -2745,6 +2754,57 @@
   return ex_expr::EXPR_OK;
 }
 
+ex_expr::exp_return_type ex_function_split_part::eval(char *op_data[]
+                               , CollHeap* heap
+                               , ComDiagsArea** diagsArea)
+{
+  size_t sourceLen = getOperand(1)->getLength(op_data[-MAX_OPERANDS+1]);
+  size_t patternLen = getOperand(2)->getLength(op_data[-MAX_OPERANDS+2]);
+  Lng32 indexOfTarget = *(Lng32 *)op_data[3];
+
+  if (indexOfTarget <= 0)
+    {
+       ExRaiseSqlError(heap, diagsArea, EXE_INVALID_FIELD_POSITION);
+       *(*diagsArea) << DgInt0(indexOfTarget);
+       return ex_expr::EXPR_ERROR;
+    }
+
+  NAString source(op_data[1], sourceLen);
+  NAString pattern(op_data[2], patternLen);
+
+  Lng32 patternCnt = 0;
+  StringPos currentTargetPos = 0;
+  StringPos pos = 0;
+
+  while (patternCnt != indexOfTarget)
+    {
+       currentTargetPos = pos;
+       pos = source.index(pattern, pos);
+       if (pos == NA_NPOS)
+        break;
+       pos = pos + patternLen;
+       patternCnt++;
+    }
+
+  size_t targetLen = 0;
+  if ((patternCnt == 0)
+        ||((patternCnt != indexOfTarget)
+             && (patternCnt != indexOfTarget - 1)))
+    op_data[0][0] = '\0';
+  else
+    {
+       if (patternCnt == indexOfTarget)
+         targetLen = pos - currentTargetPos - patternLen;
+       else  //if (patternLen == indexOfTarget-1)
+         targetLen = sourceLen - currentTargetPos;
+
+       str_cpy_all(op_data[0], op_data[1] + currentTargetPos, targetLen);
+    }
+  getOperand(0)->setVarLength(targetLen, op_data[-MAX_OPERANDS]);
+  return ex_expr::EXPR_OK;
+}
+
+
 ex_expr::exp_return_type ex_function_current::eval(char *op_data[],
 						   CollHeap*,
 						   ComDiagsArea**)
@@ -3001,6 +3061,201 @@
   return ex_expr::EXPR_OK;
 }
 
+static Int64 lcl_dayofweek(Int64 totaldays)
+{
+  return (unsigned short)((totaldays + 1) % 7) + 1;
+}
+
+static Int64 lcl_dayofyear(char year, char month, char day)
+{
+  return (Date2Julian(year,month,day)-Date2Julian(year,1,1)+1);
+}
+
+#define DAYS_PER_YEAR 365.25 /*consider leap year every four years*/
+#define MONTHS_PER_YEAR 12
+#define DAYS_PER_MONTH 30
+#define HOURS_PER_DAY 24
+#define SECONDS_PER_MINUTE 60
+#define SECONDS_PER_HOUR 3600
+#define SECONDS_PER_DAY 86400
+
+static Int64 lcl_interval(rec_datetime_field eField, Lng32 eCode, char *opdata, UInt32 nLength)
+{
+  if (!opdata)
+    return 0;
+  if ( REC_DATE_DECADE == eField && REC_INT_YEAR == eCode )
+    {
+      short nValue;
+      str_cpy_all((char *) &nValue, opdata, sizeof(nValue));
+      return nValue / 10;
+    }
+  if ( REC_DATE_QUARTER == eField && REC_INT_MONTH == eCode )
+    {
+      short nValue;
+      str_cpy_all((char *) &nValue, opdata, sizeof(nValue));
+      return (nValue-1)/3+1;
+    }
+  if ( REC_DATE_EPOCH == eField )
+    {
+      Int64 nVal = 0;
+      if ( SQL_SMALL_SIZE==nLength )
+        {
+          short value;
+          str_cpy_all((char *) &value, opdata, sizeof(value));
+          nVal = value;
+        }
+      else if ( SQL_INT_SIZE==nLength )
+        {
+          Lng32 value;
+          str_cpy_all((char *) &value, opdata, sizeof(value));
+          nVal = value;
+        }
+      else if ( SQL_LARGE_SIZE==nLength )
+        {
+          str_cpy_all((char *) &nVal, opdata, sizeof(nVal));
+        }
+
+      if ( REC_INT_YEAR==eCode )
+        return nVal*DAYS_PER_YEAR*SECONDS_PER_DAY;
+      else if ( REC_INT_MONTH==eCode
+               || REC_INT_YEAR_MONTH==eCode)
+        {
+          double result = (double)(nVal/MONTHS_PER_YEAR) * DAYS_PER_YEAR * SECONDS_PER_DAY;
+          result += (double)(nVal%MONTHS_PER_YEAR) * DAYS_PER_MONTH * SECONDS_PER_DAY;
+          return Int64(result);
+        }
+      else if ( REC_INT_DAY==eCode )
+        return nVal*SECONDS_PER_DAY;
+      else if ( REC_INT_HOUR==eCode
+               || REC_INT_DAY_HOUR==eCode )
+        return nVal*SECONDS_PER_HOUR;
+      else if ( REC_INT_MINUTE==eCode
+               || REC_INT_HOUR_MINUTE==eCode
+               || REC_INT_DAY_MINUTE==eCode)
+        return nVal*SECONDS_PER_MINUTE;
+      else if ( REC_INT_SECOND==eCode
+               || REC_INT_MINUTE_SECOND==eCode
+               || REC_INT_HOUR_SECOND==eCode
+               || REC_INT_DAY_SECOND==eCode )
+         return nVal;
+    }
+  return 0;
+}
+
+Int64 ex_function_extract::getExtraTimeValue(rec_datetime_field eField, Lng32 eCode, char *dateTime)
+{
+  short year;
+  char month;
+  char day;
+  char hour = 0;
+  char minute = 0;
+  char second = 0;
+  char millisencond = 0;
+  if (eField < REC_DATE_CENTURY || eField > REC_DATE_WOM)
+    return 0;
+  if (eCode != REC_DTCODE_DATE && eCode != REC_DTCODE_TIMESTAMP)
+    return 0;
+
+  ExpDatetime *datetimeOpType = (ExpDatetime *) getOperand(1);
+  if (!datetimeOpType)
+    return 0;
+
+  rec_datetime_field eEndFiled = REC_DATE_DAY;
+  if ( REC_DTCODE_TIMESTAMP == eCode )
+    eEndFiled = REC_DATE_SECOND;
+  size_t n = strlen(dateTime);
+  for (Int32 field = REC_DATE_YEAR; field <= eEndFiled; field++)
+    {
+      switch (field)
+        {
+          case REC_DATE_YEAR:
+            {
+              str_cpy_all((char *) &year, dateTime, sizeof(year));
+              dateTime += sizeof(year);
+            }
+            break;
+          case REC_DATE_MONTH:
+            {
+              month = *dateTime++;
+            }
+            break;
+          case REC_DATE_DAY:
+            {
+              day = *dateTime;
+              if ( REC_DATE_SECOND == eEndFiled )
+                dateTime++;
+            }
+            break;
+          case REC_DATE_HOUR:
+            {
+              hour = *dateTime++;
+            }
+            break;
+          case REC_DATE_MINUTE:
+            {
+              minute = *dateTime++;
+            }
+            break;
+          case REC_DATE_SECOND:
+            {
+              second = *dateTime;
+              if (n>7)// 2018-06-20 20:30:15.12  length = 8
+                {
+                  dateTime++;
+                  millisencond = *dateTime;
+                }
+            }
+            break;
+        }
+    }
+  switch (eField)
+    {
+      case REC_DATE_DOW:
+        {//same with built-in function dayofweek  ex_function_dayofweek::eval
+          Int64 interval = datetimeOpType->getTotalDays(year, month, day);
+          return lcl_dayofweek(interval);
+        }
+      case REC_DATE_DOY:
+        {
+          return lcl_dayofyear(year,month,day);
+        }
+      case REC_DATE_WOM:
+        {
+          return ((day-1)/7+1);
+        }
+      case REC_DATE_CENTURY:
+        {
+          return (year+99)/100;
+        }
+      case REC_DATE_DECADE:
+        {
+          return year/10;
+        }
+      case REC_DATE_WEEK:
+        {//same with built-in function week  ITM_WEEK
+          Int64 interval = datetimeOpType->getTotalDays(year, 1, 1);
+          Int64 dayofweek = lcl_dayofweek(interval);
+          Int64 dayofyear = lcl_dayofyear(year,month,day);
+          return (dayofyear-1+dayofweek-1)/7+1;
+        }
+      case REC_DATE_QUARTER:
+        {
+          return (month-1)/3+1;
+        }
+      case REC_DATE_EPOCH:
+        {
+          Int64 ndays = datetimeOpType->getTotalDays(year, month, day);
+          Int64 nJuliandays = datetimeOpType->getTotalDays(1970, 1, 1);
+          ndays = ndays - nJuliandays;
+          Int64 ntimestamp = ndays*86400+hour*3600+minute*60+second;
+          if ( 0!=millisencond )
+            ntimestamp = ntimestamp*100+millisencond;
+          return ntimestamp;
+        }
+    }
+  return 0;
+}
+
 ex_expr::exp_return_type ex_function_extract::eval(char *op_data[],
 						   CollHeap *heap,
 						   ComDiagsArea** diagsArea)
@@ -3014,6 +3269,13 @@
     rec_datetime_field extractStartField = getExtractField();
     rec_datetime_field extractEndField = extractStartField;
 
+    if ( extractStartField >=REC_DATE_CENTURY && extractStartField<=REC_DATE_WOM )
+    {
+      result = getExtraTimeValue(extractStartField, datetimeOpType->getPrecision(), datetimeOpData);
+      copyInteger (op_data[0], getOperand(0)->getLength(), &result, sizeof(result));
+      return ex_expr::EXPR_OK;
+    }
+
     if (extractStartField > REC_DATE_MAX_SINGLE_FIELD) {
       extractStartField = REC_DATE_YEAR;
       if (extractEndField == REC_DATE_YEARQUARTER_EXTRACT ||
@@ -3103,6 +3365,15 @@
       }
     }
   } else {
+    if (getExtractField() == REC_DATE_DECADE
+        || getExtractField() == REC_DATE_QUARTER
+        || getExtractField() == REC_DATE_EPOCH)
+      {
+        ExpDatetime *datetimeOpType = (ExpDatetime *) getOperand(1);
+        result = lcl_interval(getExtractField(),getOperand(1)->getDatatype(),op_data[1],getOperand(1)->getLength());
+        copyInteger (op_data[0], getOperand(0)->getLength(), &result, sizeof(result));
+        return ex_expr::EXPR_OK;
+      }
     Int64 interval;
     switch (getOperand(1)->getLength()) {
     case SQL_SMALL_SIZE: {
diff --git a/core/sql/exp/exp_function.h b/core/sql/exp/exp_function.h
index 3f6bd0c..6debaba 100644
--- a/core/sql/exp/exp_function.h
+++ b/core/sql/exp/exp_function.h
@@ -2804,7 +2804,9 @@
   ex_expr::exp_return_type pCodeGenerate(Space *space, UInt32 f);
 
   ex_expr::exp_return_type eval(char *op_data[], CollHeap*, 
-					   ComDiagsArea** = 0);  
+					   ComDiagsArea** = 0);
+
+  Int64 getExtraTimeValue(rec_datetime_field eField, Lng32 eCode, char *dateTime);
   Long pack(void *);
 
   // ---------------------------------------------------------------------
@@ -4186,7 +4188,26 @@
   // that the size of the object remains the same (and is modulo 8).
   // ---------------------------------------------------------------------
   char          fillers_[8];            // 08-15
+};
 
+class ex_function_split_part: public ex_function_clause {
+
+public:
+    ex_function_split_part(OperatorTypeEnum oper_type
+                                      , Attributes **attr
+                                      , Space *space);
+    ex_function_split_part();
+
+    ex_expr::exp_return_type eval(char *op_data[], CollHeap*, ComDiagsArea** = 0);
+    Long pack(void *);
+    virtual unsigned char getClassVersionID(){return 1;}
+    virtual void populateImageVersionIDArray()
+      {
+         setImageVersionID(2, getClassVersionID());
+         ex_function_clause::populateImageVersionIDArray();
+      }
+
+    virtual short getClassSize(){return (short)sizeof(*this);} 
 };
 
 
diff --git a/core/sql/generator/GenExplain.cpp b/core/sql/generator/GenExplain.cpp
index 6234952..f766873 100644
--- a/core/sql/generator/GenExplain.cpp
+++ b/core/sql/generator/GenExplain.cpp
@@ -1139,7 +1139,11 @@
             buffer += "object_name: unknown ";
           buffer += NAString("object_type: ") + hddl->getTypeStr() + " ";
           if (NOT hddl->getHiveDDL().isNull())
-            buffer += NAString("hive_ddl: ") + hddl->getHiveDDL() + " ";
+            {
+              if (NOT hddl->getHiveDefaultDB().isNull())
+                buffer += NAString("hive_default_db: ") + hddl->getHiveDefaultDB() + " ";
+              buffer += NAString("hive_ddl: ") + hddl->getHiveDDL() + " ";
+            }
           else
             buffer += "hive_ddl: unknown ";
         }
@@ -1153,6 +1157,29 @@
   return(explainTuple);
 }
 
+ExplainTuple *
+ExeUtilHiveTruncate::addSpecificExplainInfo(ExplainTupleMaster *explainTuple, 
+                                            ComTdb * tdb, 
+                                            Generator *generator)
+{
+  char buf[200];
+  NAString buffer;
+
+  ComTdbExeUtilHiveTruncate *ctdb = (ComTdbExeUtilHiveTruncate*)tdb;
+  if (ctdb->getTableName() != NULL)
+    buffer += NAString("table_name: ") + ctdb->getTableName() + " ";
+  else
+    buffer += "table_name: unknown ";
+  //  buffer += NAString("object_type: ") + hddl->getTypeStr() + " ";
+  if (NOT getHiveTruncQuery().isNull())
+    buffer += NAString("hive_trunc_query: ") + getHiveTruncQuery() + " ";
+  else
+    buffer += "hive_trunc_query: unknown ";
+
+  explainTuple->setDescription(buffer);
+  
+  return(explainTuple);
+}
 
 ExplainTuple*
 GroupByAgg::addSpecificExplainInfo(ExplainTupleMaster *explainTuple,
@@ -2124,6 +2151,41 @@
   return(explainTuple);
 }
 
+ExplainTuple * ExeUtilCreateTableAs::addSpecificExplainInfo( 
+     ExplainTupleMaster *explainTuple, 
+     ComTdb *tdb, 
+     Generator *generator)
+{
+
+  Lng32 maxBufLen = 2000;
+  maxBufLen = MAXOF(maxBufLen, ctQuery_.length());
+  maxBufLen = MAXOF(maxBufLen, siQuery_.length());
+  maxBufLen = MAXOF(maxBufLen, viQuery_.length());
+  maxBufLen = MAXOF(maxBufLen, usQuery_.length());
+
+  maxBufLen = MINOF(maxBufLen, 4000);
+  maxBufLen++;
+
+  char buf[maxBufLen];
+  snprintf(buf, maxBufLen, "CreateQuery: %s ", 
+           (ctQuery_.length() > 0 ? ctQuery_.data() : "NULL"));
+  explainTuple->setDescription(buf);
+
+  snprintf(buf, maxBufLen, "InsertQuery: %s ", 
+           (viQuery_.length() > 0 ? viQuery_.data() : "NULL"));
+  explainTuple->setDescription(buf);
+          
+  snprintf(buf, maxBufLen, "UpsertLoadQuery: %s ", 
+           (siQuery_.length() > 0 ? siQuery_.data() : "NULL"));
+  explainTuple->setDescription(buf);
+
+  snprintf(buf, maxBufLen, "UpdStatsQuery: %s ", 
+           (usQuery_.length() > 0 ? usQuery_.data() : "NULL"));
+  explainTuple->setDescription(buf);
+
+  return(explainTuple);
+}
+
 const char * ExplainFunc::getVirtualTableName()
 //{ return "EXPLAIN__"; }
 {return getVirtualTableNameStr();}
diff --git a/core/sql/generator/GenItemFunc.cpp b/core/sql/generator/GenItemFunc.cpp
index ca4d625..5594136 100644
--- a/core/sql/generator/GenItemFunc.cpp
+++ b/core/sql/generator/GenItemFunc.cpp
@@ -714,6 +714,13 @@
                                                         CmpCommon::getDefaultNumeric(BLOCK_ENCRYPTION_MODE));
       break;
     }
+
+    case ITM_SPLIT_PART:
+    {
+      function_clause = 
+            new (generator->getSpace()) ex_function_split_part(getOperatorType(), attr, space);
+      break;
+    }
     default:
       break;
     }
diff --git a/core/sql/generator/GenPreCode.cpp b/core/sql/generator/GenPreCode.cpp
index 77902f9..6968b96 100644
--- a/core/sql/generator/GenPreCode.cpp
+++ b/core/sql/generator/GenPreCode.cpp
@@ -2850,6 +2850,10 @@
      if (purgedata() || upgradeRepos())
         // transaction will be started and commited in called methods.
         xnCanBeStarted = FALSE;
+
+     if (initHbase() && producesOutput())  // returns status
+       xnCanBeStarted = FALSE;
+
      if ((ddlNode && ddlNode->castToStmtDDLNode() &&
           ddlNode->castToStmtDDLNode()->ddlXns()) &&
             ((ddlNode->getOperatorType() == DDL_CLEANUP_OBJECTS) ||
@@ -4200,7 +4204,8 @@
         {
           // assign individual files and blocks to each ESPs
           ((NodeMap *) getPartFunc()->getNodeMap())->assignScanInfos(hiveSearchKey_);
-          generator->setProcessLOB(TRUE);
+          if (CmpCommon::getDefault(USE_LIBHDFS) == DF_ON)
+             generator->setProcessLOB(TRUE);
 	  
 	  // flag set for HBase scan in HbaseAccess::preCodeGen
 	  // unique scan unlikely for hive scans except 
@@ -5477,7 +5482,6 @@
     return this;
 
   generator->setHiveAccess(TRUE);
-  generator->setProcessLOB(TRUE);
   return GenericUpdate::preCodeGen(generator, externalInputs, pulledNewInputs);
 }
 
@@ -5742,19 +5746,9 @@
   return this;
 }
 
-RelExpr * ExeUtilFastDelete::preCodeGen(Generator * generator,
-					const ValueIdSet & externalInputs,
-					ValueIdSet &pulledNewInputs)
-{
-  if (nodeIsPreCodeGenned())
-    return this;
-
-  return ExeUtilExpr::preCodeGen(generator,externalInputs,pulledNewInputs);
-}
-
-RelExpr * ExeUtilHiveTruncate::preCodeGen(Generator * generator,
-                                          const ValueIdSet & externalInputs,
-                                          ValueIdSet &pulledNewInputs)
+RelExpr * ExeUtilHiveTruncateLegacy::preCodeGen(Generator * generator,
+                                                const ValueIdSet & externalInputs,
+                                                ValueIdSet &pulledNewInputs)
 {
   if (nodeIsPreCodeGenned())
     return this;
diff --git a/core/sql/generator/GenRelDCL.cpp b/core/sql/generator/GenRelDCL.cpp
index 821d416..1337aea 100644
--- a/core/sql/generator/GenRelDCL.cpp
+++ b/core/sql/generator/GenRelDCL.cpp
@@ -108,6 +108,33 @@
 	value_ = "OFF";
     }
 
+  Int16 reset;
+  if (cqt == DEFAULT_)
+     reset = ((token_ == "") ? -reset_ : reset_);
+  else
+     reset = reset_;
+
+  // if this is a SET SCHEMA stmt for a Hive schema, construct the value
+  // as fully qualified schema name (cat.sch).
+  // This string will be used at runtime to set this schema in Hive
+  // if the schema exists.
+  // See ExControlTcb::work for details.
+  NABoolean isHiveSetSchema = FALSE;
+  if ((cqt == DEFAULT_) && (dynamic()) && (token_ == "SCHEMA") && (reset == 0))
+    {
+      ComSchemaName csn(value_);
+      NAString catName(csn.getCatalogNamePart().getInternalName());
+      if (catName.isNull())
+        catName = CmpCommon::getDefaultString(CATALOG);
+      if (catName == HIVE_SYSTEM_CATALOG)
+        {
+          value_ = HIVE_SYSTEM_CATALOG;
+          value_ += ".";
+          value_ += csn.getSchemaNamePart().getInternalName();
+          isHiveSetSchema = TRUE;
+        }
+    }
+
   // We need txt/tok/val stuff if in [1] a dynamic compile (EXEC SQL PREPARE),
   // OR [2] a dynamic statement even in a static compile.
   //
@@ -125,12 +152,6 @@
     v[i++] = convertNAString(value_, space);
   }
 
-  Int16 reset;
-  if (cqt == DEFAULT_)
-     reset = ((token_ == "") ? -reset_ : reset_);
-  else
-     reset = reset_;
-
   ComTdbControl * control_tdb = new(space) 
     ComTdbControl(cqt,
 		  reset,
@@ -150,6 +171,12 @@
         ActiveSchemaDB()->getDefaults().isNonResetableAttribute(v[0]);
      control_tdb->setNonResettable(nonResettable);
      control_tdb->setControlActionType(((ControlQueryDefault *)this)->getHoldOrRestoreCQD());
+
+     if (dynamic()) // dynamic() is true for SET stmts
+       {
+         control_tdb->setIsSetStmt(TRUE);
+         control_tdb->setIsHiveSetSchema(isHiveSetSchema);
+       }
   }
   // no tupps are returned 
   generator->setCriDesc((ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
diff --git a/core/sql/generator/GenRelEnforcer.cpp b/core/sql/generator/GenRelEnforcer.cpp
index bb557a1..6641833 100644
--- a/core/sql/generator/GenRelEnforcer.cpp
+++ b/core/sql/generator/GenRelEnforcer.cpp
@@ -907,8 +907,10 @@
 
     splitBottom->setCIFON( (tupleFormat == ExpTupleDesc::SQLMX_ALIGNED_FORMAT));
 
-    if (generator->processLOB())
-      splitBottom->setProcessLOB(TRUE);
+    if (generator->processLOB()) {
+       splitBottom->setProcessLOB(TRUE);
+       splitBottom->setUseLibHdfs(CmpCommon::getDefault(USE_LIBHDFS) == DF_ON);
+    }
 
     if (CmpCommon::getDefault(COMP_BOOL_153) == DF_ON)
       splitBottom->setForceSkewRoundRobin(TRUE);
diff --git a/core/sql/generator/GenRelExeUtil.cpp b/core/sql/generator/GenRelExeUtil.cpp
index 161d82e..109312a 100644
--- a/core/sql/generator/GenRelExeUtil.cpp
+++ b/core/sql/generator/GenRelExeUtil.cpp
@@ -83,6 +83,7 @@
 #include "ComSqlId.h"
 #include "MVInfo.h"
 #include "StmtDDLCreateTable.h"
+#include "CmpDDLCatErrorCodes.h"
 
 // need for authorization checks
 #include "ComUser.h"
@@ -1477,7 +1478,7 @@
   if ((CmpCommon::context()->isUninitializedSeabase()) &&
       (!Get_SqlParser_Flags(INTERNAL_QUERY_FROM_EXEUTIL)))
     {
-      if (CmpCommon::context()->uninitializedSeabaseErrNum() == -1398)
+      if (CmpCommon::context()->uninitializedSeabaseErrNum() == -TRAF_HBASE_ACCESS_ERROR)
         *CmpCommon::diags() << DgSqlCode(CmpCommon::context()->uninitializedSeabaseErrNum())
                             << DgInt0(CmpCommon::context()->hbaseErrNum())
                             << DgString0(CmpCommon::context()->hbaseErrStr());
@@ -3121,177 +3122,10 @@
 
 /////////////////////////////////////////////////////////
 //
-// ExeUtilFastDelete::codeGen()
+// ExeUtilHiveTruncateLegacy::codeGen()
 //
 /////////////////////////////////////////////////////////
-short ExeUtilFastDelete::codeGen(Generator * generator)
-{
-  ExpGenerator * expGen = generator->getExpGenerator();
-  Space * space = generator->getSpace();
-
-  char * stmtText = getStmtText();
-
-  // remove trailing blanks and append a semicolon, if one is not present.
-  char * stmt = NULL;
-  CollIndex i = 0;
-  if (stmtText)
-    {
-      i = strlen(stmtText);
-      while ((i > 0) && (getStmtText()[i-1] == ' '))
-	i--;
-      
-      if (stmtText[i-1] != ';')
-	{
-	  // add a semicolon to the end of str (required by the parser)
-	  stmt = space->allocateAlignedSpace(i+1+1);
-	  strncpy(stmt, stmtText, i);
-	  stmt[i]   = ';' ;
-	  stmt[i+1] = '\0';
-	}
-      else
-	{
-	  stmt = space->allocateAlignedSpace(i+1);
-	  strncpy(stmt, stmtText, i);
-	  stmt[i] = '\0';
-	}
-    }
-
-  // allocate a map table for the retrieved columns
-  generator->appendAtEnd();
-
-  ex_cri_desc * givenDesc
-    = generator->getCriDesc(Generator::DOWN);
-
-  ex_cri_desc * returnedDesc
-    = new(space) ex_cri_desc(givenDesc->noTuples() + 1, space);
-
-  ex_cri_desc * workCriDesc = new(space) ex_cri_desc(4, space);
-  const Int32 work_atp = 1;
-  const Int32 exe_util_row_atp_index = 2;
-
-  short rc = processOutputRow(generator, work_atp, exe_util_row_atp_index,
-                              returnedDesc);
-  if (rc)
-    {
-      return -1;
-    }
-
-  char * tablename = NULL;
-  if ((getUtilTableDesc()) && 
-      (getUtilTableDesc()->getNATable()) &&
-      (getUtilTableDesc()->getNATable()->isVolatileTable()))
-    {
-      tablename = space->AllocateAndCopyToAlignedSpace
-	(getTableName().getQualifiedNameObj().getObjectName(), 0);
-    }
-  else
-    {
-      tablename = space->AllocateAndCopyToAlignedSpace
-	(generator->genGetNameAsAnsiNAString(getTableName()), 0);
-    }
-
-  char * primaryPartnLoc = NULL;
-  if ((getUtilTableDesc()) && 
-      (getUtilTableDesc()->getNATable()) &&
-      (getUtilTableDesc()->getNATable()->isAnMV()))
-    {
-      primaryPartnLoc = space->AllocateAndCopyToAlignedSpace
-      (getUtilTableDesc()->getClusteringIndex()->getNAFileSet()->
-       getFileSetName().getQualifiedNameAsString(), 0);
-    }
-
-  Queue * deleteIndexList    = NULL;
-  if (getUtilTableDesc())
-    {
-      const LIST(IndexDesc *) indexList = 
-	getUtilTableDesc()->getIndexes();
-      if (indexList.entries() > 0)
-	deleteIndexList = new(space) Queue(space);
-      for (i=0; i<indexList.entries(); i++) 
-	{
-	  IndexDesc *index = indexList[i];
-	  
-	  // The base table itself is an index (the clustering index);
-	  // obviously IM need not deal with it.
-	  if (index->isClusteringIndex())
-	    continue;
-	  
-	  char * indexName = 
-	    space->AllocateAndCopyToAlignedSpace
-	    (index->getExtIndexName(), 0);
-	  
-	  deleteIndexList->insert(indexName);
-	}
-    }
-
-  Lng32 numEsps = -1;
-
-  ComTdbExeUtilFastDelete * exe_util_tdb = new(space) 
-    ComTdbExeUtilFastDelete(tablename, strlen(tablename),
-			    primaryPartnLoc,
-			    deleteIndexList,
-			    stmt,
-			    (stmt ? strlen(stmt) : 0),
-			    numEsps,
-			    (getUtilTableDesc() ? getUtilTableDesc()->getNATable()->
-			     objectUid().get_value() : 0),
-			    numLOBs_,
-			    NULL,
-			    0, 0, // no work cri desc
-			    (ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
-			    (ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
-			    (queue_index)getDefault(GEN_DDL_SIZE_DOWN),
-			    (queue_index)getDefault(GEN_DDL_SIZE_UP),
-			    getDefault(GEN_DDL_NUM_BUFFERS),
-			    getDefault(GEN_DDL_BUFFER_SIZE));
-
-  if (doPurgedataCat_)
-    exe_util_tdb->setDoPurgedataCat(TRUE);
-
-  if (doParallelDelete_)
-    exe_util_tdb->setDoParallelDelete(TRUE);
-
-  if (doParallelDeleteIfXn_)
-    exe_util_tdb->setDoParallelDeleteIfXn(TRUE);
-
-  if (offlineTable_)
-    exe_util_tdb->setOfflineTable(TRUE);
-
-  if (doLabelPurgedata_)
-    exe_util_tdb->setDoLabelPurgedata(TRUE);
-
-  if ((getUtilTableDesc()) && 
-      (getUtilTableDesc()->getNATable()) &&
-      (getUtilTableDesc()->getNATable()->isAnMV()))
-    exe_util_tdb->setIsMV(TRUE);
-
-  generator->initTdbFields(exe_util_tdb);
-  
-  if(!generator->explainDisabled()) {
-    generator->setExplainTuple(
-       addExplainInfo(exe_util_tdb, 0, 0, generator));
-  }
-
-  // no tupps are returned 
-  generator->setCriDesc((ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
-			Generator::UP);
-  generator->setGenObj(this, exe_util_tdb);
-
-  // Set the transaction flag.
-  //  if (xnNeeded())
-  // {
-  generator->setTransactionFlag(0); // transaction is not needed.
-  //}
-  
-  return 0;
-}
-
-/////////////////////////////////////////////////////////
-//
-// ExeUtilHiveTruncate::codeGen()
-//
-/////////////////////////////////////////////////////////
-short ExeUtilHiveTruncate::codeGen(Generator * generator)
+short ExeUtilHiveTruncateLegacy::codeGen(Generator * generator)
 {
   ExpGenerator * expGen = generator->getExpGenerator();
   Space * space = generator->getSpace();
@@ -3377,6 +3211,7 @@
                               hiveTableLocation, partn_loc,
                               hiveHdfsHost, hiveHdfsPort,
                               (doSimCheck ? hiveModTS_ : -1),
+                              NULL,
                               (ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
                               (ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
                               (queue_index)getDefault(GEN_DDL_SIZE_DOWN),
@@ -3388,7 +3223,92 @@
 
   if (getDropTableOnDealloc())
     exe_util_tdb->setDropOnDealloc(TRUE);
+
+  exe_util_tdb->setIsLegacy(TRUE);
+
+  if(!generator->explainDisabled()) {
+    generator->setExplainTuple(
+       addExplainInfo(exe_util_tdb, 0, 0, generator));
+  }
+
+  // no tupps are returned 
+  generator->setCriDesc((ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
+			Generator::UP);
+  generator->setGenObj(this, exe_util_tdb);
+
+  generator->setTransactionFlag(0); // transaction is not needed.
   
+  return 0;
+}
+
+/////////////////////////////////////////////////////////
+//
+// ExeUtilHiveTruncate::codeGen()
+//
+/////////////////////////////////////////////////////////
+short ExeUtilHiveTruncate::codeGen(Generator * generator)
+{
+  ExpGenerator * expGen = generator->getExpGenerator();
+  Space * space = generator->getSpace();
+
+  // allocate a map table for the retrieved columns
+  generator->appendAtEnd();
+
+  ex_cri_desc * givenDesc
+    = generator->getCriDesc(Generator::DOWN);
+
+  ex_cri_desc * returnedDesc
+    = new(space) ex_cri_desc(givenDesc->noTuples() + 1, space);
+
+  ex_cri_desc * workCriDesc = new(space) ex_cri_desc(4, space);
+  const Int32 work_atp = 1;
+  const Int32 exe_util_row_atp_index = 2;
+
+  short rc = processOutputRow(generator, work_atp, exe_util_row_atp_index,
+                              returnedDesc);
+  if (rc)
+    {
+      return -1;
+    }
+
+  char * tablename = NULL;
+  tablename = space->AllocateAndCopyToAlignedSpace
+    (generator->genGetNameAsAnsiNAString(getTableName()), 0);
+
+  char * hiveTableName = NULL;
+  hiveTableName = space->AllocateAndCopyToAlignedSpace(getHiveTableName(), 0);
+
+  char * hiveTruncQuery = NULL;
+  hiveTruncQuery = space->AllocateAndCopyToAlignedSpace(getHiveTruncQuery(), 0);
+
+  ComTdbExeUtilHiveTruncate * exe_util_tdb = new(space) 
+    ComTdbExeUtilHiveTruncate(tablename, strlen(tablename),
+                              hiveTableName,
+                              NULL, NULL,
+                              NULL, -1,
+                              -1,
+                              hiveTruncQuery,
+                              (ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
+                              (ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
+                              (queue_index)getDefault(GEN_DDL_SIZE_DOWN),
+                              (queue_index)getDefault(GEN_DDL_SIZE_UP),
+                              getDefault(GEN_DDL_NUM_BUFFERS),
+                              getDefault(GEN_DDL_BUFFER_SIZE));
+
+  generator->initTdbFields(exe_util_tdb);
+
+  if (getDropTableOnDealloc())
+    exe_util_tdb->setDropOnDealloc(TRUE);
+
+  if (getHiveExternalTable())
+    exe_util_tdb->setIsExternal(TRUE);
+
+  if (getIfExists())
+    exe_util_tdb->setIfExists(TRUE);
+
+  if (getTableNotExists())
+    exe_util_tdb->setTableNotExists(TRUE);
+
   if(!generator->explainDisabled()) {
     generator->setExplainTuple(
        addExplainInfo(exe_util_tdb, 0, 0, generator));
@@ -3727,6 +3647,8 @@
 	 (queue_index)64,
 	 4, 
 	 64000); 
+
+  exe_util_tdb->setUseLibHdfs(CmpCommon::getDefault(USE_LIBHDFS) == DF_ON);
   generator->initTdbFields(exe_util_tdb);
 
   if(!generator->explainDisabled()) {
@@ -3740,7 +3662,6 @@
   
   // users should not start a transaction.
   generator->setTransactionFlag(0);
-  
   return 0;
 }
 
@@ -4157,7 +4078,8 @@
      2,
      32000);
 
-if (handleInStringFormat_)
+  exe_util_tdb->setUseLibHdfs(CmpCommon::getDefault(USE_LIBHDFS) == DF_ON);
+  if (handleInStringFormat_)
     exe_util_tdb->setHandleInStringFormat(TRUE);
 
   if (handle_ == NULL)
@@ -4348,8 +4270,7 @@
      2,
      32000);
 
-
-
+  exe_util_lobupdate_tdb->setUseLibHdfs(CmpCommon::getDefault(USE_LIBHDFS) == DF_ON);
   if (updateAction_ == UpdateActionType::ERROR_IF_EXISTS_)
     exe_util_lobupdate_tdb->setErrorIfExists(TRUE);   
   else
@@ -4525,6 +4446,7 @@
      2,
      32000);
 
+  exe_util_tdb->setUseLibHdfs(CmpCommon::getDefault(USE_LIBHDFS) == DF_ON);
   generator->initTdbFields(exe_util_tdb);
   
   if(!generator->explainDisabled()) {
diff --git a/core/sql/generator/GenRelMisc.cpp b/core/sql/generator/GenRelMisc.cpp
index 737bf4e..ca2e4f3 100644
--- a/core/sql/generator/GenRelMisc.cpp
+++ b/core/sql/generator/GenRelMisc.cpp
@@ -470,6 +470,9 @@
             ddl_ws_tdb->setReturnDetails(TRUE);
 
         }
+      else if (initHbase())
+        ddl_ws_tdb->setInitTraf(TRUE);
+
       ddl_tdb = ddl_ws_tdb;
     }
   else
@@ -2682,9 +2685,10 @@
     }
 
   
-  if (generator->processLOB())
-    root_tdb->setProcessLOB(TRUE);
- 
+  if (generator->processLOB()) {
+     root_tdb->setProcessLOB(TRUE);
+     root_tdb->setUseLibHdfs(CmpCommon::getDefault(USE_LIBHDFS) == DF_ON);
+  } 
 
   // Self-referencing updates
   if (avoidHalloween_)
diff --git a/core/sql/generator/GenRelScan.cpp b/core/sql/generator/GenRelScan.cpp
index 8d30cab..2af324b 100644
--- a/core/sql/generator/GenRelScan.cpp
+++ b/core/sql/generator/GenRelScan.cpp
@@ -1399,7 +1399,7 @@
   hdfsscan_tdb->setUseCif(useCIF);
   hdfsscan_tdb->setUseCifDefrag(useCIFDegrag);
 
-  if (CmpCommon::getDefault(USE_LIBHDFS_SCAN) == DF_ON)
+  if (CmpCommon::getDefault(USE_LIBHDFS) == DF_ON)
      hdfsscan_tdb->setUseLibhdfsScan(TRUE);
 
   hdfsscan_tdb->setCompressedFile(isCompressedFile);
diff --git a/core/sql/langman/LmLangManagerJava.cpp b/core/sql/langman/LmLangManagerJava.cpp
index 58702a3..ca64d9d 100644
--- a/core/sql/langman/LmLangManagerJava.cpp
+++ b/core/sql/langman/LmLangManagerJava.cpp
@@ -3418,8 +3418,8 @@
   char *inputChars = ((char *)inputRow) + param->inDataOffset();
   ComUInt32 len = param->actualInDataSize(inputRow);
 
-  // NOTE: jdbc only handles default timestamp: yyyy-mm-dd hh:mm:ss.msssss.
-  len = (len <= 26) ? len :  26;
+  // NOTE: jdbc only handles default timestamp: yyyy-mm-dd hh:mm:ss.nssssssss.
+  len = (len <= 29) ? len :  29;
 
   // First create the java.lang.String from the input bytes
   str_cpy_all(tempbuf, inputChars, (Lng32) len);
diff --git a/core/sql/nskgmake/sqlcomp/Makefile b/core/sql/nskgmake/sqlcomp/Makefile
index 0205ebd..81920f7 100755
--- a/core/sql/nskgmake/sqlcomp/Makefile
+++ b/core/sql/nskgmake/sqlcomp/Makefile
@@ -27,6 +27,7 @@
 	CmpSeabaseDDLcleanup.cpp \
 	CmpSeabaseDDLcommon.cpp \
 	CmpSeabaseDDLindex.cpp \
+	CmpSeabaseDDLinitraf.cpp \
 	CmpSeabaseDDLrepos.cpp \
 	CmpSeabaseDDLroutine.cpp \
 	CmpSeabaseDDLschema.cpp \
diff --git a/core/sql/optimizer/BindItemExpr.cpp b/core/sql/optimizer/BindItemExpr.cpp
index 9e84ac4..f8d7b67 100644
--- a/core/sql/optimizer/BindItemExpr.cpp
+++ b/core/sql/optimizer/BindItemExpr.cpp
@@ -4032,9 +4032,10 @@
   NABoolean tf  = ExpDatetime::isTimeFormat(frmt);
   NABoolean tsf = ExpDatetime::isTimestampFormat(frmt);
   NABoolean nf  = ExpDatetime::isNumericFormat(frmt);
+  NABoolean ef  = ExpDatetime::isExtraFormat(frmt);
   NABoolean ms4 = (CmpCommon::getDefault(MODE_SPECIAL_4) == DF_ON);
   
-  if (NOT (df || tf || tsf || nf))
+  if (NOT (df || tf || tsf || nf || ef))
     {
       // format must be date, time, timestamp or numeric
       error = 1; // error 4065
@@ -4309,6 +4310,10 @@
           setChild(0, newChild->bindNode(bindWA));
         }
     }
+  else if (ExpDatetime::isExtraFormat(frmt_))
+    {
+      dateFormat_ = DateFormat::TIME_FORMAT_STR;
+    }
   else
     {
       CMPASSERT(FALSE); // should not reach here
diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp
index 58d2a4e..716a9c6 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -7756,8 +7756,6 @@
         stoi_->setDeleteAccess();
         if (((GenericUpdate*)re)->isMerge())
           stoi_->setInsertAccess();
-        if (((Delete*)re)->isFastDelete())
-          stoi_->setSelectAccess();
       }
       break;
     case REL_SCAN:
@@ -12034,7 +12032,7 @@
 
   // Triggers --
   
-  if ((NOT isFastDelete()) && (NOT noIMneeded()))
+  if (NOT noIMneeded())
     boundExpr = handleInlining(bindWA, boundExpr);
   else if (hbaseOper() && (getGroupAttr()->isEmbeddedUpdateOrDelete()))
   {
@@ -12936,16 +12934,10 @@
 
     // If this is not an INTERNAL REFRESH command, make sure the MV is
     // initialized and available.
-    // If this is FastDelete using parallel purgedata, do not enforce
-    // that MV is initialized.
     if (!bindWA->isBindingMvRefresh())
     {
-      if (NOT ((getOperatorType() == REL_UNARY_DELETE) &&
-               (((Delete*)this)->isFastDelete())))
-        {
-          if (naTable->verifyMvIsInitializedAndAvailable(bindWA))
-            return NULL;
-        }
+      if (naTable->verifyMvIsInitializedAndAvailable(bindWA))
+        return NULL;
     }
   }
 
@@ -14411,20 +14403,23 @@
          }
        }
     }
-  
+
+
   if (holdOrRestoreCQD_ == 0)
     {
-  attrEnum_ = affectYourself ? defs.validateAndInsert(token_, value_, reset_)
-                             : defs.validate         (token_, value_, reset_);
-  if (attrEnum_ < 0)
-    {
-      if (bindWA) bindWA->setErrStatus();
-      return NULL;
-    }
-
-  // remember this control in the control table
-  if (affectYourself)
-    ActiveControlDB()->setControlDefault(this);
+      if (affectYourself)
+        attrEnum_ =  defs.validateAndInsert(token_, value_, reset_);
+      else
+        attrEnum_ = defs.validate(token_, value_, reset_);
+      if (attrEnum_ < 0)
+        {
+          if (bindWA) bindWA->setErrStatus();
+          return NULL;
+        }
+      
+      // remember this control in the control table
+      if (affectYourself)
+        ActiveControlDB()->setControlDefault(this);
     }
   else if ((holdOrRestoreCQD_ > 0) && (affectYourself))
     {
@@ -14435,7 +14430,7 @@
           return NULL;
         }
     }
-
+  
   return ControlAbstractClass::bindNode(bindWA);
 } // ControlQueryDefault::bindNode()
 
diff --git a/core/sql/optimizer/EncodedValue.cpp b/core/sql/optimizer/EncodedValue.cpp
index cd0bc0d..f05297a 100644
--- a/core/sql/optimizer/EncodedValue.cpp
+++ b/core/sql/optimizer/EncodedValue.cpp
@@ -745,12 +745,16 @@
     // in the case of a string, next has been advanced to the closing quote while
     // item still points to the beginning of the string. Scanning for a comma
     // starting at item may find a comma that is part of the string.
+    // Note: In the case of INTERVAL literals, we might have a nasty SECOND(m,n)
+    // qualifier at the end. We don't want to mistake a possible comma within such
+    // a qualifier for our delimiter, so we have to use na_wcschrSkipOverParenText
+    // instead of na_wcschr to search for the comma.
     if ( i == entries-1 OR entries==0 ) // sometimes columns is an empty list
       next = na_wcsrchr(next, L')') ;
     else  // it's an MCH
       {
     	NAWchar* nextSave = next;
-        next = na_wcschr(next, L',');
+        next = na_wcschrSkipOverParenText(next, L',');
         if ( next == NULL )
           {
             // Number of components of boundary value is less than the number of
diff --git a/core/sql/optimizer/ImplRule.h b/core/sql/optimizer/ImplRule.h
index e2b8ffa..5cc8442 100644
--- a/core/sql/optimizer/ImplRule.h
+++ b/core/sql/optimizer/ImplRule.h
@@ -747,70 +747,6 @@
                                   RuleSubstituteMemory *&memory);
 };
 
-class PhysicalParallelLabelCreateRule : public Rule
-{
-public:
-   PhysicalParallelLabelCreateRule(const char *name,
-                                   RelExpr *pattern,
-                                   RelExpr *substitute) : 
-                Rule(name,pattern,substitute) {}
-   PhysicalParallelLabelCreateRule(const PhysicalParallelLabelCreateRule &);
-   virtual ~PhysicalParallelLabelCreateRule();
-   virtual NABoolean topMatch(RelExpr * relExpr,
-                              Context *context);
-   virtual RelExpr * nextSubstitute(RelExpr * before,
-                                    Context * context,
-                                    RuleSubstituteMemory * & memory);
-};
-
-class PhysicalParallelLabelDropRule: public Rule
-{
-public:
-   PhysicalParallelLabelDropRule(const char *name,
-                                 RelExpr *pattern,
-                                 RelExpr *substitute) : 
-                Rule(name,pattern,substitute) {}
-   PhysicalParallelLabelDropRule(const PhysicalParallelLabelDropRule&);
-   virtual ~PhysicalParallelLabelDropRule();
-   virtual NABoolean topMatch(RelExpr * relExpr,
-                              Context *context);
-   virtual RelExpr * nextSubstitute(RelExpr * before,
-                                    Context * context,
-                                    RuleSubstituteMemory * & memory);
-};
-
-class PhysicalParallelLabelAlterRule : public Rule
-{
-public:
-   PhysicalParallelLabelAlterRule(const char *name,
-                                   RelExpr *pattern,
-                                   RelExpr *substitute) : 
-                Rule(name,pattern,substitute) {}
-   PhysicalParallelLabelAlterRule(const PhysicalParallelLabelAlterRule &);
-   virtual ~PhysicalParallelLabelAlterRule();
-   virtual NABoolean topMatch(RelExpr * relExpr,
-                              Context *context);
-   virtual RelExpr * nextSubstitute(RelExpr * before,
-                                    Context * context,
-                                    RuleSubstituteMemory * & memory);
-};
-
-class PhysicalParallelLabelPurgedataRule : public Rule
-{
-public:
-   PhysicalParallelLabelPurgedataRule(const char *name,
-                                   RelExpr *pattern,
-                                   RelExpr *substitute) : 
-                Rule(name,pattern,substitute) {}
-   PhysicalParallelLabelPurgedataRule(const PhysicalParallelLabelPurgedataRule &);
-   virtual ~PhysicalParallelLabelPurgedataRule();
-   virtual NABoolean topMatch(RelExpr * relExpr,
-                              Context *context);
-   virtual RelExpr * nextSubstitute(RelExpr * before,
-                                    Context * context,
-                                    RuleSubstituteMemory * & memory);
-};
-
 class PhysicalIsolatedScalarUDFRule : public Rule
 {
 public:
diff --git a/core/sql/optimizer/ItemExpr.cpp b/core/sql/optimizer/ItemExpr.cpp
index 57604b5..b1638d4 100644
--- a/core/sql/optimizer/ItemExpr.cpp
+++ b/core/sql/optimizer/ItemExpr.cpp
@@ -7767,6 +7767,9 @@
     case ITM_TO_TIMESTAMP:
       return "to_timestamp";
 
+    case ITM_SPLIT_PART:
+      return "split_part";
+
     default:
       return "unknown func";
     } // switch
@@ -15236,3 +15239,16 @@
    return this;
 }
 
+SplitPart::~SplitPart() {}
+
+ItemExpr * SplitPart::copyTopNode(ItemExpr *derivedNode, CollHeap *outHeap)
+{
+      ItemExpr *result = NULL;
+      if (derivedNode == NULL)
+        result = new (outHeap) SplitPart(child(0), child(1), child(2));
+      else
+        result = derivedNode;
+
+     return BuiltinFunction::copyTopNode(result, outHeap);
+}
+
diff --git a/core/sql/optimizer/ItemFunc.h b/core/sql/optimizer/ItemFunc.h
index 2062919..0dd901e 100644
--- a/core/sql/optimizer/ItemFunc.h
+++ b/core/sql/optimizer/ItemFunc.h
@@ -5843,4 +5843,22 @@
 
 }; // class RowNumFunc
 
+class SplitPart : public CacheableBuiltinFunction
+{
+public: 
+  SplitPart(ItemExpr *val1Ptr, ItemExpr *val2Ptr, ItemExpr *val3Ptr)
+    :CacheableBuiltinFunction(ITM_SPLIT_PART, 3, val1Ptr, val2Ptr, val3Ptr)
+    {
+      allowsSQLnullArg() = FALSE;
+    } 
+
+   virtual ~SplitPart();
+
+   // a virtual function for type propagating the node
+   virtual const NAType * synthesizeType();
+   
+   virtual ItemExpr * copyTopNode(ItemExpr *derivedNode = NULL,
+                      CollHeap *outheap = 0);
+}; //class SplitPart
+
 #endif /* ITEMFUNC_H */
diff --git a/core/sql/optimizer/QRDescGenerator.cpp b/core/sql/optimizer/QRDescGenerator.cpp
index 9071018..7265ae5 100644
--- a/core/sql/optimizer/QRDescGenerator.cpp
+++ b/core/sql/optimizer/QRDescGenerator.cpp
@@ -252,11 +252,17 @@
 
               default:
                 // All day-time interval values are expressed in terms of microseconds.
+
+                // If fractional precision is greater than
+                // microsecs, disable rangespec transformation.
+                if (type->getScale() > SQLInterval::MAX_FRACTION_PRECISION_USEC)
+                  return FALSE;
+
                 return (SQLInterval::MAX_LEADING_PRECISION >=
                         IntervalType::getPrecision(intvType->getStartField(),
                                                    intvType->getLeadingPrecision(),
                                                    REC_DATE_SECOND,
-                                                   SQLInterval::MAX_FRACTION_PRECISION));
+                                                   SQLInterval::MAX_FRACTION_PRECISION_USEC));
             }
         }
 
@@ -267,6 +273,13 @@
       //case NA_USER_SUPPLIED_TYPE:
       //case NA_RECORD_TYPE:
       //case NA_ROWSET_TYPE:
+
+        // datetime values are currently converted to Int64 microseconds value
+        // for rangespec constants. If fractional precision is greater than
+        // microsecs, disable rangespec transformation.
+        if (type->getScale() > DatetimeType::MAX_FRACTION_PRECISION_USEC)
+          return FALSE;
+
         return TRUE;
 
       default:
diff --git a/core/sql/optimizer/RelCache.cpp b/core/sql/optimizer/RelCache.cpp
index b3ee6da..4fb9a0d 100644
--- a/core/sql/optimizer/RelCache.cpp
+++ b/core/sql/optimizer/RelCache.cpp
@@ -527,10 +527,6 @@
 // is this entire expression cacheable after this phase?
 NABoolean Delete::isCacheableExpr(CacheWA& cwa)
 {
-  // fastdelete (purgedata) is not a cacheable expression.
-  if (isFastDelete())
-    return FALSE; 
-
   return GenericUpdate::isCacheableExpr(cwa);
 }
 
diff --git a/core/sql/optimizer/RelExeUtil.cpp b/core/sql/optimizer/RelExeUtil.cpp
index 7b96463..88d544e 100644
--- a/core/sql/optimizer/RelExeUtil.cpp
+++ b/core/sql/optimizer/RelExeUtil.cpp
@@ -395,10 +395,6 @@
       result = "CREATE_TABLE_AS";
       break;
 
-    case FAST_DELETE_:
-      result = "FAST_DELETE";
-      break;
-
     case HIVE_TRUNCATE_:
       result = "HIVE_TRUNCATE";
       break;
@@ -850,30 +846,25 @@
 }
 
 // -----------------------------------------------------------------------
-// Member functions for class ExeUtilFastDelete
+// Member functions for class ExeUtilHiveTruncateLegacy
 // -----------------------------------------------------------------------
-RelExpr * ExeUtilFastDelete::copyTopNode(RelExpr *derivedNode, CollHeap* outHeap)
+RelExpr * ExeUtilHiveTruncateLegacy::copyTopNode(RelExpr *derivedNode, CollHeap* outHeap)
 {
-  ExeUtilFastDelete *result;
+  ExeUtilHiveTruncateLegacy *result;
 
   if (derivedNode == NULL)
-    result = new (outHeap) ExeUtilFastDelete(getTableName(),
-					     getExprNode(), NULL, CharInfo::UnknownCharSet,
-					     doPurgedataCat_,
-					     noLog_,
-					     ignoreTrigger_,
-					     isPurgedata_,
-					     outHeap);
+    result = new (outHeap) ExeUtilHiveTruncateLegacy(getTableName(),
+                                                     pl_,
+                                                     outHeap);
   else
-    result = (ExeUtilFastDelete *) derivedNode;
+    result = (ExeUtilHiveTruncateLegacy *) derivedNode;
 
-  result->doParallelDelete_ = doParallelDelete_;
-  result->doParallelDeleteIfXn_ = doParallelDeleteIfXn_;
-  result->offlineTable_ = offlineTable_;
-  result->doLabelPurgedata_ = doLabelPurgedata_;
-
-  result->numLOBs_ = numLOBs_;
-  result->lobNumArray_ = lobNumArray_;
+  result->hiveTableLocation_= hiveTableLocation_;
+  result->hiveHostName_ = hiveHostName_;
+  result->hiveHdfsPort_ = hiveHdfsPort_;
+  result->suppressModCheck_ = suppressModCheck_;
+  result->dropTableOnDealloc_ = dropTableOnDealloc_;
+  result->noSecurityCheck_ = noSecurityCheck_;
 
   return ExeUtilExpr::copyTopNode(result, outHeap);
 }
@@ -887,21 +878,18 @@
 
   if (derivedNode == NULL)
     result = new (outHeap) ExeUtilHiveTruncate(getTableName(),
-                                               pl_,
+                                               hiveTableName_,
+                                               hiveTruncQuery_,
                                                outHeap);
   else
     result = (ExeUtilHiveTruncate *) derivedNode;
 
-  result->hiveTableLocation_= hiveTableLocation_;
-  result->hiveHostName_ = hiveHostName_;
-  result->hiveHdfsPort_ = hiveHdfsPort_;
-  result->suppressModCheck_ = suppressModCheck_;
   result->dropTableOnDealloc_ = dropTableOnDealloc_;
+  result->noSecurityCheck_ = noSecurityCheck_;
 
   return ExeUtilExpr::copyTopNode(result, outHeap);
 }
 
-
 // -----------------------------------------------------------------------
 RelExpr * ExeUtilHiveQuery::copyTopNode(RelExpr *derivedNode,
                                         CollHeap* outHeap)
@@ -4079,7 +4067,6 @@
   NABoolean isCommentOn = FALSE;
   NABoolean isHive = FALSE;
 
-  returnStatus_ = FALSE;
 
   NABoolean specialType = FALSE;
   if (isUstat())  // special DDLExpr node for an Update Stats statement
@@ -4864,8 +4851,17 @@
   if (bindWA->errStatus()) 
     return NULL;
 
+  NABoolean isHive = FALSE;
+  if ((getTableName().isHive()) &&
+      (CmpCommon::getDefault(TRAF_DDL_ON_HIVE_OBJECTS) == DF_ON))
+    {
+      isHive = TRUE;
+      upsertUsingLoadAllowed = FALSE;
+    }
+
   if ((NOT isVolatile_) &&
-      (NOT getTableName().isSeabase())) // can only create traf tables
+      (NOT getTableName().isSeabase()) && // can only create traf tables
+      (NOT isHive))
     {
       *CmpCommon::diags() << DgSqlCode(-3242) << 
         DgString0(NAString("This DDL operation is not allowed in the specified catalog '" + getTableName().getQualifiedNameObj().getCatalogName() + "'."));
@@ -4943,7 +4939,9 @@
             }
           else if (createTableNode->isVolatile())
 	    ctQuery_ = "CREATE VOLATILE TABLE ";
-	  else
+	  else if ((isHive) && (createTableNode->isExternal()))
+            ctQuery_ = "CREATE EXTERNAL TABLE ";
+          else
 	    ctQuery_ = "CREATE TABLE ";
 
           if (createTableNode->createIfNotExists())
@@ -4970,6 +4968,7 @@
 	  
 	  ctQuery_ += "( ";
 
+          NAString hiveType;
 	  if (! pTableDefBody)
 	    {
 	      for (CollIndex i = 0; i < retDesc->getDegree(); i++)
@@ -4993,7 +4992,13 @@
 		  colDef += " ";
 		  
 		  NAType &colType = (NAType&)(queryRoot->compExpr()[i].getType());
-		  colType.getMyTypeAsText(&colDef);
+                 if (isHive)
+                    {
+                      colType.getMyTypeAsHiveText(&hiveType);
+                      colDef += hiveType;
+                    }
+                 else
+                   colType.getMyTypeAsText(&colDef);
 
 		  if (colType.isLob())
 		    upsertUsingLoadAllowed = FALSE;
@@ -5138,10 +5143,10 @@
 	  // if attribute list is specified, append that to col definition.
 	  if (createTableNode->getChild(1/*StmtDDLCreateTable::INDEX_ATTRIBUTE_LIST*/))
 	    {
-	      ctQuery_ += " ";
-	      ctQuery_.append(&stmtText[attrListStartPos], 
-			      attrListEndPos - attrListStartPos);
-	    }
+              ctQuery_ += " ";
+              ctQuery_.append(&stmtText[attrListStartPos], 
+                              attrListEndPos - attrListStartPos);
+            }
 	}
       else
 	{
@@ -5150,7 +5155,24 @@
 	  ctQuery_ = "";
 	  ctQuery_.append(stmtText, attrListEndPos);
 	}
-      
+
+      if (NOT createTableNode->getHiveOptions().isNull())
+        {
+          if (NOT isHive)
+            {
+              *CmpCommon::diags() << DgSqlCode(-3242) << 
+                DgString0(NAString("WITH HIVE OPTIONS cannot be specified for non-Hive tables."));
+              
+              bindWA->setErrStatus();
+              return NULL;
+            }
+          else
+            {
+              ctQuery_ += " ";
+              ctQuery_ += createTableNode->getHiveOptions();
+            }
+        }
+       
       if (createTableNode->isInMemoryObjectDefn())
 	ctQuery_.append(" IN MEMORY ");
 
@@ -5222,66 +5244,18 @@
       // get the upd stats query
       usQuery_ = "UPDATE STATISTICS FOR TABLE ";
       usQuery_ += getTableName().getQualifiedNameObj().getQualifiedNameAsAnsiString(TRUE);
-      usQuery_ += " ON EVERY KEY SAMPLE SET ROWCOUNT %Ld;";
+      if (isHive)
+        usQuery_ += " ON EVERY COLUMN SAMPLE SET ROWCOUNT %Ld;";
+      else
+        usQuery_ += " ON EVERY KEY SAMPLE SET ROWCOUNT %Ld;";        
     }
 
   return boundExpr;
 }
 // -----------------------------------------------------------------------
-// member functions for class ExeUtilFastDelete
+// member functions for class ExeUtilHiveTruncateLegacy
 // -----------------------------------------------------------------------
-RelExpr * ExeUtilFastDelete::bindNode(BindWA *bindWA)
-{
-  if (nodeIsBound()) 
-    {
-      bindWA->getCurrentScope()->setRETDesc(getRETDesc());
-      return this;
-    }
-
-  bindChildren(bindWA);
-  if (bindWA->errStatus()) 
-    return this;
-
-  // do not do override schema for this
-  bindWA->setToOverrideSchema(FALSE);
-  
-  NATable * naTable = bindWA->getNATable(getTableName());
-  if ((!naTable) || 
-      (bindWA->errStatus()))
-    return this;
-  
-  if ((getTableName().isHive()) ||
-      (naTable->isHiveTable()))
-    {
-      *CmpCommon::diags() << DgSqlCode(-3242) 
-                          << DgString0("Purgedata is not allowed for Hive tables. Use 'Truncate Table' command.");
-      bindWA->setErrStatus();
-      return NULL;
-    }
-  
-  if (! getTableName().isSeabase())
-    {
-      *CmpCommon::diags() << DgSqlCode(-4222) << DgString0("PURGEDATA");
-      bindWA->setErrStatus();
-      return NULL;
-    }
-  
-  DDLExpr * ddlExpr = new(bindWA->wHeap()) DDLExpr(NULL,
-                                                   getStmtText(),
-                                                   CharInfo::UnknownCharSet,
-                                                   CmpCommon::statementHeap());
-  ddlExpr->setPurgedata(TRUE);
-  ddlExpr->setPurgedataTableName(getTableName());
-
-  RelExpr * boundExpr = ddlExpr->bindNode(bindWA);
-
-  return boundExpr;
-}
-
-// -----------------------------------------------------------------------
-// member functions for class ExeUtilHiveTruncate
-// -----------------------------------------------------------------------
-RelExpr * ExeUtilHiveTruncate::bindNode(BindWA *bindWA)
+RelExpr * ExeUtilHiveTruncateLegacy::bindNode(BindWA *bindWA)
 {
   if (nodeIsBound()) 
     {
@@ -5375,6 +5349,109 @@
 }
 
 // -----------------------------------------------------------------------
+// member functions for class ExeUtilHiveTruncate
+// -----------------------------------------------------------------------
+RelExpr * ExeUtilHiveTruncate::bindNode(BindWA *bindWA)
+{
+  if (nodeIsBound()) 
+    {
+      bindWA->getCurrentScope()->setRETDesc(getRETDesc());
+      return this;
+    }
+
+  bindChildren(bindWA);
+  if (bindWA->errStatus()) 
+    return this;
+
+  NATable *naTable = NULL;
+
+  // do not do override schema for this
+  bindWA->setToOverrideSchema(FALSE);
+  
+  naTable = bindWA->getNATable(getTableName());
+  if (getIfExists() && (! naTable))
+    {
+      setTableNotExists(TRUE);
+
+      bindWA->resetErrStatus();
+      CmpCommon::diags()->clear();
+      RelExpr * boundExpr = ExeUtilExpr::bindNode(bindWA);
+      if (bindWA->errStatus())
+        return NULL;
+      
+      return boundExpr;
+    }
+
+  if ((!naTable) || 
+      (bindWA->errStatus()))
+    return this;
+ 
+  if ((NOT getTableName().isHive()) ||
+      (!naTable->isHiveTable()))
+    {
+      *CmpCommon::diags() << DgSqlCode(-3242) 
+                          << DgString0("Truncate is only allowed for hive tables.");
+      bindWA->setErrStatus();
+      return NULL;
+    }
+
+  // if no security check is to be done, skip it.
+  if (NOT noSecurityCheck_)
+    {
+      // In Hive, you need admin privs to truncate files.  At this time, we don't
+      // know if the current user has admin privileges, return an error.
+      char * sentryEnv = getenv("SENTRY_SECURITY_FOR_HIVE");
+      if (sentryEnv && strcmp(sentryEnv, "TRUE") == 0)
+        {
+          *CmpCommon::diags() << DgSqlCode(-3242) 
+                              << DgString0("Truncate must be performed through native Hive interface.");
+          bindWA->setErrStatus();
+          return NULL;
+        }
+      
+      // If the current user has been granted the Trafodion Hive/DB root role or
+      // is DB__ROOT, allow the operation. 
+      // If the current user has select and delete privileges, allow the operation
+      if (bindWA->currentCmpContext()->isAuthorizationEnabled())
+        {
+          NABoolean found = FALSE;
+          if (ComUser::isRootUserID() ||
+              ComUser::currentUserHasRole(HIVE_ROLE_ID) ||
+              ComUser::currentUserHasRole(ROOT_ROLE_ID))
+            found = TRUE;
+          
+          if (!found)
+            {
+              PrivMgrUserPrivs *pPrivInfo = naTable->getPrivInfo();
+              if (pPrivInfo &&
+                  pPrivInfo->hasPriv(SELECT_PRIV) &&
+                  pPrivInfo->hasPriv(DELETE_PRIV))
+                found = TRUE;
+              
+              if (!found)
+                {
+                  *CmpCommon::diags()
+                    << DgSqlCode( -1051 )
+                    << DgTableName(naTable->getTableName().getQualifiedNameAsAnsiString());
+                  bindWA->setErrStatus();
+                  return NULL;
+                }
+            }
+        }
+    }
+
+  setHiveExternalTable(naTable->isHiveExternalTable());
+
+  // Allocate a TableDesc and attach it to this.
+  //
+  RelExpr * boundExpr = ExeUtilExpr::bindNode(bindWA);
+  if (bindWA->errStatus())
+    return NULL;
+
+  return boundExpr;
+}
+
+// -----------------------------------------------------------------------
 // member functions for class ExeUtilMaintainObject
 // -----------------------------------------------------------------------
 RelExpr * ExeUtilMaintainObject::bindNode(BindWA *bindWA)
diff --git a/core/sql/optimizer/RelExeUtil.h b/core/sql/optimizer/RelExeUtil.h
index 84ff343..4ddb8cc 100644
--- a/core/sql/optimizer/RelExeUtil.h
+++ b/core/sql/optimizer/RelExeUtil.h
@@ -257,6 +257,7 @@
 				       ComTdb * tdb, 
 				       Generator *generator);
 
+  void setReturnStatus(NABoolean v) { returnStatus_ = v; }
   virtual NABoolean producesOutput() { return returnStatus_;}
   virtual const char 	*getVirtualTableName();
   virtual TrafDesc 	*createVirtualTableDesc();
@@ -371,6 +372,10 @@
   {(v ? flags_ |= PURGEDATA : flags_ &= ~PURGEDATA); }
   NABoolean purgedata() { return (flags_ & PURGEDATA) != 0;}
 
+  void setPurgedataIfExists(NABoolean v)
+  {(v ? flags_ |= PURGEDATA_IF_EXISTS : flags_ &= ~PURGEDATA_IF_EXISTS); }
+  NABoolean purgedataIfExists() { return (flags_ & PURGEDATA_IF_EXISTS) != 0;}
+
   // this ddlexpr is created for 'showddl <obj>, explain' to
   // explain the object explObjName.
   void setShowddlExplain(NABoolean v)
@@ -411,6 +416,7 @@
     SHOWDDL_EXPLAIN         = 0x040000,
     SHOWDDL_EXPLAIN_INT     = 0x080000,
     NO_LABEL_STATS          = 0x100000,
+    PURGEDATA_IF_EXISTS     = 0x200000,
   };
 
   // see method processSpecialDDL in sqlcomp/parser.cpp
@@ -486,7 +492,6 @@
     CLEANUP_VOLATILE_TABLES_  = 5,
     GET_VOLATILE_INFO_        = 6,
     CREATE_TABLE_AS_          = 7,
-    FAST_DELETE_              = 8,
     GET_STATISTICS_           = 9,
     LONG_RUNNING_             = 11,
     GET_METADATA_INFO_        = 12,
@@ -513,9 +518,10 @@
     HBASE_UNLOAD_TASK_        = 36,
     ORC_FAST_AGGR_            = 37,
     GET_QID_                  = 38,
-    HIVE_TRUNCATE_            = 39,
+    HIVE_TRUNCATE_LEGACY_     = 39,
     LOB_UPDATE_UTIL_          = 40,
-    HIVE_QUERY_               = 41
+    HIVE_QUERY_               = 41,
+    HIVE_TRUNCATE_            = 45
   };
 
   ExeUtilExpr(ExeUtilType type,
@@ -983,6 +989,10 @@
   // method to do code generation
   virtual short codeGen(Generator*);
 
+  ExplainTuple *addSpecificExplainInfo(ExplainTupleMaster *explainTuple, 
+				       ComTdb * tdb, 
+				       Generator *generator);
+
   virtual NABoolean explainSupported() { return TRUE; }
 
   virtual NABoolean producesOutput() { 
@@ -1013,90 +1023,23 @@
   NABoolean deleteData_;
 };
 
-class ExeUtilFastDelete : public ExeUtilExpr
+class ExeUtilHiveTruncateLegacy : public ExeUtilExpr
 {
 public:
-  ExeUtilFastDelete(const CorrName &name,
-		    ExprNode * exprNode,
-		    char * stmtText,
-		    CharInfo::CharSet stmtTextCharSet,
-		    NABoolean doPurgedataCat = FALSE,
-		    NABoolean noLog = FALSE,
-		    NABoolean ignoreTrigger = FALSE,
-		    NABoolean isPurgedata = FALSE,
-		    CollHeap *oHeap = CmpCommon::statementHeap())
-       : ExeUtilExpr(FAST_DELETE_, name, exprNode, NULL, stmtText, stmtTextCharSet, oHeap),
-         doPurgedataCat_(doPurgedataCat),
-         noLog_(noLog), ignoreTrigger_(ignoreTrigger),
-         isPurgedata_(isPurgedata),
-         doParallelDelete_(FALSE),
-         doParallelDeleteIfXn_(FALSE),
-         offlineTable_(FALSE),
-         doLabelPurgedata_(FALSE),
-         numLOBs_(0),
-         lobNumArray_(oHeap)
-  {
-  };
-
-  virtual NABoolean isExeUtilQueryType() { return TRUE; }
-
-  virtual RelExpr * copyTopNode(RelExpr *derivedNode = NULL,
-				CollHeap* outHeap = 0);
-
-  virtual RelExpr * bindNode(BindWA *bindWAPtr);
-
-  virtual RelExpr * preCodeGen(Generator * generator,
-			       const ValueIdSet & externalInputs,
-			       ValueIdSet &pulledNewInputs);
-
-  // method to do code generation
-  virtual short codeGen(Generator*);
-  
-  virtual NABoolean aqrSupported() { return TRUE; }
-
-private:
-  NABoolean doPurgedataCat_;
-
-  NABoolean noLog_;
-  NABoolean ignoreTrigger_;
-
-  NABoolean isPurgedata_;
-
-  // do regular parallel delete at runtime. Start a Xn, if oen doesn't
-  // exist.
-  NABoolean doParallelDelete_;
-
-  // do regular parallel delete if doParallelDelete is not chosen and
-  // there is a transaction running at runtime.
-  // If this is FALSE, then regular purgedata is invoked. 
-  NABoolean doParallelDeleteIfXn_;
-
-  NABoolean offlineTable_;
-
-  // use the new parallel label purgedata operation.
-  NABoolean doLabelPurgedata_;
-  
-  // if there are LOB columns.
-  Lng32 numLOBs_; // number of LOB columns
-  NAList<short> lobNumArray_; // array of shorts. Each short is the lob num
-};
-
-class ExeUtilHiveTruncate : public ExeUtilExpr
-{
-public:
-  ExeUtilHiveTruncate(const CorrName &name,
-                      ConstStringList * pl,
-                      CollHeap *oHeap = CmpCommon::statementHeap())
-       : ExeUtilExpr(HIVE_TRUNCATE_, name, NULL, NULL, NULL, 
+  ExeUtilHiveTruncateLegacy(const CorrName &name,
+                            ConstStringList * pl,
+                            CollHeap *oHeap = CmpCommon::statementHeap())
+       : ExeUtilExpr(HIVE_TRUNCATE_LEGACY_, name, NULL, NULL, NULL, 
                      CharInfo::UnknownCharSet, oHeap),
-         pl_(pl), suppressModCheck_(FALSE), dropTableOnDealloc_(FALSE)
+         pl_(pl), suppressModCheck_(FALSE), dropTableOnDealloc_(FALSE),
+         noSecurityCheck_(FALSE)
   { }
-
+  
   virtual NABoolean isExeUtilQueryType() { return TRUE; }
-
+  
   virtual RelExpr * copyTopNode(RelExpr *derivedNode = NULL,
 				CollHeap* outHeap = 0);
-
+  
   virtual RelExpr * bindNode(BindWA *bindWAPtr);
 
   virtual RelExpr * preCodeGen(Generator * generator,
@@ -1125,12 +1068,13 @@
 
   ConstStringList* &partnList() { return pl_; }
 
-  NABoolean getSuppressModCheck() const           { return suppressModCheck_; }
+  NABoolean getSuppressModCheck() const         { return suppressModCheck_; }
   NABoolean getDropTableOnDealloc() const       { return dropTableOnDealloc_; }
+  NABoolean getNoSecurityCheck() const          { return noSecurityCheck_; }
 
-  void setSuppressModCheck(NABoolean v=TRUE)         { suppressModCheck_ = v; }
-  void setDropTableOnDealloc(NABoolean v=TRUE)     { dropTableOnDealloc_ = v; }
-
+  void setSuppressModCheck(NABoolean v=TRUE)    { suppressModCheck_ = v; }
+  void setDropTableOnDealloc(NABoolean v=TRUE)  { dropTableOnDealloc_ = v; }
+  void setNoSecurityCheck(NABoolean v)          { noSecurityCheck_ = v; }  
 private:
   NAString  hiveTableLocation_;
   NAString hiveHostName_;
@@ -1143,6 +1087,84 @@
   ConstStringList * pl_;
   NABoolean suppressModCheck_;
   NABoolean dropTableOnDealloc_;
+
+  // if this truncate node is added internally to process 'insert overwrite'
+  // statement, then skip security/privilege checks.
+  // Checks will be done when the corresponding insert node is processed.
+  NABoolean noSecurityCheck_;
+};
+
+///////////////////////////////////////////////////////////
+// ExeUtilHiveTruncate
+///////////////////////////////////////////////////////////
+class ExeUtilHiveTruncate : public ExeUtilExpr
+{
+public:
+  ExeUtilHiveTruncate(CorrName &name,
+                      NAString &hiveTableName,
+                      NAString &hiveTruncQuery,
+                      CollHeap *oHeap = CmpCommon::statementHeap())
+       : ExeUtilExpr(HIVE_TRUNCATE_, name, NULL, NULL, NULL, 
+                     CharInfo::UnknownCharSet, oHeap),
+         hiveTableName_(hiveTableName),
+         hiveTruncQuery_(hiveTruncQuery),
+         dropTableOnDealloc_(FALSE),
+         noSecurityCheck_(FALSE),
+         hiveExternalTable_(FALSE),
+         ifExists_(FALSE),
+         tableNotExists_(FALSE)
+  { }
+
+  virtual NABoolean isExeUtilQueryType() { return TRUE; }
+
+  virtual RelExpr * copyTopNode(RelExpr *derivedNode = NULL,
+				CollHeap* outHeap = 0);
+
+  virtual RelExpr * bindNode(BindWA *bindWAPtr);
+
+  // method to do code generation
+  virtual short codeGen(Generator*);
+  
+  ExplainTuple *addSpecificExplainInfo(ExplainTupleMaster *explainTuple, 
+				       ComTdb * tdb, 
+				       Generator *generator);
+  
+  virtual NABoolean aqrSupported() { return TRUE; }
+
+  const NAString &getHiveTableName() const { return hiveTableName_; }
+  const NAString &getHiveTruncQuery() const { return hiveTruncQuery_; }
+
+  NABoolean getDropTableOnDealloc() const       { return dropTableOnDealloc_; }
+  NABoolean getNoSecurityCheck() const          { return noSecurityCheck_; }
+  NABoolean getHiveExternalTable() const        { return hiveExternalTable_; }
+  NABoolean getIfExists() const                 { return ifExists_; }
+  NABoolean getTableNotExists()   const         { return tableNotExists_; }
+
+  void setDropTableOnDealloc(NABoolean v=TRUE)  { dropTableOnDealloc_ = v; }
+  void setNoSecurityCheck(NABoolean v)          { noSecurityCheck_ = v; }  
+  void setHiveExternalTable(NABoolean v)        { hiveExternalTable_ = v; }
+  void setIfExists(NABoolean v)                 { ifExists_ = v; }
+  void setTableNotExists(NABoolean v)           { tableNotExists_ = v; }
+
+private:
+
+  NAString hiveTableName_;
+  NAString hiveTruncQuery_;
+  NABoolean dropTableOnDealloc_;
+
+  // if this truncate node is added internally to process 'insert overwrite'
+  // statement, then skip security/privilege checks.
+  // Checks will be done when the corresponding insert node is processed.
+  NABoolean noSecurityCheck_;
+
+  // TRUE: Hive External table. FALSE: Hive Managed table.
+  NABoolean hiveExternalTable_;
+
+  // if 'if exist' clause is specified
+  NABoolean ifExists_;
+
+  // if table does not exist
+  NABoolean tableNotExists_;
 };
 
 class ExeUtilHiveQuery : public ExeUtilExpr
diff --git a/core/sql/optimizer/RelExpr.cpp b/core/sql/optimizer/RelExpr.cpp
index 44e0e90..da3a7c6 100644
--- a/core/sql/optimizer/RelExpr.cpp
+++ b/core/sql/optimizer/RelExpr.cpp
@@ -13341,6 +13341,40 @@
 				newExternalInputs,
 				predicatesOnParent,
 				&localExprs);
+
+/*to fix jira 18-20180111-2901  
+ *For query " insert into to t1 select seqnum(seq1, next) from t1;", there is no SORT as left child of TSJ, and it 
+ *is a self-referencing updates Halloween problem. In NestedJoin::genWriteOpLeftChildSortReq(), child(0)
+ *producing no outputs for this query, which means that there is no column to sort on. So we solve this by 
+ *having the source for Halloween insert produce at least one output column always.
+ * */
+  if (avoidHalloween() && child(0) &&
+      child(0)->getOperatorType() == REL_SCAN &&
+      child(0)->getGroupAttr())
+    {
+      if (child(0)->getGroupAttr()->getCharacteristicOutputs().isEmpty())
+        {
+          ValueId exprId;
+          ValueId atLeastOne;
+
+          ValueIdSet output_source = child(0)->getTableDescForExpr()->getColumnList();
+          for (exprId = output_source.init();
+               output_source.next(exprId);
+               output_source.advance(exprId))
+            {
+              atLeastOne = exprId;
+              if (!(exprId.getItemExpr()->doesExprEvaluateToConstant(FALSE, TRUE)))
+                {
+                  child(0)->getGroupAttr()->addCharacteristicOutputs(exprId);
+                  break;
+                }
+            }
+         if (child(0)->getGroupAttr()->getCharacteristicOutputs().isEmpty())
+           {
+             child(0)->getGroupAttr()->addCharacteristicOutputs(atLeastOne);
+           }
+        }
+    }	
 }
 
 /*
@@ -13600,7 +13634,6 @@
 	       ConstStringList * csl,
 	       CollHeap *oHeap)
   : GenericUpdate(name,tabId,otype,child,newRecExpr,currOfCursorName,oHeap),
-    isFastDelete_(FALSE),
     csl_(csl),estRowsAccessed_(0)
 {
   setCacheableNode(CmpMain::BIND);
@@ -13630,7 +13663,6 @@
   else
     result = (Delete *) derivedNode;
 
-  result->isFastDelete_       = isFastDelete_;
   result->csl() = csl();
   result->setEstRowsAccessed(getEstRowsAccessed());
 
diff --git a/core/sql/optimizer/RelFastTransport.cpp b/core/sql/optimizer/RelFastTransport.cpp
index 9981b6c..7365632 100644
--- a/core/sql/optimizer/RelFastTransport.cpp
+++ b/core/sql/optimizer/RelFastTransport.cpp
@@ -139,12 +139,20 @@
   unloadRelExpr->setIsMainQueryOperator(calledFromBinder);
   result = unloadRelExpr;
 
-  if (overwriteTable)
+  // keeping older Hive Truncate around for time being.
+  // Once newer method is tested, legacy will be removed.
+  NABoolean legacyHiveTruncate = FALSE;
+  char * leg = getenv("TRUNC_LEGACY");
+  if (leg)
+    legacyHiveTruncate = TRUE;
+  if (overwriteTable && legacyHiveTruncate)
     {
-      ExeUtilHiveTruncate *trunc = new (bindWA->wHeap())
-        ExeUtilHiveTruncate(tableDesc->getCorrNameObj(),
-                            NULL,
-                            bindWA->wHeap());
+      ExeUtilHiveTruncateLegacy *trunc = new (bindWA->wHeap())
+        ExeUtilHiveTruncateLegacy(tableDesc->getCorrNameObj(),
+                                  NULL,
+                                  bindWA->wHeap());
+      trunc->setNoSecurityCheck(TRUE);
+
       RelExpr * newRelExpr = trunc;
 
       if (tempTableForCSE)
@@ -180,6 +188,65 @@
       result = blockedUnion;
     }
 
+  if (overwriteTable && (NOT legacyHiveTruncate))
+    {
+      NAString hiveName = ComConvertTrafHiveNameToNativeHiveName
+        (tableDesc->getCorrNameObj().getQualifiedNameObj().getCatalogName(),
+         tableDesc->getCorrNameObj().getQualifiedNameObj().getSchemaName(),
+         tableDesc->getCorrNameObj().getQualifiedNameObj().getObjectName());
+
+      if (hiveName.isNull())
+        {
+          *CmpCommon::diags()
+            << DgSqlCode(-3242)
+            << DgString0("Invalid Hive name specified.");
+          bindWA->setErrStatus();
+          return NULL;
+        }
+
+      NAString hiveTruncQuery("truncate table ");
+      hiveTruncQuery += hiveName;
+
+      ExeUtilHiveTruncate *trunc = new (bindWA->wHeap())
+        ExeUtilHiveTruncate(tableDesc->getCorrNameObj(),
+                            hiveName,
+                            hiveTruncQuery,
+                            bindWA->wHeap());
+      trunc->setNoSecurityCheck(TRUE);
+
+      RelExpr * newRelExpr = trunc;
+
+      if (tempTableForCSE)
+        {
+          // This table gets created at compile time, unlike most
+          // other tables. It gets dropped when the statement is
+          // deallocated. Note that there are three problems:
+          // a) Statement gets never executed
+          // b) Process exits before deallocating the statement
+          // c) Statement gets deallocated, then gets executed again
+          //
+          // Todo: CSE: Handle these issues.
+          // Cases a) and b) are handled like volatile tables, there
+          // is a cleanup mechanism.
+          // Case c) gets handled by AQR.
+          trunc->setDropTableOnDealloc();
+        }
+
+      if (calledFromBinder)
+        //new root to prevent  error 4056 when binding
+        newRelExpr = new (bindWA->wHeap()) RelRoot(newRelExpr);
+      else
+        // this node must be bound, even outside the binder,
+        // to set some values
+        newRelExpr = newRelExpr->bindNode(bindWA);
+
+      Union *blockedUnion = new (bindWA->wHeap()) Union(newRelExpr, result);
+
+      blockedUnion->setBlockedUnion();
+      blockedUnion->setSerialUnion();
+      result = blockedUnion;
+    }
+
   return result;
 }
 
diff --git a/core/sql/optimizer/RelUpdate.h b/core/sql/optimizer/RelUpdate.h
index 1e0b9cd..a88aa64 100644
--- a/core/sql/optimizer/RelUpdate.h
+++ b/core/sql/optimizer/RelUpdate.h
@@ -1580,17 +1580,6 @@
 				     const QualifiedName &subjectTable,
 				     UpdateColumns *updateCols = NULL);
 
-  void setIsFastDelete(NABoolean v)
-  {
-    isFastDelete_ = v;
-  }
-  NABoolean isFastDelete()
-  {
-    return isFastDelete_;
-  }
-  
-  // ValueIdList    &lobDeleteExpr()          { return lobDeleteExpr_; }
-
   ConstStringList* &csl() { return csl_; }
 
   inline const CostScalar getEstRowsAccessed() const
@@ -1599,10 +1588,6 @@
   inline void setEstRowsAccessed(CostScalar r)  { estRowsAccessed_ = r; }
 
 private:
-  NABoolean isFastDelete_;
-
-  // ValueIdList  lobDeleteExpr_;
-
   ConstStringList * csl_;
   // Estimated number of rows accessed by Delete operator.
   CostScalar estRowsAccessed_;
diff --git a/core/sql/optimizer/SynthType.cpp b/core/sql/optimizer/SynthType.cpp
index f43526b..13f87da 100644
--- a/core/sql/optimizer/SynthType.cpp
+++ b/core/sql/optimizer/SynthType.cpp
@@ -4421,6 +4421,22 @@
 
     return NULL;
   }
+  if ( type != NA_DATETIME_TYPE )
+    {
+      enum rec_datetime_field eField = getExtractField();
+      NAString sErr;
+      if ( REC_DATE_WEEK == eField
+          || REC_DATE_DOW == eField
+          || REC_DATE_DOY == eField
+          || REC_DATE_WOM == eField
+          || REC_DATE_CENTURY == eField)
+        sErr = dti.getFieldName(eField);
+      if (sErr.length() > 0)
+        {
+          *CmpCommon::diags() << DgSqlCode(-4496) << DgString0(sErr);
+          return NULL;
+        }
+    }
   // ANSI 6.6 SR 3a.
   enum rec_datetime_field extractStartField = getExtractField();
   enum rec_datetime_field extractEndField = extractStartField;
@@ -4444,16 +4460,19 @@
         }
     }
 
-  if (dti.getStartField() > extractStartField ||
-      dti.getEndField()   < extractEndField ||
-      !dti.isSupportedType()) {
-    // 4037 cannot extract field from type
-    *CmpCommon::diags() << DgSqlCode(-4037)
-       << DgString0(dti.getFieldName(getExtractField()))
-       << DgString1(dti.getTypeSQLname(TRUE /*terse*/));
+  if ( !(extractStartField >=REC_DATE_CENTURY && extractStartField<=REC_DATE_WOM) )
+    {
+      if (dti.getStartField() > extractStartField ||
+          dti.getEndField()   < extractEndField ||
+          !dti.isSupportedType()) {
+        // 4037 cannot extract field from type
+        *CmpCommon::diags() << DgSqlCode(-4037)
+           << DgString0(dti.getFieldName(getExtractField()))
+           << DgString1(dti.getTypeSQLname(TRUE /*terse*/));
 
-    return NULL;
-  }
+        return NULL;
+      }
+    }
   // ANSI 6.6 SR 4.  Precision is implementation-defined:
   // EXTRACT(YEAR       from datetime):  result precision is 4 + scale
   // EXTRACT(other      from datetime):  result precision is 2 + scale
@@ -4475,15 +4494,33 @@
   else if (getExtractField() == REC_DATE_YEARWEEK_EXTRACT ||
            getExtractField() == REC_DATE_YEARWEEK_D_EXTRACT)
     prec = 6;					// YEARMWEEK is yyyyww
+  else if (getExtractField() == REC_DATE_DECADE ||
+           getExtractField() == REC_DATE_DOY)
+    prec = 3;
+  else if (getExtractField() == REC_DATE_QUARTER ||
+           getExtractField() == REC_DATE_DOW)
+    prec = 1;
+  else if (getExtractField() == REC_DATE_EPOCH)
+    prec = 10;
   else
     prec = 2;					// else max of 12, 31, 24, 59
   if (getExtractField() == REC_DATE_SECOND) {
     prec  += dti.getFractionPrecision();
     scale += dti.getFractionPrecision();
   }
+  if (getExtractField() == REC_DATE_EPOCH)
+    {
+      prec  += dti.getFractionPrecision();
+      scale += dti.getFractionPrecision();
+    }
+  NABoolean bNegValue = FALSE;
+  if (getExtractField() == REC_DATE_DECADE
+      || getExtractField() == REC_DATE_QUARTER
+      || getExtractField() == REC_DATE_EPOCH )
+    bNegValue = TRUE;
   const Int16 disAmbiguate = 0; // added for 64bit project
   return new HEAP
-    SQLNumeric(HEAP, type == NA_INTERVAL_TYPE, /*allowNegValues*/
+    SQLNumeric(HEAP, (type == NA_INTERVAL_TYPE) || bNegValue, /*allowNegValues*/
 	       prec,
 	       scale,
                disAmbiguate,
@@ -7107,3 +7144,72 @@
    return result;
 }
 
+const NAType * SplitPart::synthesizeType()
+{
+  ValueId vid1 = child(0)->getValueId(); 
+  ValueId vid2 = child(1)->getValueId();
+  ValueId vid3 = child(2)->getValueId();
+  vid1.coerceType(NA_CHARACTER_TYPE);
+  vid2.coerceType(NA_CHARACTER_TYPE);
+  SQLInt si(NULL);
+  vid3.coerceType(NA_NUMERIC_TYPE);
+
+  const NAType *operand1 = &child(0)->getValueId().getType();
+  const NAType *operand2 = &child(1)->getValueId().getType();
+  const NAType *operand3 = &child(2)->getValueId().getType();
+
+  if ((operand1->getTypeQualifier() != NA_CHARACTER_TYPE) 
+      && (operand1->getFSDatatype() != REC_CLOB))
+  {
+    //4051 The first operand of a split_part function must be character.
+    *CmpCommon::diags()<<DgSqlCode(-4051) << DgString0(getTextUpper());
+    return NULL;
+  }
+  if ((operand2->getTypeQualifier() != NA_CHARACTER_TYPE)
+      && (operand1->getFSDatatype() != REC_CLOB))
+  {
+    //4497 The second operand of a split_part function must be character.
+    *CmpCommon::diags()<<DgSqlCode(-4497) << DgString0("second")
+                                          << DgString1(getTextUpper())
+                                          << DgString2("character");
+    return NULL;
+  }
+
+  if (operand3->getTypeQualifier() != NA_NUMERIC_TYPE)
+  {
+    //4053 The third operand of a split_part function must be numeric.
+    *CmpCommon::diags() << DgSqlCode(-4053) << DgString0(getTextUpper());
+    return NULL;
+  }
+
+  const CharType *charOperand = (CharType *)operand1; 
+  Lng32 maxLength_bytes = charOperand->getDataStorageSize();
+  Lng32 maxLength_chars = charOperand->getPrecisionOrMaxNumChars();
+  CharInfo::CharSet op1_cs = operand1->getCharSet();
+  if (maxLength_chars <= 0) //if unlimited
+    maxLength_chars = maxLength_bytes/CharInfo::minBytesPerChar(op1_cs);
+
+  if (operand1->getFSDatatype() == REC_CLOB)
+  {
+    return new HEAP SQLClob(HEAP
+                            , maxLength_bytes
+                            , Lob_Invalid_Storage
+                            , operand1->supportsSQLnull()
+                                OR operand2->supportsSQLnull()
+                                OR operand3->supportsSQLnull()
+                           );
+  } 
+
+  return new HEAP SQLVarChar(HEAP
+                             , CharLenInfo(maxLength_chars, maxLength_bytes)
+                             , operand1->supportsSQLnull()
+                                 OR operand2->supportsSQLnull()
+                                 OR operand3->supportsSQLnull()
+                             , charOperand->isUpshifted()
+                             , charOperand->isCaseinsensitive()
+                             , operand1->getCharSet()
+                             , charOperand->getCollation()
+                             , charOperand->getCoercibility()
+                             );
+
+}
diff --git a/core/sql/parser/ElemDDLLikeOptions.cpp b/core/sql/parser/ElemDDLLikeOptions.cpp
index a252ffc..8e6d7e3 100644
--- a/core/sql/parser/ElemDDLLikeOptions.cpp
+++ b/core/sql/parser/ElemDDLLikeOptions.cpp
@@ -297,37 +297,6 @@
   return "ElemDDLLikeOptWithoutLobColumns";
 }
 
-// -----------------------------------------------------------------------
-// methods for class ElemDDLLikeOptWithHiveOptions
-// -----------------------------------------------------------------------
-
-ElemDDLLikeOptWithHiveOptions::ElemDDLLikeOptWithHiveOptions(NAString &hiveOptionsText)
-     : ElemDDLLikeOpt(ELM_LIKE_OPT_WITH_HIVE_OPTIONS),
-       hiveOptionsText_(hiveOptionsText)
-{
-}
-
-// virtual destructor
-ElemDDLLikeOptWithHiveOptions::~ElemDDLLikeOptWithHiveOptions()
-{
-}
-
-// casting
-ElemDDLLikeOptWithHiveOptions * ElemDDLLikeOptWithHiveOptions::castToElemDDLLikeOptWithHiveOptions()
-{
-  return this;
-}
-
-//
-// methods for tracing
-//
-
-const NAString ElemDDLLikeOptWithHiveOptions::getText() const
-{
-  return "ElemDDLLikeOptWithHiveOptions";
-}
-
-
 //
 // End of File
 //
diff --git a/core/sql/parser/ElemDDLLikeOptions.h b/core/sql/parser/ElemDDLLikeOptions.h
index 8288385..ef06865 100644
--- a/core/sql/parser/ElemDDLLikeOptions.h
+++ b/core/sql/parser/ElemDDLLikeOptions.h
@@ -348,37 +348,4 @@
 
 }; // class ElemDDLLikeOptWithoutLobColumns
 
-// -----------------------------------------------------------------------
-// definition of class ElemDDLLikeOptWithHiveOptions
-// These are options that are specified during create through the use of
-//   'with hive options' syntax.
-// These are hive specific options that are passed to hive layer during
-// creation of table. These are not interpreted by traf layer.
-//
-//  create external hive table <htab> like <traf-table> 
-//     with hive options 'hive-options'
-// -----------------------------------------------------------------------
-class ElemDDLLikeOptWithHiveOptions : public ElemDDLLikeOpt
-{
-
-public:
-
-  // constructor
-  ElemDDLLikeOptWithHiveOptions(NAString &hiveOptionsText);
-
-  // virtual destructor
-  virtual ~ElemDDLLikeOptWithHiveOptions();
-
-  // cast
-  virtual ElemDDLLikeOptWithHiveOptions * castToElemDDLLikeOptWithHiveOptions();
-
-  // method for tracing
-  virtual const NAString getText() const;
-
-  const NAString &getHiveOptionsText() const { return hiveOptionsText_;}
-
-private:
-  NAString hiveOptionsText_;
-}; // class ElemDDLLikeOptWithHiveOptions
-
 #endif // ELEMDDLLIKEOPTIONS_H
diff --git a/core/sql/parser/ElemDDLNode.h b/core/sql/parser/ElemDDLNode.h
index fee5408..d00200f 100644
--- a/core/sql/parser/ElemDDLNode.h
+++ b/core/sql/parser/ElemDDLNode.h
@@ -140,7 +140,6 @@
 class ElemDDLLikeLimitColumnLength;
 class ElemDDLLikeOptWithoutRowFormat;
 class ElemDDLLikeOptWithoutLobColumns;
-class ElemDDLLikeOptWithHiveOptions;
 class ElemDDLList;
 class ElemDDLLocation;
 class ElemDDLOptionList;
@@ -469,8 +468,6 @@
   virtual ElemDDLLikeLimitColumnLength  * castToElemDDLLikeLimitColumnLength();
   virtual ElemDDLLikeOptWithoutRowFormat* castToElemDDLLikeOptWithoutRowFormat();
   virtual ElemDDLLikeOptWithoutLobColumns * castToElemDDLLikeOptWithoutLobColumns();
-  virtual ElemDDLLikeOptWithHiveOptions * castToElemDDLLikeOptWithHiveOptions()
-  {return NULL;}
   virtual ElemDDLList                   * castToElemDDLList();
   virtual ElemDDLLocation               * castToElemDDLLocation();
   virtual ElemDDLOptionList             * castToElemDDLOptionList();
diff --git a/core/sql/parser/ParDDLLikeOpts.cpp b/core/sql/parser/ParDDLLikeOpts.cpp
index b7b4ca4..fee16e2 100644
--- a/core/sql/parser/ParDDLLikeOpts.cpp
+++ b/core/sql/parser/ParDDLLikeOpts.cpp
@@ -116,7 +116,6 @@
   isLikeOptLimitColumnLengthSpec_ = likeOptions.isLikeOptLimitColumnLengthSpec_;
   isLikeOptWithoutRowFormatSpec_  = likeOptions.isLikeOptWithoutRowFormatSpec_;
   isLikeOptWithoutLobColumnsSpec_  = likeOptions.isLikeOptWithoutLobColumnsSpec_;
-  isLikeOptWithHiveOptionsSpec_ = likeOptions.isLikeOptWithHiveOptionsSpec_;
 
   isLikeOptWithComments_        = likeOptions.isLikeOptWithComments_;
   isLikeOptWithoutConstraints_  = likeOptions.isLikeOptWithoutConstraints_;
@@ -166,7 +165,6 @@
   isLikeOptLimitColumnLengthSpec_ = FALSE;
   isLikeOptWithoutRowFormatSpec_  = FALSE;
   isLikeOptWithoutLobColumnsSpec_  = FALSE;
-  isLikeOptWithHiveOptionsSpec_  = FALSE;
 
   isLikeOptWithComments_        = FALSE;
   isLikeOptWithoutConstraints_  = FALSE;
@@ -316,18 +314,6 @@
     isLikeOptWithoutLobColumnsSpec_ = TRUE;
     break;
 
-  case ELM_LIKE_OPT_WITH_HIVE_OPTIONS :
-    if (isLikeOptWithHiveOptionsSpec_)
-    {
-      // ERROR[3152] Duplicate WITH HIVE OPTIONS phrases were specified
-      //             in LIKE clause in CREATE TABLE statement.
-      *SqlParser_Diags << DgSqlCode(-3152) << DgString0("HIVE OPTIONS");
-    }
-    ComASSERT(pLikeOption->castToElemDDLLikeOptWithHiveOptions() != NULL);
-    likeOptHiveOptions_ = pLikeOption->castToElemDDLLikeOptWithHiveOptions()->getHiveOptionsText();
-    isLikeOptWithHiveOptionsSpec_ = TRUE;
-    break;
-
   default :
     NAAbort("ParDDLLikeOpts.C", __LINE__, "internal logic error");
     break;
diff --git a/core/sql/parser/ParDDLLikeOptsCreateTable.h b/core/sql/parser/ParDDLLikeOptsCreateTable.h
index 03d089a..0022ddf 100644
--- a/core/sql/parser/ParDDLLikeOptsCreateTable.h
+++ b/core/sql/parser/ParDDLLikeOptsCreateTable.h
@@ -252,7 +252,6 @@
   NABoolean isLikeOptLimitColumnLengthSpec_;
   NABoolean isLikeOptWithoutRowFormatSpec_;
   NABoolean isLikeOptWithoutLobColumnsSpec_;
-  NABoolean isLikeOptWithHiveOptionsSpec_;
 
   // legal Like options in DDL Create Table statements
 
diff --git a/core/sql/parser/ParKeyWords.cpp b/core/sql/parser/ParKeyWords.cpp
index d2a8d1c..85b97e7 100644
--- a/core/sql/parser/ParKeyWords.cpp
+++ b/core/sql/parser/ParKeyWords.cpp
@@ -42,6 +42,46 @@
 // key words.
 // 001103 EJF
 
+// Important notes for developers:
+//
+// If you are adding a keyword to Trafodion, you need to do the following:
+//
+// 1. Add it to the keyword table below. Use the appropriate flags in the
+//    ParKeyWord object for your new keyword. (Note: Today the RESWORD_,
+//    NONRESWORD_ and NONRESTOKEN_ flags are almost purely for documentation;
+//    the real determination of whether a keyword is reserved or not depends
+//    on how it is used in sqlparser.y. See point 3 below. Nevertheless,
+//    it is useful documentation, and it might be used in the future, so
+//    do try to get this right.)
+// 2. Add a token definition for it to the parser (sqlparser.y). Add
+//    and/or change any productions as needed to use your new token.
+// 3. If your new keyword is *not* a reserved word (which is the usual case),
+//    add it to the appropriate non-reserved word production in the parser.
+//    That will allow the keyword to be used as a regular identifier in
+//    contexts where keyword behavior is not intended. This avoids regressing
+//    customer applications that might already be using that keyword as a 
+//    regular identifier. See sqlparser.y, productions nonreserved_word and
+//    nonreserved_func_word.
+// 4. If your new keyword *is* a reserved word (this case should be rare),
+//    add your keyword to the list of reserved words in ComResWords::resWords_
+//    in common/ComResWords.cpp. This is important so that when an internal
+//    representation of your keyword is used as an identifier, it will get
+//    double quotes when converted to an external identifier. Failing to do
+//    this will cause errors in some statements if your new keyword is used
+//    as a delimited identifier.
+// 5. If your new keyword commonly has a parenthesis after it, and it is
+//    most natural for the parenthesis to be placed right after the keyword
+//    (as opposed to having a space between keyword and paranthesis), then
+//    add it to the keywords table in function tokIsFuncOrParenKeyword in
+//    common/NAString.cpp. An example of this case is a new function name.
+//    If my new function is XYZ, it looks more natural to generate XYZ(1)
+//    rather than XYZ (1) in generated SQL text. An example of a case where
+//    you would *not* want to do this might be adding a new logical operator
+//    such as XOR. (A OR B) XOR (C OR D) looks more natural than 
+//    (A OR B) XOR(C OR D). This is really an issue of esthetics rather than
+//    correctness so this is not as critical as the previous four points.
+// 6. Add test cases to regress/core/TEST037 of your new keyword.
+
 // The keyword table:
 //
 ParKeyWord ParKeyWords::keyWords_[] = {
@@ -70,7 +110,7 @@
   ParKeyWord("ALIAS",              TOK_ALIAS,       POTANS_|RESWORD_),
   ParKeyWord("ALIGNED",            TOK_ALIGNED,     NONRESTOKEN_),
   ParKeyWord("ALIGNED_LENGTH",     TOK_ALIGNED_LENGTH,     NONRESTOKEN_),
-  ParKeyWord("ALL",                TOK_ALL,         ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("ALL",                TOK_ALL,         ANS_|RESWORD_),
   ParKeyWord("ALL_DDL",            TOK_ALL_DDL,     NONRESTOKEN_),
   ParKeyWord("ALL_DML",            TOK_ALL_DML,     NONRESTOKEN_),
   ParKeyWord("ALL_UTILITY",        TOK_ALL_UTILITY, NONRESTOKEN_),
@@ -88,16 +128,16 @@
   ParKeyWord("ALTER_TABLE",        TOK_ALTER_TABLE,	NONRESTOKEN_),
   ParKeyWord("ALTER_TRIGGER",      TOK_ALTER_TRIGGER,	NONRESTOKEN_),
   ParKeyWord("ALTER_VIEW",         TOK_ALTER_VIEW,	NONRESTOKEN_),
-  ParKeyWord("AND",                TOK_AND,         ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("AND",                TOK_AND,         ANS_|RESWORD_),
   ParKeyWord("ANSIVARCHAR",        TOK_ANSIVARCHAR, NONRESTOKEN_),
-  ParKeyWord("ANY",                TOK_ANY,         ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("ANY",                TOK_ANY,         ANS_|RESWORD_),
   ParKeyWord("APPEND",             TOK_APPEND,      NONRESTOKEN_),
   ParKeyWord("AQR",                TOK_AQR,         NONRESTOKEN_),
   ParKeyWord("AREA",               TOK_AREA,        NONRESTOKEN_),
   ParKeyWord("ARRAY",              TOK_ARRAY,       COMPAQ_|RESWORD_),
   ParKeyWord("ARE",                TOK_ARE,         ANS_|RESWORD_),
-  ParKeyWord("AS",                 TOK_AS,          ANS_|RESWORD_|MPWORD_),
-  ParKeyWord("ASC",                TOK_ASC,         ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("AS",                 TOK_AS,          ANS_|RESWORD_),
+  ParKeyWord("ASC",                TOK_ASC,         ANS_|RESWORD_),
   ParKeyWord("ASCENDING",          TOK_ASCENDING,   NONRESTOKEN_),
   ParKeyWord("ASCII",              TOK_ASCII,       NONRESTOKEN_),
   ParKeyWord("ASIN",               TOK_ASIN,        NONRESTOKEN_),
@@ -121,12 +161,12 @@
   ParKeyWord("AUTOCOMMIT",         TOK_AUTOCOMMIT,  NONRESTOKEN_),
   ParKeyWord("AUTOMATIC",          TOK_AUTOMATIC, FLAGSNONE_),
   ParKeyWord("AVERAGE_STREAM_WAIT", TOK_AVERAGE_STREAM_WAIT, NONRESTOKEN_),
-  ParKeyWord("AVG",                TOK_AVG,         ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("AVG",                TOK_AVG,         ANS_|RESWORD_),
   ParKeyWord("BACKUP",             TOK_BACKUP,      NONRESTOKEN_),
   ParKeyWord("BALANCE",            TOK_BALANCE,     NONRESTOKEN_),
   ParKeyWord("BEFORE",             TOK_BEFORE,      ANS_|RESWORD_|NONRESTOKEN_),
-  ParKeyWord("BEGIN",              TOK_BEGIN,       ANS_|RESWORD_|MPWORD_),
-  ParKeyWord("BETWEEN",            TOK_BETWEEN,     SECOND_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("BEGIN",              TOK_BEGIN,       ANS_|RESWORD_),
+  ParKeyWord("BETWEEN",            TOK_BETWEEN,     SECOND_|ANS_|RESWORD_),
   ParKeyWord("BIGINT",             TOK_BIGINT,      NONRESTOKEN_),
   ParKeyWord("BINARY",             TOK_BINARY,      COMPAQ_|RESWORD_),
   ParKeyWord("BIT",                TOK_BIT,         ANS_|RESWORD_),
@@ -140,14 +180,14 @@
   ParKeyWord("BLOCKS",             TOK_BLOCKS,      NONRESTOKEN_),
   ParKeyWord("BLOCKSIZE",          TOK_BLOCKSIZE,   NONRESTOKEN_),
   ParKeyWord("BOOLEAN",            TOK_BOOLEAN,     RESWORD_),
-  ParKeyWord("BOTH",               TOK_BOTH,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("BOTH",               TOK_BOTH,        ANS_|RESWORD_),
   ParKeyWord("BREADTH",            IDENTIFIER,      POTANS_|RESWORD_),
   ParKeyWord("BRIEF",              TOK_BRIEF,       NONRESTOKEN_),
   ParKeyWord("BT",                 TOK_BT,          NONRESTOKEN_),
   ParKeyWord("BUFFER",             TOK_BUFFER,      NONRESTOKEN_),
   ParKeyWord("BUFFERED",           TOK_BUFFERED,    NONRESTOKEN_),
   ParKeyWord("BUFFERTOLOB",        TOK_BUFFERTOLOB, NONRESTOKEN_),
-  ParKeyWord("BY",                 TOK_BY,          SECOND_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("BY",                 TOK_BY,          SECOND_|ANS_|RESWORD_),
   ParKeyWord("BYTE",               TOK_BYTE,        NONRESTOKEN_),
   ParKeyWord("BYTEINT",            TOK_BYTEINT,     NONRESTOKEN_),
   ParKeyWord("BYTES",              TOK_BYTES,       NONRESTOKEN_),
@@ -160,28 +200,29 @@
   ParKeyWord("CARDINALITY",        TOK_CARDINALITY, NONRESTOKEN_),
   ParKeyWord("CASCADE",            TOK_CASCADE,     ANS_|RESWORD_),
   ParKeyWord("CASCADED",           TOK_CASCADED,    ANS_|RESWORD_),
-  ParKeyWord("CASE",               TOK_CASE,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("CASE",               TOK_CASE,        ANS_|RESWORD_),
   ParKeyWord("CASESPECIFIC",       TOK_CASESPECIFIC, SECOND_|NONRESTOKEN_),  
   ParKeyWord("CAST",               TOK_CAST,        ANS_|RESWORD_|NONRESTOKEN_),
-  ParKeyWord("CATALOG",            TOK_CATALOG,     ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("CATALOG",            TOK_CATALOG,     ANS_|RESWORD_),
   ParKeyWord("CATALOGS",           TOK_CATALOGS,    NONRESTOKEN_),
   ParKeyWord("CATALOG_NAME",       TOK_CATALOG_NAME, NONRESTOKEN_),
   ParKeyWord("CATCHUP",            TOK_CATCHUP,     FLAGSNONE_),
   ParKeyWord("CEIL",               TOK_CEIL,        NONRESTOKEN_),
   ParKeyWord("CEILING",            TOK_CEILING,     NONRESTOKEN_),
+  ParKeyWord("CENTURY",            TOK_CENTURY,     NONRESTOKEN_),
   ParKeyWord("CHANGED",            TOK_CHANGED,     NONRESTOKEN_),
   ParKeyWord("CHANGES",            TOK_CHANGES,     FLAGSNONE_),
-  ParKeyWord("CHAR",               TOK_CHAR,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("CHAR",               TOK_CHAR,        ANS_|RESWORD_),
   ParKeyWord("CHARS",              TOK_CHARS,       NONRESTOKEN_),
   ParKeyWord("CHR",                TOK_CHR,         NONRESTOKEN_),
-  ParKeyWord("CHARACTER",          TOK_CHARACTER,   ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("CHARACTER",          TOK_CHARACTER,   ANS_|RESWORD_),
   ParKeyWord("CHARACTERS",         TOK_CHARACTERS,  NONRESTOKEN_),
   ParKeyWord("CHARACTER_LENGTH",   TOK_CHAR_LENGTH, ANS_|RESWORD_|NONRESTOKEN_),
   ParKeyWord("CHARACTER_SET_CATALOG", TOK_CHARACTER_SET_CATALOG, NONRESTOKEN_),
   ParKeyWord("CHARACTER_SET_NAME", TOK_CHARACTER_SET_NAME, NONRESTOKEN_),
   ParKeyWord("CHARACTER_SET_SCHEMA", TOK_CHARACTER_SET_SCHEMA, NONRESTOKEN_),
   ParKeyWord("CHAR_LENGTH",        TOK_CHAR_LENGTH, ANS_|RESWORD_|NONRESTOKEN_),
-  ParKeyWord("CHECK",              TOK_CHECK,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("CHECK",              TOK_CHECK,       ANS_|RESWORD_),
   ParKeyWord("CHECKSUM",           TOK_CHECKSUM,    NONRESTOKEN_),
   ParKeyWord("CLASS",              TOK_CLASS,       COMPAQ_|RESWORD_),
   ParKeyWord("CLASS_ORIGIN",       TOK_CLASS_ORIGIN, NONRESTOKEN_),
@@ -190,7 +231,7 @@
   ParKeyWord("CLEAR",              TOK_CLEAR,       NONRESTOKEN_),
   ParKeyWord("CLEARONPURGE",       TOK_CLEARONPURGE, NONRESTOKEN_),
   ParKeyWord("CLOB",               TOK_CLOB,        COMPAQ_|RESWORD_),
-  ParKeyWord("CLOSE",              TOK_CLOSE,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("CLOSE",              TOK_CLOSE,       ANS_|RESWORD_),
   ParKeyWord("CLUSTER",            TOK_CLUSTER,     NONRESTOKEN_),
   ParKeyWord("CLUSTERING",         TOK_CLUSTERING,    NONRESTOKEN_),
   ParKeyWord("CLUSTERS",           TOK_CLUSTERS,    NONRESTOKEN_),
@@ -198,7 +239,7 @@
   ParKeyWord("CMP",                TOK_ARKCMP,      NONRESTOKEN_),
   ParKeyWord("COALESCE",           TOK_COALESCE,    ANS_|RESWORD_),
   ParKeyWord("CODE_VALUE",         TOK_CODE_VALUE,  NONRESTOKEN_),
-  ParKeyWord("COLLATE",            TOK_COLLATE,     ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("COLLATE",            TOK_COLLATE,     ANS_|RESWORD_),
   ParKeyWord("COLLATION",          TOK_COLLATION,   ANS_|RESWORD_),
   ParKeyWord("COLLATION_CATALOG",  TOK_COLLATION_CATALOG, NONRESTOKEN_),
   ParKeyWord("COLLATION_NAME",     TOK_COLLATION_NAME, NONRESTOKEN_),
@@ -213,7 +254,7 @@
   ParKeyWord("COMMAND_FUNCTION",   TOK_COMMAND_FUNCTION, NONRESTOKEN_),
   ParKeyWord("COMMANDS",           TOK_COMMANDS, NONRESTOKEN_),
   ParKeyWord("COMMENT",            TOK_COMMENT, NONRESTOKEN_),
-  ParKeyWord("COMMIT",             TOK_COMMIT,      SECOND_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("COMMIT",             TOK_COMMIT,      SECOND_|ANS_|RESWORD_),
   ParKeyWord("COMMITTED",          TOK_COMMITTED,   NONRESTOKEN_),
   ParKeyWord("COMP",               TOK_COMP,        NONRESTOKEN_),
   ParKeyWord("COMPACT",            TOK_COMPACT,     NONRESTOKEN_),
@@ -253,7 +294,7 @@
   ParKeyWord("COS",                TOK_COS,         NONRESTOKEN_),
   ParKeyWord("COSH",               TOK_COSH,        NONRESTOKEN_),
   ParKeyWord("COST",               TOK_COST,        NONRESTOKEN_),
-  ParKeyWord("COUNT",              TOK_COUNT,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("COUNT",              TOK_COUNT,       ANS_|RESWORD_),
   ParKeyWord("COPY",               TOK_COPY,        NONRESTOKEN_),
   ParKeyWord("CPU",                TOK_CPU,         NONRESTOKEN_),
   ParKeyWord("CQD",                TOK_CQD,         NONRESTOKEN_),
@@ -272,7 +313,7 @@
   ParKeyWord("CROSS",              TOK_CROSS,       ANS_|RESWORD_),
   ParKeyWord("CUBE",               TOK_CUBE,        COMPAQ_|RESWORD_),
   ParKeyWord("CURDATE",            TOK_CURDATE,     NONRESTOKEN_),
-  ParKeyWord("CURRENT",            TOK_CURRENT,     ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("CURRENT",            TOK_CURRENT,     ANS_|RESWORD_),
   ParKeyWord("CURRENT_DATE",       TOK_CURRENT_DATE, ANS_|RESWORD_),
   ParKeyWord("CURRENT_PATH",       TOK_CURRENT_PATH, COMPAQ_|RESWORD_),
   ParKeyWord("CURRENT_RUNNING",    TOK_CURRENT_RUNNING,     NONRESTOKEN_),
@@ -283,7 +324,7 @@
   ParKeyWord("CURRENT_TIME_UTC",   TOK_CURRENT_TIME_UTC,     NONRESTOKEN_),
   ParKeyWord("CURRENT_USER",       TOK_CURRENT_USER, ANS_|RESWORD_),
   ParKeyWord("CURRNT_USR_INTN",    TOK_CURRNT_USR_INTN, RESWORD_),
-  ParKeyWord("CURSOR",             TOK_CURSOR,      FIRST_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("CURSOR",             TOK_CURSOR,      FIRST_|ANS_|RESWORD_),
   ParKeyWord("CURSOR_NAME",        TOK_CURSOR_NAME, NONRESTOKEN_),
   ParKeyWord("CURTIME",            TOK_CURTIME,     NONRESTOKEN_),
   ParKeyWord("CYCLE",              TOK_CYCLE,       ANS_|RESWORD_),
@@ -296,7 +337,7 @@
 
   ParKeyWord("DATABASE",           TOK_DATABASE,    NONRESTOKEN_),
   ParKeyWord("DATA_OFFSET",        TOK_DATA_OFFSET, NONRESTOKEN_),
-  ParKeyWord("DATE",               TOK_DATE,        FIRST_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("DATE",               TOK_DATE,        FIRST_|ANS_|RESWORD_),
   ParKeyWord("DATEADD",            TOK_DATEADD,     NONRESTOKEN_),
   ParKeyWord("DATE_ADD",           TOK_DATE_ADD,    NONRESTOKEN_),
   ParKeyWord("DATE_PART",          TOK_DATE_PART,   NONRESTOKEN_),
@@ -304,9 +345,9 @@
   ParKeyWord("DATEDIFF",           TOK_DATEDIFF,    NONRESTOKEN_),
   ParKeyWord("DATE_SUB",           TOK_DATE_SUB,    NONRESTOKEN_),
   ParKeyWord("DATEFORMAT",         TOK_DATEFORMAT,  NONRESTOKEN_),
-  ParKeyWord("DATETIME",           TOK_DATETIME,    COMPAQ_|RESWORD_|MPWORD_),
+  ParKeyWord("DATETIME",           TOK_DATETIME,    COMPAQ_|RESWORD_),
   ParKeyWord("DATETIME_CODE",      TOK_DATETIME_CODE, NONRESTOKEN_),
-  ParKeyWord("DAY",                TOK_DAY,         ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("DAY",                TOK_DAY,         ANS_|RESWORD_),
   ParKeyWord("DAYNAME",            TOK_DAYNAME,     NONRESTOKEN_),
   ParKeyWord("DAYOFMONTH",         TOK_DAYOFMONTH,  NONRESTOKEN_),
   ParKeyWord("DAYOFWEEK",          TOK_DAYOFWEEK,   NONRESTOKEN_),
@@ -318,11 +359,12 @@
   ParKeyWord("DE",                 TOK_DE,          FLAGSNONE_),
   ParKeyWord("DEALLOCATE",         TOK_DEALLOCATE,  ANS_|RESWORD_),
   ParKeyWord("DEBUG",              TOK_DEBUG,       NONRESTOKEN_),
-  ParKeyWord("DEC",                TOK_DECIMAL,     ANS_|RESWORD_|MPWORD_),
-  ParKeyWord("DECIMAL",            TOK_DECIMAL,     ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("DEC",                TOK_DECIMAL,     ANS_|RESWORD_),
+  ParKeyWord("DECIMAL",            TOK_DECIMAL,     ANS_|RESWORD_),
+  ParKeyWord("DECADE",             TOK_DECADE,      NONRESTOKEN_),
   ParKeyWord("DECODE",             TOK_DECODE,      NONRESTOKEN_),
-  ParKeyWord("DECLARE",            TOK_DECLARE,     ANS_|RESWORD_|MPWORD_),
-  ParKeyWord("DEFAULT",            TOK_DEFAULT,     SECOND_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("DECLARE",            TOK_DECLARE,     ANS_|RESWORD_),
+  ParKeyWord("DEFAULT",            TOK_DEFAULT,     SECOND_|ANS_|RESWORD_),
   ParKeyWord("DEFAULTS",           TOK_DEFAULTS,    NONRESTOKEN_),
   ParKeyWord("DEFERRABLE",         IDENTIFIER,      ANS_|RESWORD_),
   ParKeyWord("DEFERRED",           IDENTIFIER,      ANS_|RESWORD_),
@@ -330,13 +372,13 @@
   ParKeyWord("DEFINITION",         TOK_DEFINITION,  NONRESTOKEN_),
   ParKeyWord("DEGREES",            TOK_DEGREES,     NONRESTOKEN_),
   ParKeyWord("DELAY",              TOK_DELAY,       NONRESTOKEN_),
-  ParKeyWord("DELETE",             TOK_DELETE,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("DELETE",             TOK_DELETE,      ANS_|RESWORD_),
   ParKeyWord("DELIMITER",          TOK_DELIMITER,   NONRESTOKEN_),
   ParKeyWord("DEPENDENT", 	   TOK_DEPENDENT,   NONRESTOKEN_),
   ParKeyWord("DENSE_RANK",         TOK_D_RANK,      NONRESTOKEN_),
   ParKeyWord("DEPTH",              IDENTIFIER,      POTANS_|RESWORD_),
   ParKeyWord("DEREF",              TOK_DEREF,       COMPAQ_|RESWORD_),
-  ParKeyWord("DESC",               TOK_DESC,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("DESC",               TOK_DESC,        ANS_|RESWORD_),
   ParKeyWord("DESCENDING",         TOK_DESCENDING,  NONRESTOKEN_),
   ParKeyWord("DESCRIBE",           TOK_DESCRIBE,    ANS_|RESWORD_),
   ParKeyWord("DESCRIPTOR",         TOK_DESCRIPTOR,  ANS_|RESWORD_),
@@ -354,12 +396,14 @@
   ParKeyWord("DISCONNECT",         IDENTIFIER,      ANS_|RESWORD_),
   ParKeyWord("DISK",		   TOK_DISK,        NONRESTOKEN_),
   ParKeyWord("DISPLAY",            TOK_DISPLAY,     NONRESTOKEN_),
-  ParKeyWord("DISTINCT",           TOK_DISTINCT,    ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("DISTINCT",           TOK_DISTINCT,    ANS_|RESWORD_),
   ParKeyWord("DIVISION",           TOK_DIVISION,    NONRESTOKEN_),
   ParKeyWord("DO",                 TOK_DO,          NONRESTOKEN_),
   ParKeyWord("DOMAIN",             IDENTIFIER,      ANS_|RESWORD_),
   ParKeyWord("DOUBLE",             TOK_DOUBLE,      ANS_|RESWORD_|NONRESTOKEN_),
   ParKeyWord("DOUBLE_IEEE",        TOK_DOUBLE_IEEE, NONRESTOKEN_),
+  ParKeyWord("DOW",                TOK_DOW,         NONRESTOKEN_),
+  ParKeyWord("DOY",                TOK_DOY,         NONRESTOKEN_),
   ParKeyWord("DROP",               TOK_DROP,        ANS_|RESWORD_),
   ParKeyWord("DROPPABLE",          TOK_DROPPABLE,   SECOND_|NONRESTOKEN_),
   ParKeyWord("DROP_LIBRARY",       TOK_DROP_LIBRARY,	  NONRESTOKEN_),
@@ -393,9 +437,10 @@
   ParKeyWord("ENVVAR",             TOK_ENVVAR,      NONRESTOKEN_),
   ParKeyWord("ENVVARS",            TOK_ENVVARS,     NONRESTOKEN_),
   ParKeyWord("EOF",                TOK_EOF,         NONRESTOKEN_),
+  ParKeyWord("EPOCH",              TOK_EPOCH,       NONRESTOKEN_),
   ParKeyWord("EQUALS",             IDENTIFIER,      POTANS_|RESWORD_),
   ParKeyWord("ERROR",              TOK_ERROR,       NONRESTOKEN_),
-  ParKeyWord("ESCAPE",             TOK_ESCAPE,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("ESCAPE",             TOK_ESCAPE,      ANS_|RESWORD_),
   ParKeyWord("ET",                 TOK_ET,          NONRESTOKEN_),
   ParKeyWord("EUROPEAN",           TOK_EUROPEAN,    NONRESTOKEN_),
   ParKeyWord("EVERY",              TOK_EVERY,       NONRESTOKEN_),
@@ -409,7 +454,7 @@
   ParKeyWord("EXECUTE",            TOK_EXECUTE,     ANS_|RESWORD_),
   ParKeyWord("EXECUTION",          TOK_EXECUTION,   NONRESTOKEN_),
   ParKeyWord("EXISTING",           TOK_EXISTING,    NONRESTOKEN_),
-  ParKeyWord("EXISTS",             TOK_EXISTS,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("EXISTS",             TOK_EXISTS,      ANS_|RESWORD_),
   ParKeyWord("EXIT",               TOK_EXIT,        NONRESTOKEN_),
   ParKeyWord("EXP",                TOK_EXP,         NONRESTOKEN_),
   ParKeyWord("EXPLAIN",            TOK_EXPLAIN,     NONRESTOKEN_),
@@ -426,7 +471,7 @@
   ParKeyWord("FAMILY",               TOK_FAMILY,        NONRESTOKEN_),
   ParKeyWord("FAST",               TOK_FAST,        NONRESTOKEN_),
   ParKeyWord("FEATURE_VERSION_INFO",TOK_FEATURE_VERSION_INFO, NONRESTOKEN_),
-  ParKeyWord("FETCH",              TOK_FETCH,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("FETCH",              TOK_FETCH,       ANS_|RESWORD_),
   ParKeyWord("FILE",               TOK_FILE,        NONRESTOKEN_),
   ParKeyWord("FILETOLOB",          TOK_FILETOLOB,   NONRESTOKEN_),
   ParKeyWord("FILETOEXTERNAL",          TOK_FILETOEXTERNAL,   NONRESTOKEN_),
@@ -440,15 +485,15 @@
   ParKeyWord("FLOOR",              TOK_FLOOR,       NONRESTOKEN_),
   ParKeyWord("FN",                 TOK_FN,          NONRESTOKEN_),
   ParKeyWord("FOLLOWING",          TOK_FOLLOWING,   NONRESTOKEN_),
-  ParKeyWord("FOR",                TOK_FOR,         FIRST_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("FOR",                TOK_FOR,         FIRST_|ANS_|RESWORD_),
   ParKeyWord("FORCE",              TOK_FORCE,       NONRESTOKEN_),
   ParKeyWord("FOREIGN",            TOK_FOREIGN,     ANS_|RESWORD_),
   ParKeyWord("FORMAT",             TOK_FORMAT,      NONRESTOKEN_),
   ParKeyWord("FOUND",              TOK_FOUND,       ANS_|RESWORD_),
-  ParKeyWord("FRACTION",           TOK_FRACTION,    COMPAQ_|RESWORD_|MPWORD_),
+  ParKeyWord("FRACTION",           TOK_FRACTION,    COMPAQ_|RESWORD_),
   ParKeyWord("FREE",               TOK_FREE,        COMPAQ_|RESWORD_),
   ParKeyWord("FREESPACE",          TOK_FREESPACE,   NONRESTOKEN_),  
-  ParKeyWord("FROM",               TOK_FROM,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("FROM",               TOK_FROM,        ANS_|RESWORD_),
   ParKeyWord("FULL",               TOK_FULL,        ANS_|RESWORD_),
   ParKeyWord("FUNCTION",           TOK_FUNCTION,    COMPAQ_|RESWORD_),
   ParKeyWord("FUNCTIONS",          TOK_FUNCTIONS,   NONRESTOKEN_),
@@ -466,7 +511,7 @@
   ParKeyWord("GRANTEES",           TOK_GRANTEES,    NONRESTOKEN_),
   ParKeyWord("GRANTED",            TOK_GRANTED,     NONRESTOKEN_),
   ParKeyWord("GREATEST",                  TOK_GREATEST,           NONRESTOKEN_),
-  ParKeyWord("GROUP",              TOK_GROUP,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("GROUP",              TOK_GROUP,       ANS_|RESWORD_),
   ParKeyWord("GROUP_CONCAT",       TOK_GROUP_CONCAT,   NONRESTOKEN_),
   ParKeyWord("GROUPING",           TOK_GROUPING,    COMPAQ_|RESWORD_),
   ParKeyWord("GROUPING_ID",        TOK_GROUPING_ID, NONRESTOKEN_),
@@ -476,7 +521,7 @@
   ParKeyWord("HASH2",              TOK_HASH2,        NONRESTOKEN_),
   ParKeyWord("HASHPARTFUNC",       TOK_HASHPARTFUNC, NONRESTOKEN_),
   ParKeyWord("HASH2PARTFUNC",      TOK_HASH2PARTFUNC, NONRESTOKEN_),
-  ParKeyWord("HAVING",             TOK_HAVING,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("HAVING",             TOK_HAVING,      ANS_|RESWORD_),
   ParKeyWord("HBASE",              TOK_HBASE,      NONRESTOKEN_),
   ParKeyWord("HBASE_OPTIONS",  TOK_HBASE_OPTIONS,      NONRESTOKEN_),
   ParKeyWord("HBASE_TIMESTAMP",  TOK_HBASE_TIMESTAMP,      NONRESTOKEN_),
@@ -493,7 +538,7 @@
   ParKeyWord("HOLD",               TOK_HOLD,        THIRD_|NONRESTOKEN_),
   ParKeyWord("HORIZONTAL",         TOK_HORIZONTAL,  NONRESTOKEN_),
   ParKeyWord("HOST",               TOK_HOST,        COMPAQ_|RESWORD_),
-  ParKeyWord("HOUR",               TOK_HOUR,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("HOUR",               TOK_HOUR,        ANS_|RESWORD_),
   ParKeyWord("HOURS",              TOK_HOURS,       NONRESTOKEN_),
   ParKeyWord("ICOMPRESS",          TOK_ICOMPRESS,   NONRESTOKEN_),
   ParKeyWord("IDENTITY",           TOK_IDENTITY,    ANS_|RESWORD_),
@@ -505,7 +550,7 @@
   ParKeyWord("IMMEDIATE",          TOK_IMMEDIATE,   ANS_|RESWORD_),
   ParKeyWord("IMMUTABLE",          TOK_IMMUTABLE,   NONRESTOKEN_),
   ParKeyWord("IMPLICIT",           TOK_IMPLICIT,    NONRESTOKEN_),
-  ParKeyWord("IN",                 TOK_IN,          SECOND_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("IN",                 TOK_IN,          SECOND_|ANS_|RESWORD_),
   ParKeyWord("INCLUSIVE",          TOK_INCLUSIVE,   NONRESTOKEN_),
   ParKeyWord("INCREMENT",          TOK_INCREMENT,    NONRESTOKEN_),
   ParKeyWord("INCREMENTAL",        TOK_INCREMENTAL,  NONRESTOKEN_),
@@ -524,27 +569,27 @@
   ParKeyWord("INITIALIZED",        TOK_INITIALIZED, FLAGSNONE_),
   ParKeyWord("INITIALLY",          IDENTIFIER,      ANS_|RESWORD_),
   ParKeyWord("INGEST",             TOK_INGEST,      NONRESTOKEN_),
-  ParKeyWord("INNER",              TOK_INNER,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("INNER",              TOK_INNER,       ANS_|RESWORD_),
   ParKeyWord("INOUT",              TOK_INOUT,       COMPAQ_|RESWORD_),
-  ParKeyWord("INPUT",              TOK_INPUT,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("INPUT",              TOK_INPUT,       ANS_|RESWORD_),
   ParKeyWord("INPUTS",             TOK_INPUTS,      NONRESTOKEN_),
   ParKeyWord("INSENSITIVE",        IDENTIFIER,      ANS_|RESWORD_),
-  ParKeyWord("INSERT",             TOK_INSERT,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("INSERT",             TOK_INSERT,      ANS_|RESWORD_),
   ParKeyWord("INSERT_ONLY",        TOK_INSERT_ONLY, NONRESTOKEN_),
   ParKeyWord("INS",                TOK_INS,         NONRESTOKEN_),
   ParKeyWord("INSERTLOG",          TOK_INSERTLOG,   FLAGSNONE_),
   ParKeyWord("INSTR",              TOK_INSTR,       NONRESTOKEN_),
-  ParKeyWord("INT",                TOK_INTEGER,     ANS_|RESWORD_|MPWORD_),
-  ParKeyWord("INTEGER",            TOK_INTEGER,     ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("INT",                TOK_INTEGER,     ANS_|RESWORD_),
+  ParKeyWord("INTEGER",            TOK_INTEGER,     ANS_|RESWORD_),
   ParKeyWord("INTERNAL",           TOK_INTERNAL,    FLAGSNONE_),
   ParKeyWord("INTERSECT",          TOK_INTERSECT,   ANS_|RESWORD_),
-  ParKeyWord("INTERVAL",           TOK_INTERVAL,    ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("INTERVAL",           TOK_INTERVAL,    ANS_|RESWORD_),
   ParKeyWord("INTERVALS",          TOK_INTERVALS,   NONRESTOKEN_),
-  ParKeyWord("INTO",               TOK_INTO,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("INTO",               TOK_INTO,        ANS_|RESWORD_),
   ParKeyWord("INVOKE",             TOK_INVOKE,      NONRESTOKEN_),
   ParKeyWord("INVOKER",            TOK_INVOKER,     NONRESTOKEN_),
   ParKeyWord("IO",                 TOK_IO,          NONRESTOKEN_),
-  ParKeyWord("IS",                 TOK_IS,          ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("IS",                 TOK_IS,          ANS_|RESWORD_),
   ParKeyWord("ISLACK",             TOK_ISLACK,      NONRESTOKEN_),
   ParKeyWord("ISNULL",             TOK_ISNULL,      NONRESTOKEN_),
   ParKeyWord("ISOLATE",            TOK_ISOLATE,     NONRESTOKEN_),
@@ -557,12 +602,12 @@
   ParKeyWord("INVALID", 	   TOK_INVALID,    NONRESTOKEN_),
   ParKeyWord("INVALIDATE", 	   TOK_INVALIDATE, NONRESTOKEN_),
   ParKeyWord("JAVA",               TOK_JAVA,        NONRESTOKEN_),
-  ParKeyWord("JOIN",               TOK_JOIN,        SECOND_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("JOIN",               TOK_JOIN,        SECOND_|ANS_|RESWORD_),
   ParKeyWord("JOURNAL",            TOK_JOURNAL,     NONRESTOKEN_), 
   ParKeyWord("JSON_OBJECT_FIELD_TEXT",  TOK_JSONOBJECTFIELDTEXT, NONRESTOKEN_),
   ParKeyWord("JULIANTIMESTAMP",    TOK_JULIANTIMESTAMP, NONRESTOKEN_),
   ParKeyWord("K",                  TOK_K,           NONRESTOKEN_),
-  ParKeyWord("KEY",                TOK_KEY,         ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("KEY",                TOK_KEY,         ANS_|RESWORD_),
   ParKeyWord("KEY_RANGE_COMPARE",  TOK_KEY_RANGE_COMPARE, NONRESTOKEN_),
   ParKeyWord("LABEL",              TOK_LABEL,       NONRESTOKEN_),
   ParKeyWord("LABEL_ALTER",        TOK_LABEL_ALTER,        NONRESTOKEN_),
@@ -582,18 +627,18 @@
   ParKeyWord("LATERAL",            TOK_LATERAL,     COMPAQ_|RESWORD_),
   ParKeyWord("LCASE",              TOK_LCASE,       NONRESTOKEN_),
   ParKeyWord("LEAD",               TOK_LEAD,        ANS_|RESWORD_),
-  ParKeyWord("LEADING",            TOK_LEADING,     ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("LEADING",            TOK_LEADING,     ANS_|RESWORD_),
   ParKeyWord("LEADING_PRECISION",  TOK_LEADING_PRECISION, NONRESTOKEN_),
   ParKeyWord("LEAST",                  TOK_LEAST,           NONRESTOKEN_),
   ParKeyWord("LEAVE",              IDENTIFIER,      POTANS_|RESWORD_),
-  ParKeyWord("LEFT",               TOK_LEFT,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("LEFT",               TOK_LEFT,        ANS_|RESWORD_),
   ParKeyWord("LENGTH",             TOK_LENGTH,      NONRESTOKEN_),
   ParKeyWord("LESS",               IDENTIFIER,      POTANS_|RESWORD_),
   ParKeyWord("LEVEL",              TOK_LEVEL,       ANS_|RESWORD_),
   ParKeyWord("LEVELS",             TOK_LEVELS,      NONRESTOKEN_),
   ParKeyWord("LIBRARY",            TOK_LIBRARY,     NONRESTOKEN_|SECOND_),
   ParKeyWord("LIBRARIES",          TOK_LIBRARIES,   NONRESTOKEN_),
-  ParKeyWord("LIKE",               TOK_LIKE,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("LIKE",               TOK_LIKE,        ANS_|RESWORD_),
   ParKeyWord("LIMIT",              TOK_LIMIT,      POTANS_|RESWORD_),
   ParKeyWord("LINE_NUMBER",        TOK_LINE_NUMBER, NONRESTOKEN_),
   ParKeyWord("LOAD",               TOK_LOAD,        NONRESTOKEN_|SECOND_),
@@ -639,7 +684,7 @@
   ParKeyWord("MATCH",              TOK_MATCH,       ANS_|RESWORD_),
   ParKeyWord("MATCHED",            TOK_MATCHED,     ANS_|RESWORD_),
   ParKeyWord("MATERIALIZED",       TOK_MATERIALIZED,FLAGSNONE_),
-  ParKeyWord("MAX",                TOK_MAX,         ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("MAX",                TOK_MAX,         ANS_|RESWORD_),
   ParKeyWord("MAXEXTENTS",         TOK_MAXEXTENTS,  NONRESTOKEN_),
   ParKeyWord("MAXIMUM",            TOK_MAX,         NONRESTOKEN_),
   ParKeyWord("MAXRUNTIME",         TOK_MAXRUNTIME,  SECOND_|NONRESTOKEN_),
@@ -654,7 +699,7 @@
   ParKeyWord("METADATA",       TOK_METADATA, SECOND_ | NONRESTOKEN_),
   ParKeyWord("MIN",                TOK_MIN,         ANS_|RESWORD_|NONRESTOKEN_),
   ParKeyWord("MINIMAL",            TOK_MINIMAL,     NONRESTOKEN_),
-  ParKeyWord("MINUTE",             TOK_MINUTE,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("MINUTE",             TOK_MINUTE,      ANS_|RESWORD_),
   ParKeyWord("MINUTES",            TOK_MINUTES,     NONRESTOKEN_),
   ParKeyWord("MINVALUE",           TOK_MINVALUE,   NONRESTOKEN_),
   ParKeyWord("MIXED",              TOK_MIXED,       FLAGSNONE_),
@@ -664,7 +709,7 @@
   ParKeyWord("MODIFY",             IDENTIFIER,      POTANS_|RESWORD_),
   ParKeyWord("MODULE",             TOK_MODULE,      ANS_|RESWORD_),
   ParKeyWord("MODULES",            TOK_MODULES,     NONRESTOKEN_),
-  ParKeyWord("MONTH",              TOK_MONTH,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("MONTH",              TOK_MONTH,       ANS_|RESWORD_),
   ParKeyWord("MONTHNAME",          TOK_MONTHNAME,   NONRESTOKEN_),
   ParKeyWord("MONTHS_BETWEEN",     TOK_MONTHS_BETWEEN,   NONRESTOKEN_),
   ParKeyWord("MORE",               TOK_MORE,        NONRESTOKEN_),
@@ -675,6 +720,7 @@
   ParKeyWord("MOVINGMAX",          TOK_MMAX,        NONRESTOKEN_),
   ParKeyWord("MOVINGMIN",          TOK_MMIN,        NONRESTOKEN_),
   ParKeyWord("MOVINGRANK",         TOK_MRANK,       NONRESTOKEN_),
+  ParKeyWord("MSCK",               TOK_MSCK,        NONRESTOKEN_),
   ParKeyWord("MOVINGSTDDEV",       TOK_MSTDDEV,     NONRESTOKEN_),
   ParKeyWord("MOVINGSUM",          TOK_MSUM,        NONRESTOKEN_),
   ParKeyWord("MOVINGVARIANCE",     TOK_MVARIANCE,   NONRESTOKEN_),
@@ -715,34 +761,34 @@
   ParKeyWord("NOMVLOG",            TOK_NOMVLOG,     FLAGSNONE_),
   ParKeyWord("NONE",               TOK_NONE,        ANS_|RESWORD_),
   ParKeyWord("NORMAL",             TOK_NORMAL,      NONRESTOKEN_),
-  ParKeyWord("NOT",                TOK_NOT,         FIRST_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("NOT",                TOK_NOT,         FIRST_|ANS_|RESWORD_),
   ParKeyWord("NOW",                TOK_NOW,         NONRESTOKEN_),
   ParKeyWord("NSK_CODE",           TOK_NSK_CODE,    NONRESTOKEN_),
-  ParKeyWord("NULL",               TOK_NULL,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("NULL",               TOK_NULL,        ANS_|RESWORD_),
   ParKeyWord("NULLABLE",           TOK_NULLABLE,    NONRESTOKEN_),
   ParKeyWord("NULLIF",             TOK_NULLIF,      ANS_|RESWORD_),
   ParKeyWord("NULLIFZERO",         TOK_NULLIFZERO,  NONRESTOKEN_),
   ParKeyWord("NULL_IND_OFFSET",    TOK_NULL_IND_OFFSET, NONRESTOKEN_),
   ParKeyWord("NULL_STRING",        TOK_NULL_STRING, NONRESTOKEN_),
   ParKeyWord("NUMBER",             TOK_NUMBER,      NONRESTOKEN_),
-  ParKeyWord("NUMERIC",            TOK_NUMERIC,     ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("NUMERIC",            TOK_NUMERIC,     ANS_|RESWORD_),
   ParKeyWord("NUM_OF_RANGES",      TOK_NUM_OF_RANGES, FLAGSNONE_),
   ParKeyWord("NVL",                TOK_NVL,         NONRESTOKEN_),
   ParKeyWord("OBJECT",            TOK_OBJECT,     NONRESTOKEN_),
   ParKeyWord("OBJECTS",            TOK_OBJECTS,     NONRESTOKEN_),
   ParKeyWord("OBSOLETE",           TOK_OBSOLETE,    NONRESTOKEN_),
   ParKeyWord("OCTET_LENGTH",       TOK_OCTET_LENGTH, ANS_|RESWORD_|NONRESTOKEN_),
-  ParKeyWord("OF",                 TOK_OF,          ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("OF",                 TOK_OF,          ANS_|RESWORD_),
   ParKeyWord("OFF",                TOK_OFF,         POTANS_|RESWORD_),
   ParKeyWord("OFFLINE",            TOK_OFFLINE,     NONRESTOKEN_),
   ParKeyWord("OFFSET",             TOK_OFFSET,      NONRESTOKEN_),
   ParKeyWord("OJ",                 TOK_OJ,          NONRESTOKEN_),
   ParKeyWord("OLD",                TOK_OLD,         ANS_|RESWORD_|NONRESTOKEN_|ALLOWOLDNEW_),
-  ParKeyWord("ON",                 TOK_ON,          FIRST_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("ON",                 TOK_ON,          FIRST_|ANS_|RESWORD_),
   ParKeyWord("ONLINE",             TOK_ONLINE,      NONRESTOKEN_),
   ParKeyWord("ONLY",               TOK_ONLY,        THIRD_|ANS_|RESWORD_),
   ParKeyWord("OPCODE",             TOK_OPCODE,      NONRESTOKEN_),
-  ParKeyWord("OPEN",               TOK_OPEN,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("OPEN",               TOK_OPEN,        ANS_|RESWORD_),
   ParKeyWord("OPENBLOWNAWAY",      TOK_OPENBLOWNAWAY, FLAGSNONE_),
   ParKeyWord("OPERATION",          IDENTIFIER,      POTANS_|NONRESWORD_),
   // The word OPERATION is used as a column in the SMD LOCKS table, so
@@ -750,10 +796,10 @@
   // potential ANSI reserved word list.
 
   ParKeyWord("OPERATORS",          IDENTIFIER,      POTANS_|RESWORD_),
-  ParKeyWord("OPTION",             TOK_OPTION,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("OPTION",             TOK_OPTION,      ANS_|RESWORD_),
   ParKeyWord("OPTIONS",            TOK_OPTIONS,     COMPAQ_|RESWORD_),
-  ParKeyWord("OR",                 TOK_OR,          ANS_|RESWORD_|MPWORD_),
-  ParKeyWord("ORDER",              TOK_ORDER,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("OR",                 TOK_OR,          ANS_|RESWORD_),
+  ParKeyWord("ORDER",              TOK_ORDER,       ANS_|RESWORD_),
   ParKeyWord("ORDERED",            TOK_ORDERED,     NONRESTOKEN_),
   ParKeyWord("ORDINALITY",         TOK_ORDINALITY,  COMPAQ_|RESWORD_),
   ParKeyWord("OSIM",                 TOK_OSIM,    NONRESTOKEN_),
@@ -881,6 +927,7 @@
   ParKeyWord("REMOTE",             TOK_REMOTE,      NONRESTOKEN_),
   ParKeyWord("REMOVE",             TOK_REMOVE,      FLAGSNONE_),
   ParKeyWord("RENAME",             TOK_RENAME,      NONRESTOKEN_),
+  ParKeyWord("REPAIR",             TOK_REPAIR,      NONRESTOKEN_),
   ParKeyWord("REPEAT",             TOK_REPEAT,      NONRESTOKEN_),
   ParKeyWord("REPEATABLE",         TOK_REPEATABLE,  FIRST_|SECOND_|NONRESTOKEN_),
   ParKeyWord("REPLACE",            TOK_REPLACE,     POTANS_|RESWORD_),
@@ -903,11 +950,11 @@
   ParKeyWord("REVERSE",            TOK_REVERSE,     NONRESTOKEN_),
   ParKeyWord("REVOKE",             TOK_REVOKE,      ANS_|RESWORD_),
   ParKeyWord("REWRITE",            TOK_REWRITE,     FLAGSNONE_),
-  ParKeyWord("RIGHT",              TOK_RIGHT,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("RIGHT",              TOK_RIGHT,       ANS_|RESWORD_),
   ParKeyWord("RMS",                TOK_RMS,         NONRESTOKEN_),
   ParKeyWord("ROLE",               TOK_ROLE,        NONRESTOKEN_|SECOND_), 
   ParKeyWord("ROLES",              TOK_ROLES,       NONRESTOKEN_),
-  ParKeyWord("ROLLBACK",           TOK_ROLLBACK,    ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("ROLLBACK",           TOK_ROLLBACK,    ANS_|RESWORD_),
   ParKeyWord("ROLLUP",             TOK_ROLLUP,      COMPAQ_|RESWORD_),
   ParKeyWord("ROUND",              TOK_ROUND,       NONRESTOKEN_),
   ParKeyWord("ROUNDROBINPARTFUNC", TOK_RRPARTFUNC,  NONRESTOKEN_),
@@ -955,12 +1002,12 @@
   ParKeyWord("SERIALIZED",             TOK_SERIALIZED,      NONRESTOKEN_),
   ParKeyWord("SEARCH",             IDENTIFIER,      POTANS_|RESWORD_),
   ParKeyWord("STRING_SEARCH",      TOK_STRING_SEARCH,        NONRESTOKEN_),
-  ParKeyWord("SECOND",             TOK_SECOND,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("SECOND",             TOK_SECOND,      ANS_|RESWORD_),
   ParKeyWord("SECONDS",            TOK_SECONDS,     NONRESTOKEN_),
   ParKeyWord("SECTION",            TOK_SECTION,     ANS_|RESWORD_),
   ParKeyWord("SECURITY",           TOK_SECURITY,    NONRESTOKEN_),  
   ParKeyWord("SEL",                TOK_SEL,         NONRESTOKEN_),
-  ParKeyWord("SELECT",             TOK_SELECT,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("SELECT",             TOK_SELECT,      ANS_|RESWORD_),
   ParKeyWord("SELECTIVITY",        TOK_SELECTIVITY, NONRESTOKEN_),
   ParKeyWord("SENSITIVE",          IDENTIFIER,      POTANS_|RESWORD_),
   ParKeyWord("SEPARATE",           TOK_SEPARATE,    NONRESTOKEN_),
@@ -976,7 +1023,7 @@
   ParKeyWord("SESSIONS",           TOK_SESSIONS,    NONRESTOKEN_), 
   ParKeyWord("SESSION_USER",       TOK_SESSION_USER, ANS_|RESWORD_),
   ParKeyWord("SESSN_USR_INTN",     TOK_SESSN_USR_INTN, RESWORD_),
-  ParKeyWord("SET",                TOK_SET,         ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("SET",                TOK_SET,         ANS_|RESWORD_),
   ParKeyWord("SETS",               TOK_SETS,        COMPAQ_|RESWORD_),
   ParKeyWord("SG_TABLE",           TOK_SG_TABLE,    NONRESTOKEN_),
   ParKeyWord("SHA",                TOK_SHA,         NONRESTOKEN_),
@@ -1006,10 +1053,10 @@
   ParKeyWord("SKIP",               TOK_SKIP,        FIRST_|SECOND_|NONRESTOKEN_),
   ParKeyWord("SLACK",              TOK_SLACK,        NONRESTOKEN_),
   ParKeyWord("SLEEP",              TOK_SLEEP,        NONRESTOKEN_),
-  ParKeyWord("SMALLINT",           TOK_SMALLINT,    ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("SMALLINT",           TOK_SMALLINT,    ANS_|RESWORD_),
   ParKeyWord("SNAPSHOT",           TOK_SNAPSHOT,    NONRESTOKEN_),
   ParKeyWord("SOFTWARE",           TOK_SOFTWARE,    NONRESTOKEN_),
-  ParKeyWord("SOME",               TOK_SOME,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("SOME",               TOK_SOME,        ANS_|RESWORD_),
   ParKeyWord("SOUNDEX",            TOK_SOUNDEX,     NONRESTOKEN_),
   ParKeyWord("SORT",               TOK_SORT,        NONRESTOKEN_),
   ParKeyWord("SORT_KEY",           TOK_SORT_KEY,    NONRESTOKEN_),
@@ -1018,6 +1065,7 @@
   ParKeyWord("SPACE",              TOK_SPACE,       NONRESTOKEN_),
   ParKeyWord("SPECIFIC",           TOK_SPECIFIC,    COMPAQ_|RESWORD_),
   ParKeyWord("SPECIFICTYPE",       TOK_SPECIFICTYPE, COMPAQ_|RESWORD_),
+  ParKeyWord("SPLIT_PART",         TOK_SPLIT_PART, NONRESTOKEN_),
   ParKeyWord("SP_RESULT_SET",      TOK_SP_RESULT_SET, NONRESTOKEN_),
   ParKeyWord("SQL",                TOK_SQL,         ANS_|RESWORD_|SECOND_),
   ParKeyWord("SQLCODE",            TOK_SQLCODE,     ANS_|RESWORD_),
@@ -1063,7 +1111,7 @@
   ParKeyWord("SUBSTRING",          TOK_SUBSTRING,   ANS_|RESWORD_|NONRESTOKEN_),
   ParKeyWord("SUBSYSTEM_ID",       TOK_SUBSYSTEM_ID, NONRESTOKEN_),
   ParKeyWord("SUFFIX",             TOK_SUFFIX,       NONRESTOKEN_),
-  ParKeyWord("SUM",                TOK_SUM,         ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("SUM",                TOK_SUM,         ANS_|RESWORD_),
   ParKeyWord("SUMMARY",            TOK_SUMMARY,     NONRESTOKEN_),
   ParKeyWord("SUSPEND",            TOK_SUSPEND,     NONRESTOKEN_),
   ParKeyWord("SYNONYM",            TOK_SYNONYM,     POTANS_|RESWORD_),
@@ -1075,7 +1123,7 @@
   ParKeyWord("SYSTEM_USER",        IDENTIFIER,      ANS_|RESWORD_),
   ParKeyWord("T",                  TOK_T,           NONRESTOKEN_),
   ParKeyWord("TAG",                TOK_TAG,         NONRESTOKEN_),
-  ParKeyWord("TABLE",              TOK_TABLE,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("TABLE",              TOK_TABLE,       ANS_|RESWORD_),
   ParKeyWord("TABLES",             TOK_TABLES,      FLAGSNONE_),
   ParKeyWord("TABLESPACE",             TOK_TABLESPACE,      NONRESTOKEN_),
   ParKeyWord("TABLE_MAPPING",      TOK_TABLE_MAPPING, NONRESTOKEN_),
@@ -1090,20 +1138,20 @@
   ParKeyWord("TEST",               IDENTIFIER,      POTANS_|RESWORD_),
   ParKeyWord("TEXT",               TOK_TEXT,        NONRESTOKEN_),
   ParKeyWord("THAN",               TOK_THAN,        COMPAQ_|RESWORD_),
-  ParKeyWord("THEN",               TOK_THEN,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("THEN",               TOK_THEN,        ANS_|RESWORD_),
   ParKeyWord("THERE",              IDENTIFIER,      POTANS_|RESWORD_),
   ParKeyWord("THIS",               TOK_THIS,        NONRESTOKEN_),
   ParKeyWord("THROUGH",            TOK_THROUGH,     NONRESTOKEN_),
-  ParKeyWord("TIME",               TOK_TIME,        FIRST_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("TIME",               TOK_TIME,        FIRST_|ANS_|RESWORD_),
   ParKeyWord("TIMEOUT",            TOK_TIMEOUT,     NONRESTOKEN_),
-  ParKeyWord("TIMESTAMP",          TOK_TIMESTAMP,   ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("TIMESTAMP",          TOK_TIMESTAMP,   ANS_|RESWORD_),
   ParKeyWord("TIMESTAMPADD",       TOK_TIMESTAMPADD,NONRESTOKEN_),
   ParKeyWord("TIMESTAMPDIFF",      TOK_TIMESTAMPDIFF,NONRESTOKEN_),
   ParKeyWord("TIMEZONE_HOUR",      IDENTIFIER,      ANS_|RESWORD_),
   ParKeyWord("TIMEZONE_MINUTE",    IDENTIFIER,      ANS_|RESWORD_),
   ParKeyWord("TINYINT",            TOK_TINYINT,     NONRESTOKEN_),
   ParKeyWord("TITLE",              TOK_TITLE,       NONRESTOKEN_),
-  ParKeyWord("TO",                 TOK_TO,          ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("TO",                 TOK_TO,          ANS_|RESWORD_),
   ParKeyWord("TO_CHAR",            TOK_TO_CHAR,     NONRESTOKEN_),
   ParKeyWord("TO_DATE",            TOK_TO_DATE,     NONRESTOKEN_),
   ParKeyWord("TO_NUMBER",          TOK_TO_NUMBER,   NONRESTOKEN_),
@@ -1111,7 +1159,7 @@
   ParKeyWord("TO_TIMESTAMP",       TOK_TO_TIMESTAMP,   NONRESTOKEN_),
   ParKeyWord("TOKENSTR",           TOK_TOKENSTR,    NONRESTOKEN_),
   ParKeyWord("TRAFODION",          TOK_TRAFODION,    NONRESTOKEN_),
-  ParKeyWord("TRAILING",           TOK_TRAILING,    ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("TRAILING",           TOK_TRAILING,    ANS_|RESWORD_),
   ParKeyWord("TRANSACTION",        TOK_TRANSACTION, ANS_|RESWORD_),
   ParKeyWord("TRANSFORM",          TOK_TRANSFORM,   NONRESTOKEN_),
   ParKeyWord("TRANSLATE",          TOK_TRANSLATE,   ANS_|RESWORD_),
@@ -1140,8 +1188,8 @@
   ParKeyWord("UNBOUNDED",          TOK_UNBOUNDED,   NONRESTOKEN_),
   ParKeyWord("UNCOMMITTED",        TOK_UNCOMMITTED, NONRESTOKEN_),
   ParKeyWord("UNDER",              IDENTIFIER,      POTANS_|RESWORD_),
-  ParKeyWord("UNION",              TOK_UNION,       FIRST_|ANS_|RESWORD_|MPWORD_),
-  ParKeyWord("UNIQUE",             TOK_UNIQUE,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("UNION",              TOK_UNION,       FIRST_|ANS_|RESWORD_),
+  ParKeyWord("UNIQUE",             TOK_UNIQUE,      ANS_|RESWORD_),
   ParKeyWord("UNIQUE_ID",             TOK_UNIQUE_ID,      NONRESTOKEN_),
   ParKeyWord("UNIVERSAL",          TOK_UNIVERSAL,   NONRESTOKEN_),
   ParKeyWord("UNIX_TIMESTAMP",     TOK_UNIX_TIMESTAMP,   NONRESTOKEN_),
@@ -1152,7 +1200,7 @@
   ParKeyWord("UNNEST",             TOK_UNNEST,      COMPAQ_|RESWORD_),
   ParKeyWord("UNREGISTER",         TOK_UNREGISTER,  NONRESTOKEN_),
   ParKeyWord("UNSIGNED",           TOK_UNSIGNED,    NONRESTOKEN_),
-  ParKeyWord("UPDATE",             TOK_UPDATE,      FIRST_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("UPDATE",             TOK_UPDATE,      FIRST_|ANS_|RESWORD_),
   ParKeyWord("UPD",                TOK_UPD,         NONRESTOKEN_),
   ParKeyWord("UPDATE_STATS",       TOK_UPDATE_STATS,	  NONRESTOKEN_),
   ParKeyWord("UPGRADE",                TOK_UPGRADE,         NONRESTOKEN_),
@@ -1171,7 +1219,7 @@
   ParKeyWord("UUID_SHORT",          TOK_UUID_SHORT,	NONRESTOKEN_),
   ParKeyWord("VALIDATE",	   TOK_VALIDATE,    NONRESTOKEN_),
   ParKeyWord("VALUE",              TOK_VALUE,       NONRESTOKEN_),
-  ParKeyWord("VALUES",             TOK_VALUES,      ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("VALUES",             TOK_VALUES,      ANS_|RESWORD_),
   ParKeyWord("VARBINARY",          TOK_VARBINARY,   NONRESTOKEN_),
   ParKeyWord("VARCHAR",            TOK_VARCHAR,     ANS_|RESWORD_|NONRESTOKEN_),
   ParKeyWord("VARCHAR2",            TOK_VARCHAR,     ANS_|RESWORD_|NONRESTOKEN_),
@@ -1185,7 +1233,7 @@
   ParKeyWord("VERSION",            TOK_VERSION,     NONRESTOKEN_),
   ParKeyWord("VERSIONS",            TOK_VERSIONS,     NONRESTOKEN_),
   ParKeyWord("VERSION_INFO",       TOK_VERSION_INFO, NONRESTOKEN_),
-  ParKeyWord("VIEW",               TOK_VIEW,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("VIEW",               TOK_VIEW,        ANS_|RESWORD_),
   ParKeyWord("VIEWS",              TOK_VIEWS,       NONRESTOKEN_),
   ParKeyWord("VIRTUAL",            IDENTIFIER,      POTANS_|RESWORD_),
   ParKeyWord("VISIBLE",            IDENTIFIER,      POTANS_|RESWORD_),
@@ -1197,17 +1245,18 @@
   ParKeyWord("WAITEDIO",           TOK_WAITEDIO,      NONRESTOKEN_),
   ParKeyWord("WCHAR",              TOK_WCHAR,       NONRESTOKEN_),
   ParKeyWord("WEEK",               TOK_WEEK,        NONRESTOKEN_),
-  ParKeyWord("WHEN",               TOK_WHEN,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("WHEN",               TOK_WHEN,        ANS_|RESWORD_),
   ParKeyWord("WHENEVER",           TOK_WHENEVER,    ANS_|RESWORD_),
-  ParKeyWord("WHERE",              TOK_WHERE,       ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("WHERE",              TOK_WHERE,       ANS_|RESWORD_),
   ParKeyWord("WHILE",              IDENTIFIER,      POTANS_|RESWORD_),
-  ParKeyWord("WITH",               TOK_WITH,        SECOND_|ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("WITH",               TOK_WITH,        SECOND_|ANS_|RESWORD_),
   ParKeyWord("WITHOUT",            TOK_WITHOUT,     SECOND_|POTANS_|RESWORD_),
-  ParKeyWord("WORK",               TOK_WORK,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("WORK",               TOK_WORK,        ANS_|RESWORD_),
+  ParKeyWord("WOM",                TOK_WOM,         NONRESTOKEN_),
   ParKeyWord("WRITE",              TOK_WRITE,       ANS_|RESWORD_),
   ParKeyWord("XMLAGG",               TOK_XMLAGG,        NONRESTOKEN_),
   ParKeyWord("XMLELEMENT",               TOK_XMLELEMENT,        NONRESTOKEN_),
-  ParKeyWord("YEAR",               TOK_YEAR,        ANS_|RESWORD_|MPWORD_),
+  ParKeyWord("YEAR",               TOK_YEAR,        ANS_|RESWORD_),
   ParKeyWord("ZEROIFNULL",         TOK_ZEROIFNULL,  NONRESTOKEN_),
   ParKeyWord("ZONE",               IDENTIFIER,      ANS_|RESWORD_)
 };
diff --git a/core/sql/parser/ParKeyWords.h b/core/sql/parser/ParKeyWords.h
index aa7e43d..6d588e8 100644
--- a/core/sql/parser/ParKeyWords.h
+++ b/core/sql/parser/ParKeyWords.h
@@ -76,8 +76,6 @@
                                 // used only for notation.  The Parser also 
                                 // maintains this list.
 
-  MPWORD_      = 0x040,         // a SQL/MP Reserved word.
-
   ALLOWOLDNEW_ = 0x080,         // Indicates that the word is allowed if the
                                 // ALLOWOLDNEW parser flag is set.  In certain
                                 // contexts the words OLD and NEW are allowed
@@ -133,19 +131,14 @@
   // Is the word an identifier.
   //
   inline NABoolean isIdentifier() const {
-    return ((tokenCode_ == IDENTIFIER) ||
-	    (inMPContext() && !isMPReserved() && !(flags_ & NONRESTOKEN_)));
+    return (tokenCode_ == IDENTIFIER);
   };
 
-  // Is the word reserved, depends on isMPContext.
+  // Is the word reserved.
   //
   inline NABoolean isReserved() const { 
-    if (inMPContext()) {
-      return isMPReserved();
-    } else {
       return ((flags_ & RESWORD_) &&
 	      !(allowOldAndNew() && (flags_ & ALLOWOLDNEW_)));
-    }
   };
 
   inline NABoolean isConditionallyReserved() const {
@@ -161,18 +154,7 @@
   inline static NABoolean allowOldAndNew(void) {
     return Get_SqlParser_Flags(ALLOW_OLD_AND_NEW_KEYWORD) ? TRUE : FALSE;
   }
-
-  // Are we parsing/lexing MP Stored text.
-  // This affect which words are reserved, identifiers, or tokens.
-  //
-  inline static NABoolean inMPContext(void) {
-    return FALSE;
-  }
   
-  // Is the word reserved by SQL/MP.
-  // 
-  inline NABoolean isMPReserved() const { return flags_ & MPWORD_; };
-
 
   // The keyword.
   //
diff --git a/core/sql/parser/SqlParserAux.cpp b/core/sql/parser/SqlParserAux.cpp
index 094e5e8..faf0103 100644
--- a/core/sql/parser/SqlParserAux.cpp
+++ b/core/sql/parser/SqlParserAux.cpp
@@ -3376,14 +3376,6 @@
       pNode->setInsertMode(COM_MULTISET_TABLE_INSERT_MODE);
       break;
 
-    case TableTokens::TYPE_EXTERNAL_HIVE_TABLE:
-      pNode->setExternalHiveTable(TRUE);
-      break;
-
-    case TableTokens::TYPE_MANAGED_HIVE_TABLE:
-      pNode->setManagedHiveTable(TRUE);
-      break;
-
     default:
       NAAbort("TableTokens - TypeAttr", __LINE__, "internal logic error");
       break;
diff --git a/core/sql/parser/SqlParserAux.h b/core/sql/parser/SqlParserAux.h
index 7f6e635..ca2cabe 100644
--- a/core/sql/parser/SqlParserAux.h
+++ b/core/sql/parser/SqlParserAux.h
@@ -562,20 +562,13 @@
 
 // Change the <sqltext> arg of a CQD from
 //	SET SCHEMA X.Y;		-- unquoted: Tandem syntax extension
-//	SET MPLOC $V.SV;	-- MPLOC:    Tandem syntax extension
-//	SET MPLOC '$V.SV';	-- MPLOC:    Tandem syntax extension
 // into
 //	SET SCHEMA 'X.Y';	-- string literal: Ansi syntax, MX canonical fmt
-//	SET MP_SUBVOLUME '$V.SV';  -- string lit:  Tdm ext, MX canonical format
-//	SET MP_SUBVOLUME '$V.SV';  -- string lit:  Tdm ext, MX canonical format
 //
 // This needs to be called ONLY for:
 // - SET cqd's (not DECLARE cqd's), and
 //   - the SET cqd's unquoted (non-string-literal) variants, or
 //   - or if we are otherwise rewriting the user input text
-//     (e.g. the syntactic sugar of "SET MPLOC" --
-//	there is no NADefaults attribute of MPLOC --
-//	NADefaults parses a multi-part MP_SUBVOLUME instead).
 //
 ControlQueryDefault *normalizeDynamicCQD(const char *attrName,
                                          const NAString &attrValue);
@@ -772,14 +765,6 @@
       TYPE_VOLATILE_SET_TABLE,
       TYPE_VOLATILE_MULTISET_TABLE,
       TYPE_GHOST_TABLE,
-
-      // create external hive table.
-      // usage: create external hive table hive.hive.tgt like trafodion.sch.src;
-      TYPE_EXTERNAL_HIVE_TABLE,
-
-      // create managed hive table.
-      // usage: create hive table hive.hive.tgt like trafodion.sch.src;
-      TYPE_MANAGED_HIVE_TABLE
     };
 
   // load/in memory options
diff --git a/core/sql/parser/StmtDDLCreate.cpp b/core/sql/parser/StmtDDLCreate.cpp
index 03cfbb9..fc9ddb7 100644
--- a/core/sql/parser/StmtDDLCreate.cpp
+++ b/core/sql/parser/StmtDDLCreate.cpp
@@ -3821,9 +3821,7 @@
 	  pSGOptions_(NULL),
 	  createIfNotExists_(FALSE),
           mapToHbaseTable_(FALSE),
-          hbaseDataFormat_(FALSE),
-          externalHiveTable_(FALSE),
-          managedHiveTable_(FALSE)
+          hbaseDataFormat_(FALSE)
 {
   setChild(INDEX_TABLE_DEFINITION, pTableDefBody);
   setChild(INDEX_ATTRIBUTE_LIST, pCreateTableAttrList);
diff --git a/core/sql/parser/StmtDDLCreateTable.h b/core/sql/parser/StmtDDLCreateTable.h
index e25f5db..559fbc1 100644
--- a/core/sql/parser/StmtDDLCreateTable.h
+++ b/core/sql/parser/StmtDDLCreateTable.h
@@ -394,6 +394,11 @@
         // returns TURE if table feature clause appears;
         // returns FALSE otherwise
 
+  inline const NAString &getHiveOptions()
+  {return hiveOptions_; }
+  void setHiveOptions(NAString h)
+  {hiveOptions_ = h;}
+
   // POS
   inline NABoolean isPOSNumPartnsSpecified() const;
   inline NABoolean isPOSInitialTableSizeSpecified() const;
@@ -466,12 +471,6 @@
 
   inline void setInsertMode(ComInsertMode insertMode);
 
-  void setExternalHiveTable(ComBoolean v) { externalHiveTable_ = v; }
-  NABoolean externalHiveTable() { return externalHiveTable_; }
-
-  void setManagedHiveTable(ComBoolean v) { managedHiveTable_ = v; }
-  NABoolean managedHiveTable() { return managedHiveTable_; }
-
   // sets the Constraint data member with the information in
   // the parse node pointed by pConstraint.  This parse node
   // represents either a column or a table constraint definition.
@@ -862,13 +861,8 @@
   // create only if table doesnt exist. Otherwise just return.
   NABoolean createIfNotExists_;
 
-  // Usage:
-  //   create external hive table hive.hive.tgt like trafodion.sch.src;
-  NABoolean externalHiveTable_;
-
-  // Usage:
-  //   create hive table hive.hive.tgt like trafodion.sch.src;
-  NABoolean managedHiveTable_;
+  // optional options specified during CTAS into a hive table
+  NAString hiveOptions_;
 
 }; // class StmtDDLCreateTable
 
diff --git a/core/sql/parser/StmtDDLonHiveObjects.h b/core/sql/parser/StmtDDLonHiveObjects.h
index cd36f50..1f07f3a 100644
--- a/core/sql/parser/StmtDDLonHiveObjects.h
+++ b/core/sql/parser/StmtDDLonHiveObjects.h
@@ -65,8 +65,8 @@
       DROP_,
       ALTER_,
       TRUNCATE_,
+      MSCK_,  // MetaStore Check
       PASSTHRU_DDL_,
-      CREATE_LIKE_TRAF_,
       UNKNOWN_OPER_
     };
   
@@ -80,17 +80,19 @@
       
   // initialize constructor
   StmtDDLonHiveObjects(Operation oper,
-                     ObjectType type,
-                     NABoolean ifExistsOrNotExists,
-                     const NAString &name,
-                     NAString &hiveDDL,
-                     CollHeap * heap)
+                       ObjectType type,
+                       NABoolean ifExistsOrNotExists,
+                       const NAString &name,
+                       NAString &hiveDDL,
+                       NAString &hiveDefaultDB,
+                       CollHeap * heap)
        : StmtDDLNode(DDL_ON_HIVE_OBJECTS),
          oper_(oper),
          type_(type),
          ifExistsOrNotExists_(ifExistsOrNotExists),
          name_(name),
          hiveDDL_(hiveDDL),
+         hiveDefaultDB_(hiveDefaultDB),
          childNode_(NULL)
   {}
   
@@ -124,8 +126,8 @@
       case DROP_         : return "drop";
       case ALTER_        : return "alter";
       case TRUNCATE_     : return "truncate";
+      case MSCK_         : return "msck";
       case PASSTHRU_DDL_ : return "passthru";
-      case CREATE_LIKE_TRAF_: return "create_like_traf";
       case UNKNOWN_OPER_ : return "unknown";
       default            : return "unknown";
       } // switch
@@ -151,6 +153,9 @@
   NAString &getHiveDDL() {return hiveDDL_;}
   void setHiveDDL(NAString &hiveDDL) {hiveDDL_ = hiveDDL;}
 
+  const NAString &getHiveDefaultDB() const {return hiveDefaultDB_;}
+  NAString &getHiveDefaultDB() {return hiveDefaultDB_;}
+
   // ExprNode * bindNode(BindWA * pBindWA);
 
   //
@@ -174,6 +179,9 @@
   NAString name_;
   NAString hiveDDL_;
 
+  // default hive database/schema set for the current session
+  NAString hiveDefaultDB_;
+
   //
   // please do not use the following methods
   //
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index 107c53b..b053fb6 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -67,6 +67,7 @@
 // This solves the problem because bison does not have to reduce after reading TOK_DROP. Rather,
 // after reading TOK_DROP TOK_TABLE, it can lookahead at the next token to decide what to do.
 
+
 #include "Platform.h"				// must be the first #include
 //debug yacc
 #define YY_LOG_FILE "yylog"
@@ -500,6 +501,7 @@
 %token <tokval> TOK_CARDINALITY
 %token <tokval> TOK_CASE
 %token <tokval> TOK_CAST
+%token <tokval> TOK_CENTURY
 %token <tokval> TOK_TYPECAST
 %token <tokval> TOK_CATCHUP	  // MV
 %token <tokval> TOK_TRANSLATE
@@ -622,6 +624,9 @@
 %token <tokval> TOK_DYNAMIC
 %token <tokval> TOK_DYNAMIC_FUNCTION    /* ANSI SQL non-reserved word */
 %token <tokval> TOK_D_RANK             /* Tandem extension non-reserved word */
+%token <tokval> TOK_DECADE
+%token <tokval> TOK_DOW
+%token <tokval> TOK_DOY
 %token <tokval> TOK_EACH                
 %token <tokval> TOK_EID
 %token <tokval> TOK_ELSEIF
@@ -656,6 +661,7 @@
 %token <tokval> TOK_EXTRACT
 %token <tokval> TOK_EXTRACT_SOURCE
 %token <tokval> TOK_EXTRACT_TARGET
+%token <tokval> TOK_EPOCH
 %token <tokval> TOK_FALSE
 %token <tokval> TOK_FAMILY
 %token <tokval> TOK_FEATURE_VERSION_INFO   /* Versioning. Non-reserved */
@@ -850,6 +856,7 @@
 %token <tokval> TOK_MONTHNAME
 %token <tokval> TOK_MORE                /* ANSI SQL non-reserved word */
 %token <tokval> TOK_MRANK               /* Tandem extension non-reserved word */
+%token <tokval> TOK_MSCK
 %token <tokval> TOK_MSTDDEV             /* Tandem extension non-reserved word */
 %token <tokval> TOK_MSUM                /* Tandem extension non-reserved word */
 %token <tokval> TOK_MV                  
@@ -977,6 +984,7 @@
 %token <tokval> TOK_REMOTE
 %token <tokval> TOK_TEMP_TABLE         
 %token <tokval> TOK_TEMPORARY
+%token <tokval> TOK_REPAIR
 %token <tokval> TOK_REPEAT
 %token <tokval> TOK_REPEATABLE          /* ANSI SQL non-reserved word */ 
 %token <tokval> TOK_REPEATABLE_ACCESS   /* Tandem extension */
@@ -1080,6 +1088,7 @@
 %token <tokval> TOK_STATUS
 %token <tokval> TOK_STDDEV              /* Tandem extension */
 %token <tokval> TOK_STOP                /* Tandem extension */
+%token <tokval> TOK_SPLIT_PART          /* Trafodion extension*/ 
 %token <tokval> TOK_STORED
 %token <tokval> TOK_SQL
 %token <tokval> TOK_SQL_DOUBLE
@@ -1174,6 +1183,7 @@
 %token <tokval> TOK_WAITEDIO
 %token <tokval> TOK_WCHAR
 %token <tokval> TOK_WEEK
+%token <tokval> TOK_WOM
 %token <tokval> TOK_WHEN
 %token <tokval> TOK_WHENEVER
 %token <tokval> TOK_WHERE
@@ -2042,6 +2052,7 @@
 %type <intervalQualifier>	end_field
 %type <intervalQualifier>       fraction_only_interval
 %type <datetimeField>		non_second_datetime_field
+%type <datetimeField>		new_non_second_datetime_field
 %type <datetimeField>		datetime_field
 %type <datetimeQualifier>       datetime_qualifier           //For MP Datetime
 %type <datetimeQualifier>       datetime_start_field         //For MP Datetime
@@ -2859,9 +2870,8 @@
 %type <pSchemaName>             optional_from_schema
 %type <stringval>               get_statistics_optional_options
 
-%type <corrName>   	        truncate_table_name
-%type <relx>                    exe_util_fast_delete
-%type <longint>                 purgedata_options
+%type <ptr_placeholder>         truncate_table_name
+%type <relx>                    truncate_table
 
 %type <relx>                    exe_util_get_metadata_info
 %type <relx>                    exe_util_get_version_info
@@ -2926,6 +2936,8 @@
 %type <item>                   locking_stmt
 %type <parTriggerScopeType>         optional_row_table
 
+%type <stringval>              optional_hive_options
+
 %type <tableTokens>            create_table_start_tokens
 %type <tableLoadAttrEnum>      ctas_load_and_in_memory_options
 %type <pElemDDL>               ctas_insert_columns
@@ -9277,6 +9289,11 @@
 	  $$ = new (PARSERHEAP()) 
 	    BuiltinFunction(ITM_REVERSE, CmpCommon::statementHeap(), 1, $3);
         } 
+     | TOK_SPLIT_PART '(' value_expression ',' value_expression ',' value_expression ')'
+        {                     
+               $$ = new (PARSERHEAP()) SplitPart($3, $5, $7);
+        }
+
 
 
 /* type item */
@@ -12487,12 +12504,49 @@
                           {
                             $$ = REC_DATE_MINUTE;
                           }
+new_non_second_datetime_field:
+                          TOK_CENTURY
+                          {
+                            $$ = REC_DATE_CENTURY;
+                          }
+                          | TOK_DECADE
+                          {
+                            $$ = REC_DATE_DECADE;
+                          }
+                          | TOK_WEEK
+                          {
+                            $$ = REC_DATE_WEEK;
+                          }
+                          | TOK_QUARTER
+                          {
+                            $$ = REC_DATE_QUARTER;
+                          }
+                          | TOK_EPOCH
+                          {
+                            $$ = REC_DATE_EPOCH;
+                          }
+                          | TOK_DOW
+                          {
+                            $$ = REC_DATE_DOW;
+                          }
+                          | TOK_DOY
+                          {
+                            $$ = REC_DATE_DOY;
+                          }
+                          | TOK_WOM
+                          {
+                            $$ = REC_DATE_WOM;
+                          }
 
 /* type datetimeField */
 datetime_field : non_second_datetime_field
                {
                  $$ = $1;
                }
+               | new_non_second_datetime_field
+               {
+                 $$ = $1;
+               }
                | TOK_SECOND
                {
                  $$ = REC_DATE_SECOND;
@@ -14856,7 +14910,7 @@
                                 {
 				  $$ = finalize($1);
 				}
-              | exe_util_fast_delete
+              | truncate_table
                                 {
 				  $$ = finalize($1);
 				}
@@ -16451,7 +16505,7 @@
 	       }
 
 /* type relx */
-exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
+exe_util_init_hbase :TOK_INITIALIZE TOK_TRAFODION 
                {
 		 CharInfo::CharSet stmtCharSet = CharInfo::UnknownCharSet;
 		 NAString * stmt = getSqlStmtStr ( stmtCharSet  // out - CharInfo::CharSet &
@@ -16466,6 +16520,7 @@
 
                  de->setInitHbase(TRUE);
                  de->setCreateMDViews(TRUE);
+                 de->setReturnStatus(TRUE);
 
 		 $$ = de;
 	       }
@@ -16486,18 +16541,18 @@
                  de->setInitHbase(TRUE);
                  de->setCreateMDViews(TRUE);
                  de->setMinimal(TRUE);
+                 de->setReturnStatus(TRUE);
 
 		 $$ = de;                
                }
 
-           | TOK_INITIALIZE TOK_TRAFODION ',' TOK_NO TOK_METADATA TOK_VIEWS
+          | TOK_INITIALIZE TOK_TRAFODION ',' TOK_NO TOK_RETURN TOK_STATUS
                {
 		 CharInfo::CharSet stmtCharSet = CharInfo::UnknownCharSet;
 		 NAString * stmt = getSqlStmtStr ( stmtCharSet  // out - CharInfo::CharSet &
 						   , PARSERHEAP() 
 	                                       );
 
-
                  DDLExpr * de = new(PARSERHEAP()) DDLExpr
                    (NULL,
                     (char*)stmt->data(), 
@@ -16505,9 +16560,30 @@
                     PARSERHEAP());
 
                  de->setInitHbase(TRUE);
+                 de->setCreateMDViews(TRUE);
 
 		 $$ = de;
 	       }
+          | TOK_INITIALIZE TOK_TRAFODION ',' TOK_MINIMAL ',' TOK_NO TOK_RETURN TOK_STATUS
+               {
+ 		 CharInfo::CharSet stmtCharSet = CharInfo::UnknownCharSet;
+		 NAString * stmt = getSqlStmtStr ( stmtCharSet  // out - CharInfo::CharSet &
+						   , PARSERHEAP() 
+	                                       );
+
+                 DDLExpr * de = new(PARSERHEAP()) DDLExpr
+                   (NULL,
+                    (char*)stmt->data(), 
+                    stmtCharSet,
+                    PARSERHEAP());
+
+                 de->setInitHbase(TRUE);
+                 de->setCreateMDViews(TRUE);
+                 de->setMinimal(TRUE);
+
+		 $$ = de;                
+               }
+
 
              | TOK_INITIALIZE TOK_TRAFODION ',' TOK_DROP
                {
@@ -17871,13 +17947,25 @@
 		     }
 
 /* type corrName */
-truncate_table_name : TOK_PURGEDATA table_name
+truncate_table_name : TOK_PURGEDATA optional_if_exists_clause table_name 
                         {
-                          $$ = $2;
+                          $$ = new(PARSERHEAP()) 
+                            PtrPlaceHolder($3, 
+                                           ($2 ? new(PARSERHEAP()) NAString() 
+                                            : NULL));
                         }
-                        | TOK_TRUNCATE table_name
+                        | TOK_TRUNCATE optional_if_exists_clause 
                         {
-                          $$ = $2;
+                          SqlParser_CurrentParser->hiveDDLInfo_->
+                            setValues(TRUE, StmtDDLonHiveObjects::TRUNCATE_, StmtDDLonHiveObjects::TABLE_, $2);
+                        }
+                        ddl_qualified_name
+                        {
+                          CorrName * cn = new(PARSERHEAP()) CorrName(*$4, PARSERHEAP());
+                          $$ = new(PARSERHEAP()) 
+                            PtrPlaceHolder(cn, 
+                                           ($2 ? new(PARSERHEAP()) NAString() 
+                                            : NULL));
                         }
                         | TOK_TRUNCATE TOK_TABLE optional_if_exists_clause 
                         {
@@ -17886,13 +17974,16 @@
                         }
                         ddl_qualified_name
                         {
-                          $$ = new (PARSERHEAP()) CorrName(*$5, PARSERHEAP());
+                          CorrName * cn = new(PARSERHEAP()) CorrName(*$5, PARSERHEAP());
+                          $$ = new(PARSERHEAP()) 
+                            PtrPlaceHolder(cn, 
+                                           ($3 ? new(PARSERHEAP()) NAString() 
+                                            : NULL));
                         }
-  
-exe_util_fast_delete :  truncate_table_name purgedata_options
+
+truncate_table :  truncate_table_name 
 		     {
-		       short noLog = ($2 & 0x1) != 0;
-		       short ignoreTrigger = ($2 & 0x2) != 0;
+                       PtrPlaceHolder *pph = $1;
 
 		       CharInfo::CharSet stmtCharSet = CharInfo::UnknownCharSet;
 		       NAString * stmt = getSqlStmtStr ( stmtCharSet
@@ -17903,31 +17994,20 @@
 		         *SqlParser_Diags <<  DgSqlCode(-3406);
 		         YYERROR;
 		       }
-		       $$ = new (PARSERHEAP())
-			 ExeUtilFastDelete(CorrName(*$1, PARSERHEAP()),
-					   NULL,
-					   (char*)stmt->data(),
-					   stmtCharSet,
-					   FALSE,
-					   noLog,
-					   ignoreTrigger,
-					   TRUE,
-					   PARSERHEAP());
-		       
-		       delete $1;
-		     }
-purgedata_options : /*empty*/ { $$ = 0; }
-                  | TOK_NOLOG { $$ = 1; }
-                  | TOK_IGNORE_TRIGGER { $$ = 2; }
-                  | TOK_NOLOG TOK_IGNORE_TRIGGER { $$ = 3; }
-                  | TOK_IGNORE_TRIGGER TOK_NOLOG { $$ = 3; }
-                  | TOK_WAITEDIO { $$ = 4; }
-                  | TOK_NOLOG TOK_IGNORE_TRIGGER TOK_WAITEDIO { $$ = 7; }
-                  | TOK_IGNORE_TRIGGER TOK_NOLOG TOK_WAITEDIO { $$ = 7; }
-                  | TOK_WAITEDIO TOK_NOLOG TOK_IGNORE_TRIGGER { $$ = 7; }
-                  | TOK_WAITEDIO TOK_IGNORE_TRIGGER TOK_NOLOG { $$ = 7; }
-                  | TOK_NOLOG TOK_WAITEDIO TOK_IGNORE_TRIGGER { $$ = 7; }
-                  | TOK_IGNORE_TRIGGER TOK_WAITEDIO TOK_NOLOG { $$ = 7; }
+                       CorrName *cn = (CorrName*) pph->ptr1_;
+                       NABoolean ifExists = (pph->ptr2_ != NULL);
+
+                       DDLExpr * ddlExpr = new(PARSERHEAP()) 
+                         DDLExpr(NULL,
+                                 (char*)stmt->data(),
+                                 CharInfo::UnknownCharSet,
+                                 CmpCommon::statementHeap());
+                       ddlExpr->setPurgedata(TRUE);
+                       ddlExpr->setPurgedataTableName(*cn);
+                       ddlExpr->setPurgedataIfExists(ifExists);
+                       
+                       $$ = ddlExpr;
+                     }
 
 exe_util_aqr: TOK_GET TOK_ALL TOK_AQR TOK_ENTRIES
                {
@@ -18842,7 +18922,7 @@
 
 
 /* type relx */
-rel_subquery : '(' query_expression order_by_clause ')'
+rel_subquery : '(' query_expression order_by_clause optional_limit_spec ')'
 				{
                                   if (InIfCondition) {
                                      *SqlParser_Diags << DgSqlCode(-3176);
@@ -18870,6 +18950,24 @@
                                     }
 
                                   $$ = temp;
+                  if ($4)
+                    {
+                      RelExpr *query = $2;
+                      if (query->getFirstNRows() >= 0)
+                        {
+                          YYERROR;
+                        }
+                      else
+                        {
+                          NABoolean negate;
+                          if ($4->castToConstValue(negate))
+                            {
+                              ConstValue *limit = (ConstValue *)$4;
+                              Lng32 scale = 0;
+                              query->setFirstNRows(limit->getExactNumericValue(scale));
+                            }
+                        }
+                    }
 				}
 /* type item */
 predicate : directed_comparison_predicate
@@ -19581,10 +19679,10 @@
                $5);
           
           ((Insert*)$$)->setOverwriteHiveTable(TRUE);
-          
+
           delete $3;
         }  
-            
+
           | no_check_log no_rollback TOK_INTO  table_name '(' '*' ')' query_expression order_by_clause access_type optional_limit_spec
         {
           if (!finalizeAccessOptions($8, $10)) YYERROR;
@@ -20643,76 +20741,8 @@
                                   }
 				}
 
-delete_statement : TOK_DELETE TOK_DATA TOK_FROM table_name 
-				{
-				  if (CmpCommon::getDefault(FAST_DELETE) == DF_OFF)
-				    {
-				      YYERROR;
-				    }
-				  
-				  CharInfo::CharSet stmtCharSet = CharInfo::UnknownCharSet;
-				  NAString * stmt = getSqlStmtStr ( stmtCharSet  // out - CharInfo::CharSet &
-				                                  , PARSERHEAP() // in  - NAMemory * heapUsedForOutputBuffers
-				                                  );
-				  // If we can not get a variable-width multi-byte or single-byte string here, report error 
-				  if ( stmt == NULL )
-				  {
-				    *SqlParser_Diags <<  DgSqlCode(-3406);
-				    YYERROR;
-				  }
-				  $$ = new (PARSERHEAP())
-				    ExeUtilFastDelete(CorrName(*$4, PARSERHEAP()),
-						      NULL,
-						      (char*)stmt->data(),
-						      stmtCharSet,
-						      FALSE,
-						      FALSE, FALSE,
-						      FALSE,
-						      PARSERHEAP());
-
-				  delete $4;
-				}
-
 /* type relx */
-delete_statement : TOK_DELETE TOK_USING TOK_PURGEDATA TOK_FROM table_name
-				{
-				  Scan * inputScan =
-				    new (PARSERHEAP()) Scan(CorrName(*$5, PARSERHEAP()));
-
-				  Delete *del = new (PARSERHEAP())
-				    Delete(CorrName(*$5, PARSERHEAP()),
-					   NULL,
-					   REL_UNARY_DELETE,
-					   inputScan,
-					   NULL);
-
-				  del->setIsFastDelete(TRUE);
-
-				  delete $5;
-
-				  $$ = del;
-				}
-
-                   | TOK_DELETE TOK_NO TOK_PURGEDATA TOK_FROM table_name
-				{
-				  Scan * inputScan =
-				    new (PARSERHEAP()) Scan(CorrName(*$5, PARSERHEAP()));
-
-				  Delete *del = new (PARSERHEAP())
-				    Delete(CorrName(*$5, PARSERHEAP()),
-					   NULL,
-					   REL_UNARY_DELETE,
-					   inputScan,
-					   NULL);
-
-				  del->setIsFastDelete(FALSE);
-				  del->setNoIMneeded(TRUE);
-
-				  delete $5;
-
-				  $$ = del;
-				}
-		| TOK_DELETE no_check_log TOK_WITH TOK_NO TOK_ROLLBACK TOK_FROM table_name optimizer_hint where_clause 
+delete_statement : TOK_DELETE no_check_log TOK_WITH TOK_NO TOK_ROLLBACK TOK_FROM table_name optimizer_hint where_clause 
                 {
                   Scan * inputScan =
                     new (PARSERHEAP()) Scan(CorrName(*$7, PARSERHEAP()));
@@ -25012,6 +25042,15 @@
     delete $3; // std_char_string_literal
   }
 
+optional_hive_options : empty 
+                      {
+                        $$ = NULL;
+                      }
+                      | TOK_HIVE TOK_OPTIONS QUOTED_STRING
+                      {
+                        $$ = $3;
+                      }
+
 /* type pStmtDDL */
 table_definition : create_table_start_tokens 
                         ddl_qualified_name 
@@ -25021,14 +25060,6 @@
                         optional_map_to_hbase_clause
                         optional_hbase_data_format
 	  	   {
-                     if (($1->getType() == TableTokens::TYPE_EXTERNAL_HIVE_TABLE) ||
-                         ($1->getType() == TableTokens::TYPE_MANAGED_HIVE_TABLE))
-                       {
-                         *SqlParser_Diags << DgSqlCode(-3242)
-                                          << DgString0("LIKE clause must be specified to create this Hive table.");
-                         YYERROR;
-                       }
-
                      $1->setOptions(TableTokens::OPT_NONE);
 		     QualifiedName * qn;
                      if ($1->isVolatile())
@@ -25064,10 +25095,9 @@
 		     StmtDDLCreateTable *pNode =
 		       new (PARSERHEAP())
 		       StmtDDLCreateTable(
-			    *qn /*ddl_qualified_name*/,
-			    $3 /*table_definition_body*/,
-			    $4 /*optional_create_table_
-				*attribute_list*/,
+			    *qn, //ddl_qualified_name
+			    $3,  //table_definition_body
+			    $4,  //optional_create_table_attribute_list
 			    NULL,
 			    NULL,
 			    PARSERHEAP());
@@ -25092,12 +25122,13 @@
 		       }
 
 		     $$ = pNode;
-                     delete $1; /*TableTokens*/
-		     delete $2 /*ddl_qualified_name*/;
+                     delete $1; //TableTokens
+		     delete $2; //ddl_qualified_name
 		   }
 
-table_definition : create_table_start_tokens ddl_qualified_name
-                        like_definition
+table_definition : create_table_start_tokens 
+                   ddl_qualified_name
+                   like_definition
 	  	   {
                      $1->setOptions(TableTokens::OPT_NONE);
 		     QualifiedName * qn;
@@ -25108,12 +25139,11 @@
 		     if (! qn)
                        YYABORT;
 
-                     StmtDDLNode *rNode = NULL;
 		     StmtDDLCreateTable *pNode =
 		       new (PARSERHEAP())
 		       StmtDDLCreateTable(
-			    *qn /*ddl_qualified_name*/,
-			    $3 /*like_definition*/,
+			    *qn, //ddl_qualified_name
+			    $3,  //like_definition
 			    NULL,
 			    NULL,
 			    NULL,
@@ -25128,34 +25158,9 @@
 			 ParNameCTLocListPtr = NULL;
 		       }
 
-                     rNode = pNode;
-                     if (($1->getType() == TableTokens::TYPE_EXTERNAL_HIVE_TABLE) ||
-                         ($1->getType() == TableTokens::TYPE_MANAGED_HIVE_TABLE))
-                       {
-                         SqlParser_CurrentParser->hiveDDLInfo_->
-                           setValues(TRUE, StmtDDLonHiveObjects::CREATE_LIKE_TRAF_, 
-                                     StmtDDLonHiveObjects::TABLE_, $1->ifNotExistsSet());
-
-                         SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_ = TRUE;
-
-                         NAString hiveDDL;
-                         StmtDDLonHiveObjects *hNode =
-                           new (PARSERHEAP())
-                           StmtDDLonHiveObjects(
-                                StmtDDLonHiveObjects::CREATE_LIKE_TRAF_,
-                                StmtDDLonHiveObjects::TABLE_,
-                                $1->ifNotExistsSet(),
-                                qn->getQualifiedNameAsAnsiString(),
-                                hiveDDL,
-                                PARSERHEAP());
-
-                         hNode->setChild(0, pNode);
-                         rNode = hNode;
-                       }
-
-		     $$ = rNode;
-                     delete $1; /*TableTokens*/
-		     delete $2 /*ddl_qualified_name*/;
+		     $$ = pNode;
+                     delete $1; //TableTokens
+		     delete $2; //ddl_qualified_name
 		   }
 
 		 | TOK_CREATE special_table_name
@@ -25186,13 +25191,18 @@
 		   }
 
                  | create_table_start_tokens
-                   ddl_qualified_name 
-		   table_definition_body
-		   optional_create_table_attribute_list 
-		   create_table_as_attr_list_end
+                   ddl_qualified_name
+ 		   table_definition_body
+ 		   optional_create_table_attribute_list 
+ 		   create_table_as_attr_list_end
 		   ctas_load_and_in_memory_options
 		   ctas_insert_columns
+                   optional_hive_options
 		   create_table_as_token 
+                   {
+                     if (CmpCommon::getDefault(HIVE_CTAS_IN_NATIVE_MODE) == DF_OFF)
+                       SqlParser_CurrentParser->hiveDDLInfo_->setFoundDDL(FALSE);                       
+                   }
 		   optional_locking_stmt_list 
                    query_expression 
                    optional_limit_spec
@@ -25206,15 +25216,6 @@
 			 YYERROR;
 		       }
 
-                     if (($1->getType() == TableTokens::TYPE_EXTERNAL_HIVE_TABLE) ||
-                         ($1->getType() == TableTokens::TYPE_MANAGED_HIVE_TABLE))
-                       {
-                         // create hive table .. as..   not supported.
-                         *SqlParser_Diags << DgSqlCode(-3242)
-                                          << DgString0("'create hive table ... as ...' construct is not allowed.");
-                         YYERROR;
-                       }
-
                      $1->setOptions($6);
                      if ($1->isVolatile())
                        qn = processVolatileDDLName($2, FALSE, FALSE);
@@ -25223,9 +25224,9 @@
 		     if (! qn)
 			 YYABORT;
 
-		     RelRoot *top = finalize($10);
+		     RelRoot *top = finalize($12);
                    //limit clause
-                   if ($11)
+                   if ($13)
                    {
                      if (top->getFirstNRows() >= 0)
                        {
@@ -25235,16 +25236,16 @@
                      else
                        {
                          NABoolean negate;
-                         if ($11->castToConstValue(negate))
+                         if ($13->castToConstValue(negate))
                            {
-                             ConstValue * limit = (ConstValue*)$11;
+                             ConstValue * limit = (ConstValue*)$13;
                              Lng32 scale = 0;
                              top->setFirstNRows(limit->getExactNumericValue(scale));
                              top->setFirstNRowsParam(NULL);
                            }
                          else
                            {
-                             top->setFirstNRowsParam($11);
+                             top->setFirstNRowsParam($13);
                              top->setFirstNRows(-1);
                            }
                        }
@@ -25253,11 +25254,10 @@
 		     StmtDDLCreateTable *pNode =
 		       new (PARSERHEAP())
 		       StmtDDLCreateTable(
-			    *qn /*ddl_qualified_name*/,
-			    $3 /*table_definition_body*/,
-			    $4 /*optional_create_table_
-				*attribute_list*/,
-			    $7, /* insert column list */
+			    *qn, //ddl_qualified_name
+			    $3,  // table_definition_body
+			    $4,  // optional_create_table_attribute_list
+			    $7,  // insert column list 
 			    top,
 			    PARSERHEAP());
                      $1->setTableTokens(pNode);
@@ -25274,18 +25274,26 @@
 			 delete ParNameCTLocListPtr;
 			 ParNameCTLocListPtr = NULL;
 		       }
-		     
+
+                     if ($8)
+                       pNode->setHiveOptions(*$8);
+
 		     $$ = pNode;
-                     delete $1; /*TableTokens*/
-		     delete $2 /*ddl_qualified_name*/;
+                     delete $1; //TableTokens
+		     delete $2; //ddl_qualified_name
 		   }
 
                  | create_table_start_tokens 
                    ddl_qualified_name 
+                   {
+                     if (CmpCommon::getDefault(HIVE_CTAS_IN_NATIVE_MODE) == DF_OFF)
+                       SqlParser_CurrentParser->hiveDDLInfo_->setFoundDDL(FALSE);                       
+                   }
 		   optional_create_table_attribute_list 
 		   create_table_as_attr_list_end
 		   ctas_load_and_in_memory_options
 		   ctas_insert_columns
+                   optional_hive_options
 		   create_table_as_token 
 		   optional_locking_stmt_list 
                    query_expression 
@@ -25300,16 +25308,7 @@
 			 YYERROR;
 		       }
 
-                     if (($1->getType() == TableTokens::TYPE_EXTERNAL_HIVE_TABLE) ||
-                         ($1->getType() == TableTokens::TYPE_MANAGED_HIVE_TABLE))
-                       {
-                         // create hive table .. as..   not supported.
-                         *SqlParser_Diags << DgSqlCode(-3242)
-                                          << DgString0("'create hive table ... as ...' construct is not allowed.");
-                         YYERROR;
-                       }
-
-                     $1->setOptions($5);
+                     $1->setOptions($6);
                      if ($1->isVolatile())
                        qn = processVolatileDDLName($2, FALSE, FALSE);
 		     else
@@ -25317,9 +25316,9 @@
 		     if (! qn)
                        YYABORT;
 
-		     RelRoot *top = finalize($9);
+		     RelRoot *top = finalize($11);
                    //limit clause
-                   if ($10)
+                   if ($12)
                    {
                      if (top->getFirstNRows() >= 0)
                        {
@@ -25329,16 +25328,16 @@
                      else
                        {
                          NABoolean negate;
-                         if ($10->castToConstValue(negate))
+                         if ($12->castToConstValue(negate))
                            {
-                             ConstValue * limit = (ConstValue*)$10;
+                             ConstValue * limit = (ConstValue*)$12;
                              Lng32 scale = 0;
                              top->setFirstNRows(limit->getExactNumericValue(scale));
                              top->setFirstNRowsParam(NULL);
                            }
                          else
                            {
-                             top->setFirstNRowsParam($10);
+                             top->setFirstNRowsParam($12);
                              top->setFirstNRows(-1);
                            }
                        }
@@ -25347,11 +25346,10 @@
 		     StmtDDLCreateTable *pNode =
 		       new (PARSERHEAP())
 		       StmtDDLCreateTable(
-			    *qn /*ddl_qualified_name*/,
-			    NULL /*table_definition_body*/,
-			    $3 /*optional_create_table_
-				*attribute_list*/,
-			    $6, /* insert column list */
+			    *qn,  //ddl_qualified_name
+			    NULL, //table_definition_body
+			    $4,   //optional_create_table_attribute_list
+			    $7,   //insert column list 
 			    top,
 			    PARSERHEAP());
                      $1->setTableTokens(pNode);
@@ -25369,9 +25367,12 @@
 			 ParNameCTLocListPtr = NULL;
 		       }
 
+                     if ($8)
+                       pNode->setHiveOptions(*$8);
+
 		     $$ = pNode;
-                     delete $1; /*TableTokens*/
-		     delete $2 /*ddl_qualified_name*/;
+                     delete $1; //TableTokens
+		     delete $2;  //ddl_qualified_name
 		   }
 
               | TOK_CREATE TOK_HBASE TOK_TABLE identifier '(' col_fam_quoted_string_list ')'
@@ -25424,7 +25425,7 @@
                      $$ = tableTokens;
 
                      SqlParser_CurrentParser->hiveDDLInfo_->
-                       setValues(TRUE, StmtDDLonHiveObjects::CREATE_, StmtDDLonHiveObjects::TABLE_, $3);
+                       setValues(TRUE, StmtDDLonHiveObjects::CREATE_, StmtDDLonHiveObjects::TABLE_, $4);
 		   }
 
                    | TOK_CREATE TOK_IMPLICIT TOK_EXTERNAL TOK_TABLE optional_if_not_exists_clause
@@ -25521,20 +25522,6 @@
                      $$ = tableTokens;
 		   }
 
-                   | TOK_CREATE TOK_HIVE TOK_TABLE optional_if_not_exists_clause
-                   {
-		     ParNameCTLocListPtr = new (PARSERHEAP())
-		       ParNameLocList(SQLTEXT(), (CharInfo::CharSet)SQLTEXTCHARSET(), SQLTEXTW(), PARSERHEAP());
-                     TableTokens *tableTokens = new TableTokens(TableTokens::TYPE_MANAGED_HIVE_TABLE, $4); 
-                     $$ = tableTokens;
-                   }
-                   | TOK_CREATE TOK_EXTERNAL TOK_HIVE TOK_TABLE optional_if_not_exists_clause
-                   {
-		     ParNameCTLocListPtr = new (PARSERHEAP())
-		       ParNameLocList(SQLTEXT(), (CharInfo::CharSet)SQLTEXTCHARSET(), SQLTEXTW(), PARSERHEAP());
-                     TableTokens *tableTokens = new TableTokens(TableTokens::TYPE_EXTERNAL_HIVE_TABLE, $5); 
-                     $$ = tableTokens;
-                   }
 /* type boolean */
 optional_if_not_exists_clause : 
                 empty
@@ -25617,7 +25604,11 @@
                    {
 		     $$ = TableTokens::OPT_IN_MEM; 
 		   }
-                 | TOK_LOAD TOK_IF TOK_EXISTS TOK_WITH TOK_DELETE TOK_DATA 
+                 | TOK_LOAD TOK_IF TOK_EXISTS TOK_WITH TOK_TRUNCATE
+                   {
+		     $$ = TableTokens::OPT_LOAD_WITH_DELETE; 
+		   }
+                 | TOK_LOAD TOK_IF TOK_EXISTS TOK_WITH TOK_DELETE TOK_DATA
                    {
 		     $$ = TableTokens::OPT_LOAD_WITH_DELETE; 
 		   }
@@ -26680,11 +26671,6 @@
                                   $$ = new (PARSERHEAP())
 				    ElemDDLLikeOptWithoutLobColumns();
                                 }
-                      | TOK_WITH TOK_HIVE TOK_OPTIONS QUOTED_STRING
-                                {
-                                  $$ = new (PARSERHEAP())
-				    ElemDDLLikeOptWithHiveOptions(*$4);
-                                }
 
 /* type pElemDDL */
 optional_create_table_attribute_list : create_table_as_attr_list_start
@@ -31894,6 +31880,41 @@
                                   delete $4 /*ddl_qualified_name*/;
                                 }
 
+                     | TOK_MSCK
+                       { 
+                         // this is a Hive only syntax
+                         SqlParser_CurrentParser->hiveDDLInfo_->
+                           setValues(TRUE, StmtDDLonHiveObjects::MSCK_, 
+                                     StmtDDLonHiveObjects::TABLE_);
+                       }
+                       TOK_REPAIR TOK_TABLE ddl_qualified_name
+                       {
+                         if (NOT SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_)
+                           {
+                             *SqlParser_Diags << DgSqlCode(-3242)
+                                              << DgString0("Specified object must be a Hive object.");
+                           }
+
+                         $$ = NULL;
+                         YYERROR;
+                       }
+                     | alter_table_start_tokens ddl_qualified_name TOK_RECOVER TOK_PARTITIONS
+                       {
+                         // this is a Hive only syntax
+                         SqlParser_CurrentParser->hiveDDLInfo_->
+                           setValues(TRUE, StmtDDLonHiveObjects::MSCK_, 
+                                     StmtDDLonHiveObjects::TABLE_);
+
+                         if (NOT SqlParser_CurrentParser->hiveDDLInfo_->foundDDL_)
+                           {
+                             *SqlParser_Diags << DgSqlCode(-3242)
+                                              << DgString0("Specified object must be a Hive object.");
+                           }
+ 
+                         $$ = NULL;
+                         YYERROR;
+                       }
+
 ghost : TOK_GHOST
                  {
                    // GHOST is allowed only if the flag ALLOW_SPECIALTABLETYPE is set,
@@ -33801,6 +33822,7 @@
                       | TOK_CATALOGS
                       | TOK_CATALOG_NAME
 		      | TOK_CATCHUP // MV
+                      | TOK_CENTURY
                       | TOK_CHANGED
 		      | TOK_CHANGES // MV
                       | TOK_CHARS
@@ -33870,6 +33892,7 @@
                       | TOK_DCOMPRESS
                       | TOK_DDL
 		      | TOK_DE			// MV OZ_REFRESH
+                      | TOK_DECADE
                       | TOK_DEFINER
                       | TOK_DEFINITION
                       | TOK_DEFAULTS
@@ -33886,6 +33909,8 @@
                       | TOK_DIVISION
                       | TOK_DO
                       | TOK_DOUBLE_IEEE
+                      | TOK_DOW
+                      | TOK_DOY
                       | TOK_DROP_LIBRARY
                       | TOK_DROP_MV
                       | TOK_DROP_MV_GROUP
@@ -33908,6 +33933,7 @@
                       | TOK_ENTERPRISE
                       | TOK_ENTRY
                       | TOK_ENTRIES
+                      | TOK_EPOCH
                       | TOK_ET
                       | TOK_EUROPEAN
                       | TOK_EXCEPTIONS
@@ -34050,6 +34076,7 @@
                       | TOK_MV  
                       | TOK_MULTI            /* Long Running */
 		      | TOK_MULTIDELTA // MV
+                      | TOK_MSCK
 		      | TOK_MVATTRIBUTE  // MV
 		      | TOK_MVATTRIBUTES // MV
                       | TOK_MV_TABLE  
@@ -34155,6 +34182,7 @@
                       | TOK_RELOAD
                       | TOK_REMOTE
                       | TOK_RENAME
+                      | TOK_REPAIR
                       | TOK_REPOSITORY
                       | TOK_REQUEST // MV
                       | TOK_REQUIRED
@@ -34278,6 +34306,7 @@
                       | TOK_VSBB
                       | TOK_WAITED
                       | TOK_WAITEDIO
+                      | TOK_WOM
 
 		      	// New words added can be merged into sorted list above
                       | TOK_INVOKE
diff --git a/core/sql/pom.xml b/core/sql/pom.xml
index cd025a1..7b143d9 100644
--- a/core/sql/pom.xml
+++ b/core/sql/pom.xml
@@ -84,6 +84,12 @@
       <artifactId>protobuf-java</artifactId>
       <version>2.5.0</version>
     </dependency>
+    <dependency>
+       <groupId>org.alluxio</groupId>
+       <artifactId>alluxio-core-client-runtime</artifactId>
+       <scope>compile</scope>
+       <version>1.7.1</version>
+    </dependency>
   </dependencies>
 
   <groupId>org.trafodion.sql</groupId>
diff --git a/core/sql/pom.xml.apache b/core/sql/pom.xml.apache
index 938bbbb..a8afd33 100644
--- a/core/sql/pom.xml.apache
+++ b/core/sql/pom.xml.apache
@@ -119,6 +119,12 @@
       <artifactId>protobuf-java</artifactId>
       <version>2.5.0</version>
     </dependency>
+    <dependency>
+       <groupId>org.alluxio</groupId>
+       <artifactId>alluxio-core-client-runtime</artifactId>
+       <scope>compile</scope>
+       <version>1.7.1</version>
+    </dependency>
   </dependencies>
 
   <groupId>org.trafodion.sql</groupId>
diff --git a/core/sql/pom.xml.hdp b/core/sql/pom.xml.hdp
index 5b1216f..52bac2e 100644
--- a/core/sql/pom.xml.hdp
+++ b/core/sql/pom.xml.hdp
@@ -99,6 +99,12 @@
       <artifactId>protobuf-java</artifactId>
       <version>2.5.0</version>
     </dependency>
+    <dependency>
+       <groupId>org.alluxio</groupId>
+       <artifactId>alluxio-core-client-runtime</artifactId>
+       <scope>compile</scope>
+       <version>1.7.1</version>
+    </dependency>
   </dependencies>
 
   <groupId>org.trafodion.sql</groupId>
diff --git a/core/sql/regress/compGeneral/EXPECTED023 b/core/sql/regress/compGeneral/EXPECTED023
index 8a46e13..0ea3503 100644
--- a/core/sql/regress/compGeneral/EXPECTED023
+++ b/core/sql/regress/compGeneral/EXPECTED023
@@ -23,6 +23,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>CREATE TABLE stest
@@ -106,6 +109,9 @@
 STESTC
 STEST_EMPTY
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>  -- should be just stest, stest_empty, stestc, and the sb_* tables
 >>
@@ -149,6 +155,9 @@
 STEST_EMPTY
 TRAF_SAMPLE_07158060726899021395_1517441663_444545
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >> -- should be stest, stest_empty, stestc, sb_* tables + a sample table
 >>
@@ -173,6 +182,9 @@
 STEST_EMPTY
 TRAF_SAMPLE_07158060726899021395_1517441711_141471
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >> -- should be stest, stest_empty, stestc, sb_* tables + a different sample table
 >>
@@ -203,6 +215,9 @@
 STESTC
 STEST_EMPTY
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >> -- should be stest, stest_empty, stestc, sb_* tables only
 >>
@@ -230,6 +245,9 @@
 STEST_EMPTY
 TRAF_SAMPLE_07158060726899021395_1517441748_979037
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >> -- should be stest, stest_empty, stestc, sb_* tables + another sample table
 >>
@@ -264,6 +282,9 @@
 STEST_EMPTY
 TRAF_SAMPLE_07158060726899021395_1517441802_045572
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >> -- should be stest, stest_empty, stestc, sb_* tables + another sample table
 >>
@@ -393,6 +414,9 @@
 TRAF_SAMPLE_07158060726899021395_1517441802_045572
 TRAF_SAMPLE_07158060726899023220_1517441862_582002
 
+=======================
+ 8 row(s) returned
+
 --- SQL operation complete.
 >>
 >>execute s1 using 'STESTC';
@@ -428,6 +452,9 @@
 TRAF_SAMPLE_07158060726899021395_1517441802_045572
 TRAF_SAMPLE_07158060726899023220_1517441862_582002
 
+=======================
+ 8 row(s) returned
+
 --- SQL operation complete.
 >> -- should be the same as previous "get tables"
 >>
@@ -456,6 +483,9 @@
 TRAF_SAMPLE_07158060726899021395_1517441802_045572
 TRAF_SAMPLE_07158060726899023220_1517441862_582002
 
+=======================
+ 8 row(s) returned
+
 --- SQL operation complete.
 >> -- should be the same as previous "get tables"
 >>
@@ -485,6 +515,9 @@
 TRAF_SAMPLE_07158060726899021395_1517441802_045572
 TRAF_SAMPLE_07158060726899023220_1517441862_582002
 
+=======================
+ 8 row(s) returned
+
 --- SQL operation complete.
 >> -- should be the same as previous "get tables"
 >>
@@ -516,6 +549,9 @@
 TRAF_SAMPLE_07158060726899021395_1517441802_045572
 TRAF_SAMPLE_07158060726899023220_1517441862_582002
 
+=======================
+ 8 row(s) returned
+
 --- SQL operation complete.
 >> -- should be the same as previous "get tables"
 >>
@@ -567,6 +603,9 @@
 STEST_EMPTY
 TRAF_SAMPLE_07158060726899021395_1517441802_045572
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >> -- should be the same as previous "get tables" except only one sample table
 >>
@@ -592,6 +631,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>  -- sample tables should be gone too
 >>
diff --git a/core/sql/regress/compGeneral/EXPECTED071 b/core/sql/regress/compGeneral/EXPECTED071
index f87f526..8a5774d 100644
--- a/core/sql/regress/compGeneral/EXPECTED071
+++ b/core/sql/regress/compGeneral/EXPECTED071
@@ -1020,7 +1020,7 @@
 OPERATOR                        TNAME                                                         BKEY                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      EKEY
 ------------------------------  ------------------------------------------------------------  ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
-TRAFODION_SCAN                  MTDN3                                                         begin_key: (_SALT_ = <min>), (_DIVISION_1_ = DATE_PART('YEARQUARTER',%(2009-12-06 12:13:14))), (_DIVISION_2_ = 'ab  '), (_DIVISION_3_ = cast((cast(((cast((cast(((cast(%(2099-01-06 12:13:14.555555)) - cast((cast(dayofweek(%(2099-01-06 12:13:14.555555))) - cast(1)))) - (cast(1900-01-01) - cast((cast(dayofweek(1900-01-01)) - cast(1)))))) * cast(10))) / cast(7)) / cast(10))) / cast(001)))), (_DIVISION_4_ = 'ab'), (_DIVISION_5_ = <min>), (PC1 = %(2009-12-06 12:13:14)), (PC2 = %(2099-01-06 12:13:14.555555)), (PC3 = 'ab'), (PC4 = <min>)                                                                   end_key: (_SALT_ = <max>), (_DIVISION_1_ = DATE_PART('YEARQUARTER',%(2009-12-06 12:13:14))), (_DIVISION_2_ = 'abcf'), (_DIVISION_3_ = cast((cast(((cast((cast(((cast(%(2099-01-06 12:13:14.555555)) - cast((cast(dayofweek(%(2099-01-06 12:13:14.555555))) - cast(1)))) - (cast(1900-01-01) - cast((cast(dayofweek(1900-01-01)) - cast(1)))))) * cast(10))) / cast(7)) / cast(10))) / cast(001)))), (_DIVISION_4_ = 'ab'), (_DIVISION_5_ = <max>), (PC1 = %(2009-12-06 12:13:14)), (PC2 = %(2099-01-06 12:13:14.555555)), (PC3 = 'abcf'), (PC4 = <max>)                                                                 
+TRAFODION_SCAN                  MTDN3                                                         begin_key: (_SALT_ = <min>), (_DIVISION_1_ = DATE_PART('YEARQUARTER',%(2009-12-06 12:13:14))), (_DIVISION_2_ = 'ab  '), (_DIVISION_3_ = cast((cast(((cast((cast(cast(((cast(%(2099-01-06 12:13:14.555555)) - cast((cast(dayofweek(%(2099-01-06 12:13:14.555555))) - cast(1)))) - (cast(1900-01-01) - cast((cast(dayofweek(1900-01-01)) - cast(1))))))) * cast(cast(10)))) / cast(cast(7))) / cast(cast(10)))) / cast(001)))), (_DIVISION_4_ = 'ab'), (_DIVISION_5_ = <min>), (PC1 = %(2009-12-06 12:13:14)), (PC2 = %(2099-01-06 12:13:14.555555)), (PC3 = 'ab'), (PC4 = <min>)                                           end_key: (_SALT_ = <max>), (_DIVISION_1_ = DATE_PART('YEARQUARTER',%(2009-12-06 12:13:14))), (_DIVISION_2_ = 'abcf'), (_DIVISION_3_ = cast((cast(((cast((cast(cast(((cast(%(2099-01-06 12:13:14.555555)) - cast((cast(dayofweek(%(2099-01-06 12:13:14.555555))) - cast(1)))) - (cast(1900-01-01) - cast((cast(dayofweek(1900-01-01)) - cast(1))))))) * cast(cast(10)))) / cast(cast(7))) / cast(cast(10)))) / cast(001)))), (_DIVISION_4_ = 'ab'), (_DIVISION_5_ = <max>), (PC1 = %(2009-12-06 12:13:14)), (PC2 = %(2099-01-06 12:13:14.555555)), (PC3 = 'abcf'), (PC4 = <max>)                                         
 
 --- 1 row(s) selected.
 >>-- ("_DIVISION_1_", "_DIVISION_2_", "_DIVISION_3_", "_DIVISION_4_") has (=, between, = between, none) predicates
@@ -1038,7 +1038,7 @@
 OPERATOR                        TNAME                                                         BKEY                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      EKEY
 ------------------------------  ------------------------------------------------------------  ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
-TRAFODION_SCAN                  MTDN3                                                         begin_key: (_SALT_ = <min>), (_DIVISION_1_ = DATE_PART('YEARQUARTER',%(2009-12-06 12:13:14))), (_DIVISION_2_ = 'ab  '), (_DIVISION_3_ = cast((cast(((cast((cast(((cast(%(2099-01-06 12:13:14.555555)) - cast((cast(dayofweek(%(2099-01-06 12:13:14.555555))) - cast(1)))) - (cast(1900-01-01) - cast((cast(dayofweek(1900-01-01)) - cast(1)))))) * cast(10))) / cast(7)) / cast(10))) / cast(001)))), (_DIVISION_4_ = 'ab'), (_DIVISION_5_ = <min>), (PC1 = %(2009-12-06 12:13:14)), (PC2 = %(2099-01-06 12:13:14.555555)), (PC3 = 'ab'), (PC4 = <min>)                                                                   end_key: (_SALT_ = <max>), (_DIVISION_1_ = DATE_PART('YEARQUARTER',%(2009-12-06 12:13:14))), (_DIVISION_2_ = 'abcf'), (_DIVISION_3_ = cast((cast(((cast((cast(((cast(%(2099-01-06 12:13:14.555555)) - cast((cast(dayofweek(%(2099-01-06 12:13:14.555555))) - cast(1)))) - (cast(1900-01-01) - cast((cast(dayofweek(1900-01-01)) - cast(1)))))) * cast(10))) / cast(7)) / cast(10))) / cast(001)))), (_DIVISION_4_ = 'ab'), (_DIVISION_5_ = <max>), (PC1 = %(2009-12-06 12:13:14)), (PC2 = %(2099-01-06 12:13:14.555555)), (PC3 = 'abcf'), (PC4 = <max>)                                                                 
+TRAFODION_SCAN                  MTDN3                                                         begin_key: (_SALT_ = <min>), (_DIVISION_1_ = DATE_PART('YEARQUARTER',%(2009-12-06 12:13:14))), (_DIVISION_2_ = 'ab  '), (_DIVISION_3_ = cast((cast(((cast((cast(cast(((cast(%(2099-01-06 12:13:14.555555)) - cast((cast(dayofweek(%(2099-01-06 12:13:14.555555))) - cast(1)))) - (cast(1900-01-01) - cast((cast(dayofweek(1900-01-01)) - cast(1))))))) * cast(cast(10)))) / cast(cast(7))) / cast(cast(10)))) / cast(001)))), (_DIVISION_4_ = 'ab'), (_DIVISION_5_ = <min>), (PC1 = %(2009-12-06 12:13:14)), (PC2 = %(2099-01-06 12:13:14.555555)), (PC3 = 'ab'), (PC4 = <min>)                                           end_key: (_SALT_ = <max>), (_DIVISION_1_ = DATE_PART('YEARQUARTER',%(2009-12-06 12:13:14))), (_DIVISION_2_ = 'abcf'), (_DIVISION_3_ = cast((cast(((cast((cast(cast(((cast(%(2099-01-06 12:13:14.555555)) - cast((cast(dayofweek(%(2099-01-06 12:13:14.555555))) - cast(1)))) - (cast(1900-01-01) - cast((cast(dayofweek(1900-01-01)) - cast(1))))))) * cast(cast(10)))) / cast(cast(7))) / cast(cast(10)))) / cast(001)))), (_DIVISION_4_ = 'ab'), (_DIVISION_5_ = <max>), (PC1 = %(2009-12-06 12:13:14)), (PC2 = %(2099-01-06 12:13:14.555555)), (PC3 = 'abcf'), (PC4 = <max>)                                         
 
 --- 1 row(s) selected.
 >>
diff --git a/core/sql/regress/core/EXPECTED002.LINUX b/core/sql/regress/core/EXPECTED002.LINUX
index b7dee45..8d2562b 100644
--- a/core/sql/regress/core/EXPECTED002.LINUX
+++ b/core/sql/regress/core/EXPECTED002.LINUX
@@ -1279,4 +1279,61 @@
  7
 
 --- 1 row(s) selected.
+>>
+>>-- Tests of limit n in subqueries
+>>
+>>-- Should return 1
+>>select
++>(select y aa from t002sub b where b.x = a.b limit 1) as result_value
++>from t002main a;
+
+RESULT_VALUE
+----------
+
+ 1
+
+--- 1 row(s) selected.
+>>
+>>-- Should get a cardinality violation (error 8401)
+>>select
++>(select y aa from t002sub b where b.y = a.b limit 2) as result_value
++>from t002main a;
+
+*** ERROR[8401] A row subquery or SELECT...INTO statement cannot return more than one row.
+
+--- 0 row(s) selected.
+>>
+>>-- Should return 1
+>>select
++>(select y aa from t002sub b where b.y = a.b limit 1) as result_value
++>from t002main a;
+
+RESULT_VALUE
+----------
+
+ 1
+
+--- 1 row(s) selected.
+>>
+>>-- Should return 2
+>>select
++>(select count(*) from t002sub limit 20) as result_value
++>from t002main;
+
+RESULT_VALUE
+----------
+
+ 2
+
+--- 1 row(s) selected.
+>>
+>>-- Should return 7
+>>select x from (select x from t002sol order by x desc limit 1);
+
+X
+----------
+
+ 2
+
+--- 1 row(s) selected.
 >>log;
diff --git a/core/sql/regress/core/EXPECTED037.SB b/core/sql/regress/core/EXPECTED037.SB
index a414e94..a14770c 100755
--- a/core/sql/regress/core/EXPECTED037.SB
+++ b/core/sql/regress/core/EXPECTED037.SB
@@ -38,7 +38,6 @@
 +>, CONSTRAINT_SCHEMA int not null 
 +>, CONTROL int not null 
 +>, CURSOR_NAME int not null 
-+>, CRC32 int not null
 +>, DATA int not null 
 +>--,DATETIME int not null 
 +>, DATETIME_CODE int not null 
@@ -76,7 +75,7 @@
 >>invoke table_name;
 
 -- Definition of Trafodion table TRAFODION.SCH.TABLE_NAME
--- Definition current  Tue May 22 16:42:26 2018
+-- Definition current  Tue Jul 10 20:07:07 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -116,7 +115,6 @@
   , CONSTRAINT_SCHEMA                INT NO DEFAULT NOT NULL NOT DROPPABLE
   , CONTROL                          INT NO DEFAULT NOT NULL NOT DROPPABLE
   , CURSOR_NAME                      INT NO DEFAULT NOT NULL NOT DROPPABLE
-  , CRC32                            INT NO DEFAULT NOT NULL NOT DROPPABLE
   , DATA                             INT NO DEFAULT NOT NULL NOT DROPPABLE
   , DATETIME_CODE                    INT NO DEFAULT NOT NULL NOT DROPPABLE
   , DCOMPRESS                        INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -162,7 +160,6 @@
 +>, LOW_VALUE int not null 
 +>, MAXSIZE int not null 
 +>, MBYTES int not null 
-+>, MD5 int not null
 +>, MESSAGE_LEN int not null 
 +>, MESSAGE_OCTET_LEN int not null 
 +>, MESSAGE_TEXT int not null 
@@ -195,9 +192,6 @@
 +>, SERIALIZABLE int not null 
 +>, SERIALWRITES int not null 
 +>, SERVER_NAME int not null 
-+>, SHA int not null
-+>, SHA1 int not null
-+>, SHA2 int not null
 +>, SHAPE int not null 
 +>, SHARE int not null 
 +>, SIDEINSERTS int not null 
@@ -230,7 +224,7 @@
 >>invoke system_name;
 
 -- Definition of Trafodion table TRAFODION.SCH.SYSTEM_NAME
--- Definition current  Tue May 22 16:42:31 2018
+-- Definition current  Tue Jul 10 20:07:12 2018
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -246,7 +240,6 @@
   , LOW_VALUE                        INT NO DEFAULT NOT NULL NOT DROPPABLE
   , MAXSIZE                          INT NO DEFAULT NOT NULL NOT DROPPABLE
   , MBYTES                           INT NO DEFAULT NOT NULL NOT DROPPABLE
-  , MD5                              INT NO DEFAULT NOT NULL NOT DROPPABLE
   , MESSAGE_LEN                      INT NO DEFAULT NOT NULL NOT DROPPABLE
   , MESSAGE_OCTET_LEN                INT NO DEFAULT NOT NULL NOT DROPPABLE
   , MESSAGE_TEXT                     INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -279,9 +272,6 @@
   , SERIALIZABLE                     INT NO DEFAULT NOT NULL NOT DROPPABLE
   , SERIALWRITES                     INT NO DEFAULT NOT NULL NOT DROPPABLE
   , SERVER_NAME                      INT NO DEFAULT NOT NULL NOT DROPPABLE
-  , SHA                              INT NO DEFAULT NOT NULL NOT DROPPABLE
-  , SHA1                             INT NO DEFAULT NOT NULL NOT DROPPABLE
-  , SHA2                             INT NO DEFAULT NOT NULL NOT DROPPABLE
   , SHAPE                            INT NO DEFAULT NOT NULL NOT DROPPABLE
   , SHARE                            INT NO DEFAULT NOT NULL NOT DROPPABLE
   , SIDEINSERTS                      INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -368,9 +358,14 @@
 
 >>create view sqlstate  as select usa from table_name;
 
-*** ERROR[4001] Column USA is not found.  Tables in scope: TRAFODION.SCH.TABLE_NAME.  Default schema: TRAFODION.SCH.
+*** ERROR[3128] SQLSTATE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
 
---- SQL operation failed with errors.
+*** ERROR[15001] A syntax error occurred at or before: 
+create view sqlstate  as select usa from table_name;
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>create view stddev  as select usa from table_name;
 
 *** ERROR[4001] Column USA is not found.  Tables in scope: TRAFODION.SCH.TABLE_NAME.  Default schema: TRAFODION.SCH.
@@ -386,9 +381,14 @@
 
 >>create view upshift  as select usa from table_name;
 
-*** ERROR[4001] Column USA is not found.  Tables in scope: TRAFODION.SCH.TABLE_NAME.  Default schema: TRAFODION.SCH.
+*** ERROR[3128] UPSHIFT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
 
---- SQL operation failed with errors.
+*** ERROR[15001] A syntax error occurred at or before: 
+create view upshift  as select usa from table_name;
+                  ^ (19 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>create view variance  as select usa from table_name;
 
 *** ERROR[4001] Column USA is not found.  Tables in scope: TRAFODION.SCH.TABLE_NAME.  Default schema: TRAFODION.SCH.
@@ -408,27 +408,62 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT AFTER AFTER from (values(0)) AFTER(AFTER);
 
---- SQL command prepared.
+*** ERROR[3128] AFTER is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT AFTER AFTER from (values(0)) AFTER(AFTER);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT ASYNC ASYNC from (values(0)) ASYNC(ASYNC);
 
---- SQL command prepared.
+*** ERROR[3128] ASYNC is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT ASYNC ASYNC from (values(0)) ASYNC(ASYNC);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT AT AT from (values(0)) AT(AT);
 
---- SQL command prepared.
+*** ERROR[3128] AT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT AT AT from (values(0)) AT(AT);
+           ^ (12 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT BEFORE BEFORE from (values(0)) BEFORE(BEFORE);
 
---- SQL command prepared.
+*** ERROR[3128] BEFORE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT BEFORE BEFORE from (values(0)) BEFORE(BEFORE);
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT BIT_LENGTH BIT_LENGTH from (values(0)) BIT_LENGTH(BIT_LENGTH);
 
---- SQL command prepared.
+*** ERROR[3128] BIT_LENGTH is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT BIT_LENGTH BIT_LENGTH from (values(0)) BIT_LENGTH(BIT_LENGTH);
+                           ^ (28 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [15001]
 >>prepare s1 from SELECT BOOLEAN BOOLEAN from (values(0)) BOOLEAN(BOOLEAN);
@@ -443,72 +478,170 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT BREADTH BREADTH from (values(0)) BREADTH(BREADTH);
 
---- SQL command prepared.
+*** ERROR[3128] BREADTH is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT BREADTH BREADTH from (values(0)) BREADTH(BREADTH);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT COMPLETION COMPLETION from (values(0)) COMPLETION(COMPLETION);
 
---- SQL command prepared.
+*** ERROR[3128] COMPLETION is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT COMPLETION COMPLETION from (values(0)) COMPLETION(COMPLETION);
+                           ^ (28 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT CONNECT CONNECT from (values(0)) CONNECT(CONNECT);
 
---- SQL command prepared.
+*** ERROR[3128] CONNECT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT CONNECT CONNECT from (values(0)) CONNECT(CONNECT);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT CYCLE CYCLE from (values(0)) CYCLE(CYCLE);
 
---- SQL command prepared.
+*** ERROR[3128] CYCLE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT CYCLE CYCLE from (values(0)) CYCLE(CYCLE);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT DEFERRABLE DEFERRABLE from (values(0)) DEFERRABLE(DEFERRABLE);
 
---- SQL command prepared.
+*** ERROR[3128] DEFERRABLE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT DEFERRABLE DEFERRABLE from (values(0)) DEFERRABLE(DEFERRABLE);
+                           ^ (28 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT DEFERRED DEFERRED from (values(0)) DEFERRED(DEFERRED);
 
---- SQL command prepared.
+*** ERROR[3128] DEFERRED is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT DEFERRED DEFERRED from (values(0)) DEFERRED(DEFERRED);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT DEPTH DEPTH from (values(0)) DEPTH(DEPTH);
 
---- SQL command prepared.
+*** ERROR[3128] DEPTH is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT DEPTH DEPTH from (values(0)) DEPTH(DEPTH);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT DICTIONARY DICTIONARY from (values(0)) DICTIONARY(DICTIONARY);
 
---- SQL command prepared.
+*** ERROR[3128] DICTIONARY is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT DICTIONARY DICTIONARY from (values(0)) DICTIONARY(DICTIONARY);
+                           ^ (28 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT DISCONNECT DISCONNECT from (values(0)) DISCONNECT(DISCONNECT);
 
---- SQL command prepared.
+*** ERROR[3128] DISCONNECT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT DISCONNECT DISCONNECT from (values(0)) DISCONNECT(DISCONNECT);
+                           ^ (28 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT DOMAIN DOMAIN from (values(0)) DOMAIN(DOMAIN);
 
---- SQL command prepared.
+*** ERROR[3128] DOMAIN is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT DOMAIN DOMAIN from (values(0)) DOMAIN(DOMAIN);
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT EACH EACH from (values(0)) EACH(EACH);
 
---- SQL command prepared.
+*** ERROR[3128] EACH is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT EACH EACH from (values(0)) EACH(EACH);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT EQUALS EQUALS from (values(0)) EQUALS(EQUALS);
 
---- SQL command prepared.
+*** ERROR[3128] EQUALS is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT EQUALS EQUALS from (values(0)) EQUALS(EQUALS);
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT EXEC EXEC from (values(0)) EXEC(EXEC);
 
---- SQL command prepared.
+*** ERROR[3128] EXEC is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT EXEC EXEC from (values(0)) EXEC(EXEC);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT GENERAL GENERAL from (values(0)) GENERAL(GENERAL);
 
---- SQL command prepared.
+*** ERROR[3128] GENERAL is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT GENERAL GENERAL from (values(0)) GENERAL(GENERAL);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect SYNTAX error now that we use IDENTITY as a token
 >>prepare s1 from SELECT IDENTITY IDENTITY from (values(0)) IDENTITY(IDENTITY);
@@ -523,22 +656,50 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT INITIALLY INITIALLY from (values(0)) INITIALLY(INITIALLY);
 
---- SQL command prepared.
+*** ERROR[3128] INITIALLY is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT INITIALLY INITIALLY from (values(0)) INITIALLY(INITIALLY);
+                         ^ (26 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT INSENSITIVE INSENSITIVE from (values(0)) INSENSITIVE(INSENSITIVE);
 
---- SQL command prepared.
+*** ERROR[3128] INSENSITIVE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT INSENSITIVE INSENSITIVE from (values(0)) INSENSITIVE(INSENSITIVE);
+                             ^ (30 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT LEAVE LEAVE from (values(0)) LEAVE(LEAVE);
 
---- SQL command prepared.
+*** ERROR[3128] LEAVE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT LEAVE LEAVE from (values(0)) LEAVE(LEAVE);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT LESS LESS from (values(0)) LESS(LESS);
 
---- SQL command prepared.
+*** ERROR[3128] LESS is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT LESS LESS from (values(0)) LESS(LESS);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect syntax error, LIMIT must be double quoted.
 >>prepare s1 from SELECT LIMIT LIMIT from (values(0)) LIMIT(LIMIT);
@@ -553,12 +714,26 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT LOOP LOOP from (values(0)) LOOP(LOOP);
 
---- SQL command prepared.
+*** ERROR[3128] LOOP is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT LOOP LOOP from (values(0)) LOOP(LOOP);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT MODIFY MODIFY from (values(0)) MODIFY(MODIFY);
 
---- SQL command prepared.
+*** ERROR[3128] MODIFY is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT MODIFY MODIFY from (values(0)) MODIFY(MODIFY);
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT NEW NEW from (values(0)) NEW(NEW);
@@ -568,7 +743,14 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT NEXT NEXT from (values(0)) NEXT(NEXT);
 
---- SQL command prepared.
+*** ERROR[3128] NEXT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT NEXT NEXT from (values(0)) NEXT(NEXT);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [15001]
 >>prepare s1 from SELECT NONE NONE from (values(0)) NONE(NONE);
@@ -583,7 +765,14 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT OBJECT OBJECT from (values(0)) OBJECT(OBJECT);
 
---- SQL command prepared.
+*** ERROR[3128] OBJECT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT OBJECT OBJECT from (values(0)) OBJECT(OBJECT);
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT OID OID from (values(0)) OID(OID);
@@ -598,47 +787,110 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT OPERATORS OPERATORS from (values(0)) OPERATORS(OPERATORS);
 
---- SQL command prepared.
+*** ERROR[3128] OPERATORS is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT OPERATORS OPERATORS from (values(0)) OPERATORS(OPERATORS);
+                         ^ (26 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT OTHERS OTHERS from (values(0)) OTHERS(OTHERS);
 
---- SQL command prepared.
+*** ERROR[3128] OTHERS is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT OTHERS OTHERS from (values(0)) OTHERS(OTHERS);
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT PAD PAD from (values(0)) PAD(PAD);
 
---- SQL command prepared.
+*** ERROR[3128] PAD is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT PAD PAD from (values(0)) PAD(PAD);
+             ^ (14 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT PARAMETERS PARAMETERS from (values(0)) PARAMETERS(PARAMETERS);
 
---- SQL command prepared.
+*** ERROR[3128] PARAMETERS is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT PARAMETERS PARAMETERS from (values(0)) PARAMETERS(PARAMETERS);
+                           ^ (28 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT PENDANT PENDANT from (values(0)) PENDANT(PENDANT);
 
---- SQL command prepared.
+*** ERROR[3128] PENDANT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT PENDANT PENDANT from (values(0)) PENDANT(PENDANT);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT PREORDER PREORDER from (values(0)) PREORDER(PREORDER);
 
---- SQL command prepared.
+*** ERROR[3128] PREORDER is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT PREORDER PREORDER from (values(0)) PREORDER(PREORDER);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT PRESERVE PRESERVE from (values(0)) PRESERVE(PRESERVE);
 
---- SQL command prepared.
+*** ERROR[3128] PRESERVE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT PRESERVE PRESERVE from (values(0)) PRESERVE(PRESERVE);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT PRIOR PRIOR from (values(0)) PRIOR(PRIOR);
 
---- SQL command prepared.
+*** ERROR[3128] PRIOR is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT PRIOR PRIOR from (values(0)) PRIOR(PRIOR);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT PRIVATE PRIVATE from (values(0)) PRIVATE(PRIVATE);
 
---- SQL command prepared.
+*** ERROR[3128] PRIVATE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT PRIVATE PRIVATE from (values(0)) PRIVATE(PRIVATE);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [15001]
 >>prepare s1 from SELECT PROTECTED PROTECTED from (values(0)) PROTECTED(PROTECTED);
@@ -653,32 +905,74 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT REF REF from (values(0)) REF(REF);
 
---- SQL command prepared.
+*** ERROR[3128] REF is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT REF REF from (values(0)) REF(REF);
+             ^ (14 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT REFERENCING REFERENCING from (values(0)) REFERENCING(REFERENCING);
 
---- SQL command prepared.
+*** ERROR[3128] REFERENCING is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT REFERENCING REFERENCING from (values(0)) REFERENCING(REFERENCING);
+                             ^ (30 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT RELATIVE RELATIVE from (values(0)) RELATIVE(RELATIVE);
 
---- SQL command prepared.
+*** ERROR[3128] RELATIVE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT RELATIVE RELATIVE from (values(0)) RELATIVE(RELATIVE);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT RESIGNAL RESIGNAL from (values(0)) RESIGNAL(RESIGNAL);
 
---- SQL command prepared.
+*** ERROR[3128] RESIGNAL is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT RESIGNAL RESIGNAL from (values(0)) RESIGNAL(RESIGNAL);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT RETURNS RETURNS from (values(0)) RETURNS(RETURNS);
 
---- SQL command prepared.
+*** ERROR[3128] RETURNS is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT RETURNS RETURNS from (values(0)) RETURNS(RETURNS);
+             ^ (14 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT ROUTINE ROUTINE from (values(0)) ROUTINE(ROUTINE);
 
---- SQL command prepared.
+*** ERROR[3128] ROUTINE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT ROUTINE ROUTINE from (values(0)) ROUTINE(ROUTINE);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT ROW ROW from (values(0)) ROW(ROW);
@@ -693,57 +987,134 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SAVEPOINT SAVEPOINT from (values(0)) SAVEPOINT(SAVEPOINT);
 
---- SQL command prepared.
+*** ERROR[3128] SAVEPOINT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SAVEPOINT SAVEPOINT from (values(0)) SAVEPOINT(SAVEPOINT);
+                         ^ (26 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SCROLL SCROLL from (values(0)) SCROLL(SCROLL);
 
---- SQL command prepared.
+*** ERROR[3128] SCROLL is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SCROLL SCROLL from (values(0)) SCROLL(SCROLL);
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SEARCH SEARCH from (values(0)) SEARCH(SEARCH);
 
---- SQL command prepared.
+*** ERROR[3128] SEARCH is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SEARCH SEARCH from (values(0)) SEARCH(SEARCH);
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SENSITIVE SENSITIVE from (values(0)) SENSITIVE(SENSITIVE);
 
---- SQL command prepared.
+*** ERROR[3128] SENSITIVE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SENSITIVE SENSITIVE from (values(0)) SENSITIVE(SENSITIVE);
+                         ^ (26 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SIGNAL SIGNAL from (values(0)) SIGNAL(SIGNAL);
 
---- SQL command prepared.
+*** ERROR[3128] SIGNAL is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SIGNAL SIGNAL from (values(0)) SIGNAL(SIGNAL);
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SIMILAR SIMILAR from (values(0)) SIMILAR(SIMILAR);
 
---- SQL command prepared.
+*** ERROR[3128] SIMILAR is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SIMILAR SIMILAR from (values(0)) SIMILAR(SIMILAR);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SQLEXCEPTION SQLEXCEPTION from (values(0)) SQLEXCEPTION(SQLEXCEPTION);
 
---- SQL command prepared.
+*** ERROR[3128] SQLEXCEPTION is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SQLEXCEPTION SQLEXCEPTION from (values(0)) SQLEXCEPTION(SQLEXCEPTION);
+                               ^ (32 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SQLSTATE SQLSTATE from (values(0)) SQLSTATE(SQLSTATE);
 
---- SQL command prepared.
+*** ERROR[3128] SQLSTATE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SQLSTATE SQLSTATE from (values(0)) SQLSTATE(SQLSTATE);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SQLWARNING SQLWARNING from (values(0)) SQLWARNING(SQLWARNING);
 
---- SQL command prepared.
+*** ERROR[3128] SQLWARNING is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SQLWARNING SQLWARNING from (values(0)) SQLWARNING(SQLWARNING);
+                           ^ (28 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT STRUCTURE STRUCTURE from (values(0)) STRUCTURE(STRUCTURE);
 
---- SQL command prepared.
+*** ERROR[3128] STRUCTURE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT STRUCTURE STRUCTURE from (values(0)) STRUCTURE(STRUCTURE);
+                         ^ (26 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SYSTEM_USER SYSTEM_USER from (values(0)) SYSTEM_USER(SYSTEM_USER);
 
---- SQL command prepared.
+*** ERROR[3128] SYSTEM_USER is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SYSTEM_USER SYSTEM_USER from (values(0)) SYSTEM_USER(SYSTEM_USER);
+                             ^ (30 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT TEMPORARY TEMPORARY from (values(0)) TEMPORARY(TEMPORARY);
@@ -758,37 +1129,86 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT TEST TEST from (values(0)) TEST(TEST);
 
---- SQL command prepared.
+*** ERROR[3128] TEST is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT TEST TEST from (values(0)) TEST(TEST);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT THERE THERE from (values(0)) THERE(THERE);
 
---- SQL command prepared.
+*** ERROR[3128] THERE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT THERE THERE from (values(0)) THERE(THERE);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT TIMEZONE_HOUR TIMEZONE_HOUR from (values(0)) TIMEZONE_HOUR(TIMEZONE_HOUR);
 
---- SQL command prepared.
+*** ERROR[3128] TIMEZONE_HOUR is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT TIMEZONE_HOUR TIMEZONE_HOUR from (values(0)) TIMEZONE_HOUR(TIMEZONE_HOUR
+                                 ^ (34 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT TIMEZONE_MINUTE TIMEZONE_MINUTE from (values(0)) TIMEZONE_MINUTE(TIMEZONE_MINUTE);
 
---- SQL command prepared.
+*** ERROR[3128] TIMEZONE_MINUTE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT TIMEZONE_MINUTE TIMEZONE_MINUTE from (values(0)) TIMEZONE_MINUTE(TIMEZON
+                                     ^ (38 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT TRANSLATION TRANSLATION from (values(0)) TRANSLATION(TRANSLATION);
 
---- SQL command prepared.
+*** ERROR[3128] TRANSLATION is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT TRANSLATION TRANSLATION from (values(0)) TRANSLATION(TRANSLATION);
+                             ^ (30 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT TRIGGER TRIGGER from (values(0)) TRIGGER(TRIGGER);
 
---- SQL command prepared.
+*** ERROR[3128] TRIGGER is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT TRIGGER TRIGGER from (values(0)) TRIGGER(TRIGGER);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT UNDER UNDER from (values(0)) UNDER(UNDER);
 
---- SQL command prepared.
+*** ERROR[3128] UNDER is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT UNDER UNDER from (values(0)) UNDER(UNDER);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT USAGE USAGE from (values(0)) USAGE(USAGE);
@@ -803,152 +1223,362 @@
 >>-- Expect error [3128]
 >>prepare s1 from SELECT VARIABLE VARIABLE from (values(0)) VARIABLE(VARIABLE);
 
---- SQL command prepared.
+*** ERROR[3128] VARIABLE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT VARIABLE VARIABLE from (values(0)) VARIABLE(VARIABLE);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT VIRTUAL VIRTUAL from (values(0)) VIRTUAL(VIRTUAL);
 
---- SQL command prepared.
+*** ERROR[3128] VIRTUAL is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT VIRTUAL VIRTUAL from (values(0)) VIRTUAL(VIRTUAL);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT VISIBLE VISIBLE from (values(0)) VISIBLE(VISIBLE);
 
---- SQL command prepared.
+*** ERROR[3128] VISIBLE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT VISIBLE VISIBLE from (values(0)) VISIBLE(VISIBLE);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT WAIT WAIT from (values(0)) WAIT(WAIT);
 
---- SQL command prepared.
+*** ERROR[3128] WAIT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT WAIT WAIT from (values(0)) WAIT(WAIT);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT WHILE WHILE from (values(0)) WHILE(WHILE);
 
---- SQL command prepared.
+*** ERROR[3128] WHILE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT WHILE WHILE from (values(0)) WHILE(WHILE);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT ZONE ZONE from (values(0)) ZONE(ZONE);
 
---- SQL command prepared.
+*** ERROR[3128] ZONE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT ZONE ZONE from (values(0)) ZONE(ZONE);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT CAST CAST from (values(0)) CAST(CAST);
 
---- SQL command prepared.
+*** ERROR[3128] CAST is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT CAST CAST from (values(0)) CAST(CAST);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT CHARACTER_LENGTH CHARACTER_LENGTH from (values(0)) CHARACTER_LENGTH(CHARACTER_LENGTH);
 
---- SQL command prepared.
+*** ERROR[3128] CHARACTER_LENGTH is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT CHARACTER_LENGTH CHARACTER_LENGTH from (values(0)) CHARACTER_LENGTH(CHAR
+                                       ^ (40 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT CHAR_LENGTH CHAR_LENGTH from (values(0)) CHAR_LENGTH(CHAR_LENGTH);
 
---- SQL command prepared.
+*** ERROR[3128] CHAR_LENGTH is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT CHAR_LENGTH CHAR_LENGTH from (values(0)) CHAR_LENGTH(CHAR_LENGTH);
+                             ^ (30 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT DOUBLE DOUBLE from (values(0)) DOUBLE(DOUBLE);
 
---- SQL command prepared.
+*** ERROR[3128] DOUBLE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT DOUBLE DOUBLE from (values(0)) DOUBLE(DOUBLE);
+                   ^ (20 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT ELSE ELSE from (values(0)) ELSE(ELSE);
 
---- SQL command prepared.
+*** ERROR[3128] ELSE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT ELSE ELSE from (values(0)) ELSE(ELSE);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT END END from (values(0)) END(END);
 
---- SQL command prepared.
+*** ERROR[3128] END is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT END END from (values(0)) END(END);
+             ^ (14 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT FLOAT FLOAT from (values(0)) FLOAT(FLOAT);
 
---- SQL command prepared.
+*** ERROR[3128] FLOAT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT FLOAT FLOAT from (values(0)) FLOAT(FLOAT);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT LOWER LOWER from (values(0)) LOWER(LOWER);
 
---- SQL command prepared.
+*** ERROR[3128] LOWER is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT LOWER LOWER from (values(0)) LOWER(LOWER);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT MIN MIN from (values(0)) MIN(MIN);
 
---- SQL command prepared.
+*** ERROR[3128] MIN is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT MIN MIN from (values(0)) MIN(MIN);
+             ^ (14 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT NATIONAL NATIONAL from (values(0)) NATIONAL(NATIONAL);
 
---- SQL command prepared.
+*** ERROR[3128] NATIONAL is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT NATIONAL NATIONAL from (values(0)) NATIONAL(NATIONAL);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT NCHAR NCHAR from (values(0)) NCHAR(NCHAR);
 
---- SQL command prepared.
+*** ERROR[3128] NCHAR is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT NCHAR NCHAR from (values(0)) NCHAR(NCHAR);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT OCTET_LENGTH OCTET_LENGTH from (values(0)) OCTET_LENGTH(OCTET_LENGTH);
 
---- SQL command prepared.
+*** ERROR[3128] OCTET_LENGTH is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT OCTET_LENGTH OCTET_LENGTH from (values(0)) OCTET_LENGTH(OCTET_LENGTH);
+                               ^ (32 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT POSITION POSITION from (values(0)) POSITION(POSITION);
 
---- SQL command prepared.
+*** ERROR[3128] POSITION is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT POSITION POSITION from (values(0)) POSITION(POSITION);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT PRECISION PRECISION from (values(0)) PRECISION(PRECISION);
 
---- SQL command prepared.
+*** ERROR[3128] PRECISION is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT PRECISION PRECISION from (values(0)) PRECISION(PRECISION);
+                         ^ (26 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT REAL REAL from (values(0)) REAL(REAL);
 
---- SQL command prepared.
+*** ERROR[3128] REAL is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT REAL REAL from (values(0)) REAL(REAL);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SUBSTRING SUBSTRING from (values(0)) SUBSTRING(SUBSTRING);
 
---- SQL command prepared.
+*** ERROR[3128] SUBSTRING is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SUBSTRING SUBSTRING from (values(0)) SUBSTRING(SUBSTRING);
+                         ^ (26 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SQL_FLOAT SQL_FLOAT from (values(0)) SQL_FLOAT(SQL_FLOAT);
 
---- SQL command prepared.
+*** ERROR[3128] SQL_FLOAT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SQL_FLOAT SQL_FLOAT from (values(0)) SQL_FLOAT(SQL_FLOAT);
+                         ^ (26 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SQL_REAL SQL_REAL from (values(0)) SQL_REAL(SQL_REAL);
 
---- SQL command prepared.
+*** ERROR[3128] SQL_REAL is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SQL_REAL SQL_REAL from (values(0)) SQL_REAL(SQL_REAL);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT SQL_VARCHAR SQL_VARCHAR from (values(0)) SQL_VARCHAR(SQL_VARCHAR);
 
---- SQL command prepared.
+*** ERROR[3128] SQL_VARCHAR is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT SQL_VARCHAR SQL_VARCHAR from (values(0)) SQL_VARCHAR(SQL_VARCHAR);
+                             ^ (30 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT TRIM TRIM from (values(0)) TRIM(TRIM);
 
---- SQL command prepared.
+*** ERROR[3128] TRIM is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT TRIM TRIM from (values(0)) TRIM(TRIM);
+               ^ (16 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT UPPER UPPER from (values(0)) UPPER(UPPER);
 
---- SQL command prepared.
+*** ERROR[3128] UPPER is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT UPPER UPPER from (values(0)) UPPER(UPPER);
+                 ^ (18 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT UPSHIFT UPSHIFT from (values(0)) UPSHIFT(UPSHIFT);
 
---- SQL command prepared.
+*** ERROR[3128] UPSHIFT is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT UPSHIFT UPSHIFT from (values(0)) UPSHIFT(UPSHIFT);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT VARCHAR VARCHAR from (values(0)) VARCHAR(VARCHAR);
 
---- SQL command prepared.
+*** ERROR[3128] VARCHAR is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT VARCHAR VARCHAR from (values(0)) VARCHAR(VARCHAR);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect error [3128]
 >>prepare s1 from SELECT VARYING VARYING from (values(0)) VARYING(VARYING);
 
---- SQL command prepared.
+*** ERROR[3128] VARYING is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT VARYING VARYING from (values(0)) VARYING(VARYING);
+                     ^ (22 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect SYNTAX error
 >>prepare s1 from SELECT COLLATE COLLATE from (values(0)) COLLATE(COLLATE);
@@ -1593,7 +2223,14 @@
 >>-- Expect SYNTAX error
 >>prepare s1 from SELECT LANGUAGE LANGUAGE from (values(0)) LANGUAGE(LANGUAGE);
 
---- SQL command prepared.
+*** ERROR[3128] LANGUAGE is a reserved word.  It must be delimited by double-quotes to be used as an identifier.
+
+*** ERROR[15001] A syntax error occurred at or before: 
+SELECT LANGUAGE LANGUAGE from (values(0)) LANGUAGE(LANGUAGE);
+                       ^ (24 characters from start of SQL statement)
+
+*** ERROR[8822] The statement was not prepared.
+
 >>
 >>-- Expect SYNTAX error
 >>prepare s1 from SELECT LAST LAST from (values(0)) LAST(LAST);
@@ -3251,11 +3888,6 @@
 --- SQL command prepared.
 >>
 >>-- Expect success
->>prepare s1 from SELECT CRC32 CRC32 from (values(0)) CRC32(CRC32);
-
---- SQL command prepared.
->>
->>-- Expect success
 >>prepare s1 from SELECT CURDATE CURDATE from (values(0)) CURDATE(CURDATE);
 
 --- SQL command prepared.
@@ -3691,11 +4323,6 @@
 --- SQL command prepared.
 >>
 >>-- Expect success
->>prepare s1 from SELECT MD5 MD5 from (values(0)) MD5(MD5);
-
---- SQL command prepared.
->>
->>-- Expect success
 >>prepare s1 from SELECT MAXSIZE MAXSIZE from (values(0)) MAXSIZE(MAXSIZE);
 
 --- SQL command prepared.
@@ -4096,21 +4723,6 @@
 --- SQL command prepared.
 >>
 >>-- Expect success
->>prepare s1 from SELECT SHA SHA from (values(0)) SHA(SHA);
-
---- SQL command prepared.
->>
->>-- Expect success
->>prepare s1 from SELECT SHA1 SHA1 from (values(0)) SHA1(SHA1);
-
---- SQL command prepared.
->>
->>-- Expect success
->>prepare s1 from SELECT SHA2 SHA2 from (values(0)) SHA2(SHA2);
-
---- SQL command prepared.
->>
->>-- Expect success
 >>prepare s1 from SELECT SHAPE SHAPE from (values(0)) SHAPE(SHAPE);
 
 --- SQL command prepared.
diff --git a/core/sql/regress/core/EXPECTED038.LINUX b/core/sql/regress/core/EXPECTED038.LINUX
index d317748..aceb087 100644
--- a/core/sql/regress/core/EXPECTED038.LINUX
+++ b/core/sql/regress/core/EXPECTED038.LINUX
@@ -4670,6 +4670,135 @@
 --- 4 row(s) selected.
 >>-- 4 rows
 >>
+>>-- test SPLIT_PART function
+>>
+>>select split_part('sa:sbl:sc', ':', 1) from t038sf;
+
+(EXPR)   
+---------
+
+sa       
+sa       
+sa       
+sa       
+
+--- 4 row(s) selected.
+>>select split_part('sa:sbl:sc', ':', 2) from t038sf;
+
+(EXPR)   
+---------
+
+sbl      
+sbl      
+sbl      
+sbl      
+
+--- 4 row(s) selected.
+>>select split_part('sa:sbl:sc', ':', 3) from t038sf;
+
+(EXPR)   
+---------
+
+sc       
+sc       
+sc       
+sc       
+
+--- 4 row(s) selected.
+>>
+>>-- **EMPTY RESULT** 
+>>select split_part('sa:sbl:sc', ':', 0) from t038sf;
+
+*** ERROR[8691] Field position must be greater than zero, currently is 0.
+
+--- 0 row(s) selected.
+>>select split_part('sa:sbl:sc', ':', 4) from t038sf;
+
+(EXPR)   
+---------
+
+         
+         
+         
+         
+
+--- 4 row(s) selected.
+>>
+>>insert into T038sf values(110, 'a/b/c', 'sa/dsd/s');
+
+--- 1 row(s) inserted.
+>>insert into T038sf values(111, 'sasd', 'dsa:/~sd');
+
+--- 1 row(s) inserted.
+>>insert into T038sf values(112, '#$%$#@', 'dsasggggsad');
+
+--- 1 row(s) inserted.
+>>insert into T038sf values(114, 'a', '这是^中文:测试');
+
+--- 1 row(s) inserted.
+>>
+>>select split_part(c, '/', 2) from t038sf;
+
+(EXPR)                        
+------------------------------
+
+                              
+                              
+                              
+                              
+dsd                           
+~sd                           
+                              
+                              
+
+--- 8 row(s) selected.
+>>select split_part(c, 'ggg', 2) from t038sf;
+
+(EXPR)                        
+------------------------------
+
+                              
+                              
+                              
+                              
+                              
+                              
+gsad                          
+                              
+
+--- 8 row(s) selected.
+>>select split_part(c, 'sd', 1) from t038sf;
+
+(EXPR)                        
+------------------------------
+
+                              
+                              
+                              
+                              
+sa/d                          
+dsa:/~                        
+                              
+                              
+
+--- 8 row(s) selected.
+>>select split_part(c, ':', 1) from t038sf;
+
+(EXPR)                        
+------------------------------
+
+                              
+                              
+                              
+                              
+                              
+                              
+                              
+这是^中文                 
+
+--- 8 row(s) selected.
+>>
+>>
 >>-- Test for Genesis soln: 10-071004-7982
 >>-- Previously this would run out of memory in the Generator.
 >>-- Now it compiles successfully with Query Cache off.
diff --git a/core/sql/regress/core/EXPECTED116 b/core/sql/regress/core/EXPECTED116
index a67e957..c423f1a 100644
--- a/core/sql/regress/core/EXPECTED116
+++ b/core/sql/regress/core/EXPECTED116
@@ -735,6 +735,9 @@
 
 T116T1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>drop table t116t1;
 
@@ -748,6 +751,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>create table t116t2 (a int);
 
@@ -762,6 +768,9 @@
 SB_PERSISTENT_SAMPLES
 T116T2
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>drop schema t116sch1 cascade;
 
@@ -791,6 +800,9 @@
 SB_PERSISTENT_SAMPLES
 T116T1
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema sch;
diff --git a/core/sql/regress/core/EXPECTED162 b/core/sql/regress/core/EXPECTED162
index 20fa63f..82da1bc 100644
--- a/core/sql/regress/core/EXPECTED162
+++ b/core/sql/regress/core/EXPECTED162
@@ -1157,21 +1157,21 @@
 >>
 >>select * from store ;
 
-S_STORE_SK   S_STORE_ID            S_REC_START_DATE            S_REC_END_DATE              S_CLOSED_DATE_SK  S_STORE_NAME          S_NUMBER_EMPLOYEES  S_FLOOR_SPACE  S_HOURS               S_MANAGER             S_MARKET_ID  S_GEOGRAPHY_CLASS     S_MARKET_DESC         S_MARKET_MANAGER      S_DIVISION_ID  S_DIVISION_NAME       S_COMPANY_ID  S_COMPANY_NAME        S_STREET_NUMBER       S_STREET_NAME         S_STREET_TYPE         S_SUITE_NUMBER        S_CITY                S_COUNTY              S_STATE               S_ZIP                 S_COUNTRY             S_GMT_OFFSET     S_TAX_PRECENTAGE
------------  --------------------  --------------------------  --------------------------  ----------------  --------------------  ------------------  -------------  --------------------  --------------------  -----------  --------------------  --------------------  --------------------  -------------  --------------------  ------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  ---------------  ----------------
+S_STORE_SK   S_STORE_ID            S_REC_START_DATE               S_REC_END_DATE                 S_CLOSED_DATE_SK  S_STORE_NAME          S_NUMBER_EMPLOYEES  S_FLOOR_SPACE  S_HOURS               S_MANAGER             S_MARKET_ID  S_GEOGRAPHY_CLASS     S_MARKET_DESC         S_MARKET_MANAGER      S_DIVISION_ID  S_DIVISION_NAME       S_COMPANY_ID  S_COMPANY_NAME        S_STREET_NUMBER       S_STREET_NAME         S_STREET_TYPE         S_SUITE_NUMBER        S_CITY                S_COUNTY              S_STATE               S_ZIP                 S_COUNTRY             S_GMT_OFFSET     S_TAX_PRECENTAGE
+-----------  --------------------  -----------------------------  -----------------------------  ----------------  --------------------  ------------------  -------------  --------------------  --------------------  -----------  --------------------  --------------------  --------------------  -------------  --------------------  ------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  ---------------  ----------------
 
-          1  AAAAAAAABAAAAAAA      1997-03-13 00:00:00.000000  ?                                    2451189  ought                                245        5250760  8AM-4PM               William Ward                    2  Unknown               Enough high areas st  Charles Bartley                   1  Unknown                          1  Unknown               767                   Spring                Wy                    Suite 250             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
-          2  AAAAAAAACAAAAAAA      1997-03-13 00:00:00.000000  2000-03-12 00:00:00.000000                 ?  able                                 236        5285950  8AM-4PM               Scott Smith                     8  Unknown               Parliamentary candid  David Lamontagne                  1  Unknown                          1  Unknown               255                   Sycamore              Dr.                   Suite 410             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
-          3  AAAAAAAACAAAAAAA      2000-03-13 00:00:00.000000  ?                                          ?  able                                 236        7557959  8AM-4PM               Scott Smith                     7  Unknown               Impossible, true arm  David Lamontagne                  1  Unknown                          1  Unknown               877                   Park Laurel           Road                  Suite T               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
-          4  AAAAAAAAEAAAAAAA      1997-03-13 00:00:00.000000  1999-03-13 00:00:00.000000           2451044  ese                                  218        9341467  8AM-4PM               Edwin Adams                     4  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               27                    Lake                  Ln                    Suite 260             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
-          5  AAAAAAAAEAAAAAAA      1999-03-14 00:00:00.000000  2001-03-12 00:00:00.000000           2450910  anti                                 288        9078805  8AM-4PM               Edwin Adams                     8  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               27                    Lee 6th               Court                 Suite 80              Fairview              Williamson County     TN                    35709                 United States         -5.0000000E+000    2.9999999E-002
-          6  AAAAAAAAEAAAAAAA      2001-03-13 00:00:00.000000  ?                                          ?  cally                                229        9026222  8AM-4PM               Edwin Adams                    10  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               220                   6th                   Lane                  Suite 140             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
-          7  AAAAAAAAHAAAAAAA      1997-03-13 00:00:00.000000  ?                                          ?  ation                                297        8954883  8AM-4PM               David Thomas                    9  Unknown               Architects coul       Thomas Benton                     1  Unknown                          1  Unknown               811                   Lee                   Circle                Suite T               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    9.9999997E-003
-          8  AAAAAAAAIAAAAAAA      1997-03-13 00:00:00.000000  2000-03-12 00:00:00.000000                 ?  eing                                 278        6995995  8AM-4PM               Brett Yates                     2  Unknown               Various bars make mo  Dean Morrison                     1  Unknown                          1  Unknown               226                   12th                  Lane                  Suite D               Fairview              Williamson County     TN                    35709                 United States         -5.0000000E+000    7.9999998E-002
-          9  AAAAAAAAIAAAAAAA      2000-03-13 00:00:00.000000  ?                                          ?  eing                                 271        6995995  8AM-4PM               Brett Yates                     2  Unknown               Formal, psychologica  Dean Morrison                     1  Unknown                          1  Unknown               226                   Hill                  Boulevard             Suite 190             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    7.9999998E-002
-         10  AAAAAAAAKAAAAAAA      1997-03-13 00:00:00.000000  1999-03-13 00:00:00.000000                 ?  bar                                  294        9294113  8AM-4PM               Raymond Jacobs                  8  Unknown               Little expectations   Michael Wilson                    1  Unknown                          1  Unknown               175                   4th                   Court                 Suite C               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    5.9999998E-002
-         11  AAAAAAAAKAAAAAAA      1999-03-14 00:00:00.000000  2001-03-12 00:00:00.000000                 ?  ought                                294        9294113  8AM-4PM               Raymond Jacobs                  6  Unknown               Mysterious employe    Michael Wilson                    1  Unknown                          1  Unknown               175                   Park Green            Court                 Suite 160             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    1.0999999E-002
-         12  AAAAAAAAKAAAAAAA      2001-03-13 00:00:00.000000  ?                                          ?  ought                                294        5219562  8AM-12AM              Robert Thompson                 6  Unknown               Events develop i      Dustin Kelly                      1  Unknown                          1  Unknown               337                   College               Boulevard             Suite 100             Fairview              Williamson County     TN                    31904                 United States         -5.0000000E+000    9.9999997E-003
+          1  AAAAAAAABAAAAAAA      1997-03-13 00:00:00.000000000  ?                                       2451189  ought                                245        5250760  8AM-4PM               William Ward                    2  Unknown               Enough high areas st  Charles Bartley                   1  Unknown                          1  Unknown               767                   Spring                Wy                    Suite 250             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
+          2  AAAAAAAACAAAAAAA      1997-03-13 00:00:00.000000000  2000-03-12 00:00:00.000000000                 ?  able                                 236        5285950  8AM-4PM               Scott Smith                     8  Unknown               Parliamentary candid  David Lamontagne                  1  Unknown                          1  Unknown               255                   Sycamore              Dr.                   Suite 410             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
+          3  AAAAAAAACAAAAAAA      2000-03-13 00:00:00.000000000  ?                                             ?  able                                 236        7557959  8AM-4PM               Scott Smith                     7  Unknown               Impossible, true arm  David Lamontagne                  1  Unknown                          1  Unknown               877                   Park Laurel           Road                  Suite T               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
+          4  AAAAAAAAEAAAAAAA      1997-03-13 00:00:00.000000000  1999-03-13 00:00:00.000000000           2451044  ese                                  218        9341467  8AM-4PM               Edwin Adams                     4  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               27                    Lake                  Ln                    Suite 260             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
+          5  AAAAAAAAEAAAAAAA      1999-03-14 00:00:00.000000000  2001-03-12 00:00:00.000000000           2450910  anti                                 288        9078805  8AM-4PM               Edwin Adams                     8  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               27                    Lee 6th               Court                 Suite 80              Fairview              Williamson County     TN                    35709                 United States         -5.0000000E+000    2.9999999E-002
+          6  AAAAAAAAEAAAAAAA      2001-03-13 00:00:00.000000000  ?                                             ?  cally                                229        9026222  8AM-4PM               Edwin Adams                    10  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               220                   6th                   Lane                  Suite 140             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
+          7  AAAAAAAAHAAAAAAA      1997-03-13 00:00:00.000000000  ?                                             ?  ation                                297        8954883  8AM-4PM               David Thomas                    9  Unknown               Architects coul       Thomas Benton                     1  Unknown                          1  Unknown               811                   Lee                   Circle                Suite T               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    9.9999997E-003
+          8  AAAAAAAAIAAAAAAA      1997-03-13 00:00:00.000000000  2000-03-12 00:00:00.000000000                 ?  eing                                 278        6995995  8AM-4PM               Brett Yates                     2  Unknown               Various bars make mo  Dean Morrison                     1  Unknown                          1  Unknown               226                   12th                  Lane                  Suite D               Fairview              Williamson County     TN                    35709                 United States         -5.0000000E+000    7.9999998E-002
+          9  AAAAAAAAIAAAAAAA      2000-03-13 00:00:00.000000000  ?                                             ?  eing                                 271        6995995  8AM-4PM               Brett Yates                     2  Unknown               Formal, psychologica  Dean Morrison                     1  Unknown                          1  Unknown               226                   Hill                  Boulevard             Suite 190             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    7.9999998E-002
+         10  AAAAAAAAKAAAAAAA      1997-03-13 00:00:00.000000000  1999-03-13 00:00:00.000000000                 ?  bar                                  294        9294113  8AM-4PM               Raymond Jacobs                  8  Unknown               Little expectations   Michael Wilson                    1  Unknown                          1  Unknown               175                   4th                   Court                 Suite C               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    5.9999998E-002
+         11  AAAAAAAAKAAAAAAA      1999-03-14 00:00:00.000000000  2001-03-12 00:00:00.000000000                 ?  ought                                294        9294113  8AM-4PM               Raymond Jacobs                  6  Unknown               Mysterious employe    Michael Wilson                    1  Unknown                          1  Unknown               175                   Park Green            Court                 Suite 160             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    1.0999999E-002
+         12  AAAAAAAAKAAAAAAA      2001-03-13 00:00:00.000000000  ?                                             ?  ought                                294        5219562  8AM-12AM              Robert Thompson                 6  Unknown               Events develop i      Dustin Kelly                      1  Unknown                          1  Unknown               337                   College               Boulevard             Suite 100             Fairview              Williamson County     TN                    31904                 United States         -5.0000000E+000    9.9999997E-003
 
 --- 12 row(s) selected.
 >>
@@ -1179,374 +1179,374 @@
 
 *** WARNING[6008] Statistics for column (D_DATE) from table HIVE.HIVE.DATE_DIM were not available. As a result, the access path chosen might not be the best possible.
 
-D_DATE                    
---------------------------
+D_DATE                       
+-----------------------------
 
-2099-01-02 00:00:00.000000
-2099-01-03 00:00:00.000000
-2099-01-04 00:00:00.000000
-2099-01-05 00:00:00.000000
-2099-01-06 00:00:00.000000
-2099-01-07 00:00:00.000000
-2099-01-08 00:00:00.000000
-2099-01-09 00:00:00.000000
-2099-01-10 00:00:00.000000
-2099-01-11 00:00:00.000000
-2099-01-12 00:00:00.000000
-2099-01-13 00:00:00.000000
-2099-01-14 00:00:00.000000
-2099-01-15 00:00:00.000000
-2099-01-16 00:00:00.000000
-2099-01-17 00:00:00.000000
-2099-01-18 00:00:00.000000
-2099-01-19 00:00:00.000000
-2099-01-20 00:00:00.000000
-2099-01-21 00:00:00.000000
-2099-01-22 00:00:00.000000
-2099-01-23 00:00:00.000000
-2099-01-24 00:00:00.000000
-2099-01-25 00:00:00.000000
-2099-01-26 00:00:00.000000
-2099-01-27 00:00:00.000000
-2099-01-28 00:00:00.000000
-2099-01-29 00:00:00.000000
-2099-01-30 00:00:00.000000
-2099-01-31 00:00:00.000000
-2099-02-01 00:00:00.000000
-2099-02-02 00:00:00.000000
-2099-02-03 00:00:00.000000
-2099-02-04 00:00:00.000000
-2099-02-05 00:00:00.000000
-2099-02-06 00:00:00.000000
-2099-02-07 00:00:00.000000
-2099-02-08 00:00:00.000000
-2099-02-09 00:00:00.000000
-2099-02-10 00:00:00.000000
-2099-02-11 00:00:00.000000
-2099-02-12 00:00:00.000000
-2099-02-13 00:00:00.000000
-2099-02-14 00:00:00.000000
-2099-02-15 00:00:00.000000
-2099-02-16 00:00:00.000000
-2099-02-17 00:00:00.000000
-2099-02-18 00:00:00.000000
-2099-02-19 00:00:00.000000
-2099-02-20 00:00:00.000000
-2099-02-21 00:00:00.000000
-2099-02-22 00:00:00.000000
-2099-02-23 00:00:00.000000
-2099-02-24 00:00:00.000000
-2099-02-25 00:00:00.000000
-2099-02-26 00:00:00.000000
-2099-02-27 00:00:00.000000
-2099-02-28 00:00:00.000000
-2099-03-01 00:00:00.000000
-2099-03-02 00:00:00.000000
-2099-03-03 00:00:00.000000
-2099-03-04 00:00:00.000000
-2099-03-05 00:00:00.000000
-2099-03-06 00:00:00.000000
-2099-03-07 00:00:00.000000
-2099-03-08 00:00:00.000000
-2099-03-09 00:00:00.000000
-2099-03-10 00:00:00.000000
-2099-03-11 00:00:00.000000
-2099-03-12 00:00:00.000000
-2099-03-13 00:00:00.000000
-2099-03-14 00:00:00.000000
-2099-03-15 00:00:00.000000
-2099-03-16 00:00:00.000000
-2099-03-17 00:00:00.000000
-2099-03-18 00:00:00.000000
-2099-03-19 00:00:00.000000
-2099-03-20 00:00:00.000000
-2099-03-21 00:00:00.000000
-2099-03-22 00:00:00.000000
-2099-03-23 00:00:00.000000
-2099-03-24 00:00:00.000000
-2099-03-25 00:00:00.000000
-2099-03-26 00:00:00.000000
-2099-03-27 00:00:00.000000
-2099-03-28 00:00:00.000000
-2099-03-29 00:00:00.000000
-2099-03-30 00:00:00.000000
-2099-03-31 00:00:00.000000
-2099-04-01 00:00:00.000000
-2099-04-02 00:00:00.000000
-2099-04-03 00:00:00.000000
-2099-04-04 00:00:00.000000
-2099-04-05 00:00:00.000000
-2099-04-06 00:00:00.000000
-2099-04-07 00:00:00.000000
-2099-04-08 00:00:00.000000
-2099-04-09 00:00:00.000000
-2099-04-10 00:00:00.000000
-2099-04-11 00:00:00.000000
-2099-04-12 00:00:00.000000
-2099-04-13 00:00:00.000000
-2099-04-14 00:00:00.000000
-2099-04-15 00:00:00.000000
-2099-04-16 00:00:00.000000
-2099-04-17 00:00:00.000000
-2099-04-18 00:00:00.000000
-2099-04-19 00:00:00.000000
-2099-04-20 00:00:00.000000
-2099-04-21 00:00:00.000000
-2099-04-22 00:00:00.000000
-2099-04-23 00:00:00.000000
-2099-04-24 00:00:00.000000
-2099-04-25 00:00:00.000000
-2099-04-26 00:00:00.000000
-2099-04-27 00:00:00.000000
-2099-04-28 00:00:00.000000
-2099-04-29 00:00:00.000000
-2099-04-30 00:00:00.000000
-2099-05-01 00:00:00.000000
-2099-05-02 00:00:00.000000
-2099-05-03 00:00:00.000000
-2099-05-04 00:00:00.000000
-2099-05-05 00:00:00.000000
-2099-05-06 00:00:00.000000
-2099-05-07 00:00:00.000000
-2099-05-08 00:00:00.000000
-2099-05-09 00:00:00.000000
-2099-05-10 00:00:00.000000
-2099-05-11 00:00:00.000000
-2099-05-12 00:00:00.000000
-2099-05-13 00:00:00.000000
-2099-05-14 00:00:00.000000
-2099-05-15 00:00:00.000000
-2099-05-16 00:00:00.000000
-2099-05-17 00:00:00.000000
-2099-05-18 00:00:00.000000
-2099-05-19 00:00:00.000000
-2099-05-20 00:00:00.000000
-2099-05-21 00:00:00.000000
-2099-05-22 00:00:00.000000
-2099-05-23 00:00:00.000000
-2099-05-24 00:00:00.000000
-2099-05-25 00:00:00.000000
-2099-05-26 00:00:00.000000
-2099-05-27 00:00:00.000000
-2099-05-28 00:00:00.000000
-2099-05-29 00:00:00.000000
-2099-05-30 00:00:00.000000
-2099-05-31 00:00:00.000000
-2099-06-01 00:00:00.000000
-2099-06-02 00:00:00.000000
-2099-06-03 00:00:00.000000
-2099-06-04 00:00:00.000000
-2099-06-05 00:00:00.000000
-2099-06-06 00:00:00.000000
-2099-06-07 00:00:00.000000
-2099-06-08 00:00:00.000000
-2099-06-09 00:00:00.000000
-2099-06-10 00:00:00.000000
-2099-06-11 00:00:00.000000
-2099-06-12 00:00:00.000000
-2099-06-13 00:00:00.000000
-2099-06-14 00:00:00.000000
-2099-06-15 00:00:00.000000
-2099-06-16 00:00:00.000000
-2099-06-17 00:00:00.000000
-2099-06-18 00:00:00.000000
-2099-06-19 00:00:00.000000
-2099-06-20 00:00:00.000000
-2099-06-21 00:00:00.000000
-2099-06-22 00:00:00.000000
-2099-06-23 00:00:00.000000
-2099-06-24 00:00:00.000000
-2099-06-25 00:00:00.000000
-2099-06-26 00:00:00.000000
-2099-06-27 00:00:00.000000
-2099-06-28 00:00:00.000000
-2099-06-29 00:00:00.000000
-2099-06-30 00:00:00.000000
-2099-07-01 00:00:00.000000
-2099-07-02 00:00:00.000000
-2099-07-03 00:00:00.000000
-2099-07-04 00:00:00.000000
-2099-07-05 00:00:00.000000
-2099-07-06 00:00:00.000000
-2099-07-07 00:00:00.000000
-2099-07-08 00:00:00.000000
-2099-07-09 00:00:00.000000
-2099-07-10 00:00:00.000000
-2099-07-11 00:00:00.000000
-2099-07-12 00:00:00.000000
-2099-07-13 00:00:00.000000
-2099-07-14 00:00:00.000000
-2099-07-15 00:00:00.000000
-2099-07-16 00:00:00.000000
-2099-07-17 00:00:00.000000
-2099-07-18 00:00:00.000000
-2099-07-19 00:00:00.000000
-2099-07-20 00:00:00.000000
-2099-07-21 00:00:00.000000
-2099-07-22 00:00:00.000000
-2099-07-23 00:00:00.000000
-2099-07-24 00:00:00.000000
-2099-07-25 00:00:00.000000
-2099-07-26 00:00:00.000000
-2099-07-27 00:00:00.000000
-2099-07-28 00:00:00.000000
-2099-07-29 00:00:00.000000
-2099-07-30 00:00:00.000000
-2099-07-31 00:00:00.000000
-2099-08-01 00:00:00.000000
-2099-08-02 00:00:00.000000
-2099-08-03 00:00:00.000000
-2099-08-04 00:00:00.000000
-2099-08-05 00:00:00.000000
-2099-08-06 00:00:00.000000
-2099-08-07 00:00:00.000000
-2099-08-08 00:00:00.000000
-2099-08-09 00:00:00.000000
-2099-08-10 00:00:00.000000
-2099-08-11 00:00:00.000000
-2099-08-12 00:00:00.000000
-2099-08-13 00:00:00.000000
-2099-08-14 00:00:00.000000
-2099-08-15 00:00:00.000000
-2099-08-16 00:00:00.000000
-2099-08-17 00:00:00.000000
-2099-08-18 00:00:00.000000
-2099-08-19 00:00:00.000000
-2099-08-20 00:00:00.000000
-2099-08-21 00:00:00.000000
-2099-08-22 00:00:00.000000
-2099-08-23 00:00:00.000000
-2099-08-24 00:00:00.000000
-2099-08-25 00:00:00.000000
-2099-08-26 00:00:00.000000
-2099-08-27 00:00:00.000000
-2099-08-28 00:00:00.000000
-2099-08-29 00:00:00.000000
-2099-08-30 00:00:00.000000
-2099-08-31 00:00:00.000000
-2099-09-01 00:00:00.000000
-2099-09-02 00:00:00.000000
-2099-09-03 00:00:00.000000
-2099-09-04 00:00:00.000000
-2099-09-05 00:00:00.000000
-2099-09-06 00:00:00.000000
-2099-09-07 00:00:00.000000
-2099-09-08 00:00:00.000000
-2099-09-09 00:00:00.000000
-2099-09-10 00:00:00.000000
-2099-09-11 00:00:00.000000
-2099-09-12 00:00:00.000000
-2099-09-13 00:00:00.000000
-2099-09-14 00:00:00.000000
-2099-09-15 00:00:00.000000
-2099-09-16 00:00:00.000000
-2099-09-17 00:00:00.000000
-2099-09-18 00:00:00.000000
-2099-09-19 00:00:00.000000
-2099-09-20 00:00:00.000000
-2099-09-21 00:00:00.000000
-2099-09-22 00:00:00.000000
-2099-09-23 00:00:00.000000
-2099-09-24 00:00:00.000000
-2099-09-25 00:00:00.000000
-2099-09-26 00:00:00.000000
-2099-09-27 00:00:00.000000
-2099-09-28 00:00:00.000000
-2099-09-29 00:00:00.000000
-2099-09-30 00:00:00.000000
-2099-10-01 00:00:00.000000
-2099-10-02 00:00:00.000000
-2099-10-03 00:00:00.000000
-2099-10-04 00:00:00.000000
-2099-10-05 00:00:00.000000
-2099-10-06 00:00:00.000000
-2099-10-07 00:00:00.000000
-2099-10-08 00:00:00.000000
-2099-10-09 00:00:00.000000
-2099-10-10 00:00:00.000000
-2099-10-11 00:00:00.000000
-2099-10-12 00:00:00.000000
-2099-10-13 00:00:00.000000
-2099-10-14 00:00:00.000000
-2099-10-15 00:00:00.000000
-2099-10-16 00:00:00.000000
-2099-10-17 00:00:00.000000
-2099-10-18 00:00:00.000000
-2099-10-19 00:00:00.000000
-2099-10-20 00:00:00.000000
-2099-10-21 00:00:00.000000
-2099-10-22 00:00:00.000000
-2099-10-23 00:00:00.000000
-2099-10-24 00:00:00.000000
-2099-10-25 00:00:00.000000
-2099-10-26 00:00:00.000000
-2099-10-27 00:00:00.000000
-2099-10-28 00:00:00.000000
-2099-10-29 00:00:00.000000
-2099-10-30 00:00:00.000000
-2099-10-31 00:00:00.000000
-2099-11-01 00:00:00.000000
-2099-11-02 00:00:00.000000
-2099-11-03 00:00:00.000000
-2099-11-04 00:00:00.000000
-2099-11-05 00:00:00.000000
-2099-11-06 00:00:00.000000
-2099-11-07 00:00:00.000000
-2099-11-08 00:00:00.000000
-2099-11-09 00:00:00.000000
-2099-11-10 00:00:00.000000
-2099-11-11 00:00:00.000000
-2099-11-12 00:00:00.000000
-2099-11-13 00:00:00.000000
-2099-11-14 00:00:00.000000
-2099-11-15 00:00:00.000000
-2099-11-16 00:00:00.000000
-2099-11-17 00:00:00.000000
-2099-11-18 00:00:00.000000
-2099-11-19 00:00:00.000000
-2099-11-20 00:00:00.000000
-2099-11-21 00:00:00.000000
-2099-11-22 00:00:00.000000
-2099-11-23 00:00:00.000000
-2099-11-24 00:00:00.000000
-2099-11-25 00:00:00.000000
-2099-11-26 00:00:00.000000
-2099-11-27 00:00:00.000000
-2099-11-28 00:00:00.000000
-2099-11-29 00:00:00.000000
-2099-11-30 00:00:00.000000
-2099-12-01 00:00:00.000000
-2099-12-02 00:00:00.000000
-2099-12-03 00:00:00.000000
-2099-12-04 00:00:00.000000
-2099-12-05 00:00:00.000000
-2099-12-06 00:00:00.000000
-2099-12-07 00:00:00.000000
-2099-12-08 00:00:00.000000
-2099-12-09 00:00:00.000000
-2099-12-10 00:00:00.000000
-2099-12-11 00:00:00.000000
-2099-12-12 00:00:00.000000
-2099-12-13 00:00:00.000000
-2099-12-14 00:00:00.000000
-2099-12-15 00:00:00.000000
-2099-12-16 00:00:00.000000
-2099-12-17 00:00:00.000000
-2099-12-18 00:00:00.000000
-2099-12-19 00:00:00.000000
-2099-12-20 00:00:00.000000
-2099-12-21 00:00:00.000000
-2099-12-22 00:00:00.000000
-2099-12-23 00:00:00.000000
-2099-12-24 00:00:00.000000
-2099-12-25 00:00:00.000000
-2099-12-26 00:00:00.000000
-2099-12-27 00:00:00.000000
-2099-12-28 00:00:00.000000
-2099-12-29 00:00:00.000000
-2099-12-30 00:00:00.000000
-2099-12-31 00:00:00.000000
-2100-01-01 00:00:00.000000
+2099-01-02 00:00:00.000000000
+2099-01-03 00:00:00.000000000
+2099-01-04 00:00:00.000000000
+2099-01-05 00:00:00.000000000
+2099-01-06 00:00:00.000000000
+2099-01-07 00:00:00.000000000
+2099-01-08 00:00:00.000000000
+2099-01-09 00:00:00.000000000
+2099-01-10 00:00:00.000000000
+2099-01-11 00:00:00.000000000
+2099-01-12 00:00:00.000000000
+2099-01-13 00:00:00.000000000
+2099-01-14 00:00:00.000000000
+2099-01-15 00:00:00.000000000
+2099-01-16 00:00:00.000000000
+2099-01-17 00:00:00.000000000
+2099-01-18 00:00:00.000000000
+2099-01-19 00:00:00.000000000
+2099-01-20 00:00:00.000000000
+2099-01-21 00:00:00.000000000
+2099-01-22 00:00:00.000000000
+2099-01-23 00:00:00.000000000
+2099-01-24 00:00:00.000000000
+2099-01-25 00:00:00.000000000
+2099-01-26 00:00:00.000000000
+2099-01-27 00:00:00.000000000
+2099-01-28 00:00:00.000000000
+2099-01-29 00:00:00.000000000
+2099-01-30 00:00:00.000000000
+2099-01-31 00:00:00.000000000
+2099-02-01 00:00:00.000000000
+2099-02-02 00:00:00.000000000
+2099-02-03 00:00:00.000000000
+2099-02-04 00:00:00.000000000
+2099-02-05 00:00:00.000000000
+2099-02-06 00:00:00.000000000
+2099-02-07 00:00:00.000000000
+2099-02-08 00:00:00.000000000
+2099-02-09 00:00:00.000000000
+2099-02-10 00:00:00.000000000
+2099-02-11 00:00:00.000000000
+2099-02-12 00:00:00.000000000
+2099-02-13 00:00:00.000000000
+2099-02-14 00:00:00.000000000
+2099-02-15 00:00:00.000000000
+2099-02-16 00:00:00.000000000
+2099-02-17 00:00:00.000000000
+2099-02-18 00:00:00.000000000
+2099-02-19 00:00:00.000000000
+2099-02-20 00:00:00.000000000
+2099-02-21 00:00:00.000000000
+2099-02-22 00:00:00.000000000
+2099-02-23 00:00:00.000000000
+2099-02-24 00:00:00.000000000
+2099-02-25 00:00:00.000000000
+2099-02-26 00:00:00.000000000
+2099-02-27 00:00:00.000000000
+2099-02-28 00:00:00.000000000
+2099-03-01 00:00:00.000000000
+2099-03-02 00:00:00.000000000
+2099-03-03 00:00:00.000000000
+2099-03-04 00:00:00.000000000
+2099-03-05 00:00:00.000000000
+2099-03-06 00:00:00.000000000
+2099-03-07 00:00:00.000000000
+2099-03-08 00:00:00.000000000
+2099-03-09 00:00:00.000000000
+2099-03-10 00:00:00.000000000
+2099-03-11 00:00:00.000000000
+2099-03-12 00:00:00.000000000
+2099-03-13 00:00:00.000000000
+2099-03-14 00:00:00.000000000
+2099-03-15 00:00:00.000000000
+2099-03-16 00:00:00.000000000
+2099-03-17 00:00:00.000000000
+2099-03-18 00:00:00.000000000
+2099-03-19 00:00:00.000000000
+2099-03-20 00:00:00.000000000
+2099-03-21 00:00:00.000000000
+2099-03-22 00:00:00.000000000
+2099-03-23 00:00:00.000000000
+2099-03-24 00:00:00.000000000
+2099-03-25 00:00:00.000000000
+2099-03-26 00:00:00.000000000
+2099-03-27 00:00:00.000000000
+2099-03-28 00:00:00.000000000
+2099-03-29 00:00:00.000000000
+2099-03-30 00:00:00.000000000
+2099-03-31 00:00:00.000000000
+2099-04-01 00:00:00.000000000
+2099-04-02 00:00:00.000000000
+2099-04-03 00:00:00.000000000
+2099-04-04 00:00:00.000000000
+2099-04-05 00:00:00.000000000
+2099-04-06 00:00:00.000000000
+2099-04-07 00:00:00.000000000
+2099-04-08 00:00:00.000000000
+2099-04-09 00:00:00.000000000
+2099-04-10 00:00:00.000000000
+2099-04-11 00:00:00.000000000
+2099-04-12 00:00:00.000000000
+2099-04-13 00:00:00.000000000
+2099-04-14 00:00:00.000000000
+2099-04-15 00:00:00.000000000
+2099-04-16 00:00:00.000000000
+2099-04-17 00:00:00.000000000
+2099-04-18 00:00:00.000000000
+2099-04-19 00:00:00.000000000
+2099-04-20 00:00:00.000000000
+2099-04-21 00:00:00.000000000
+2099-04-22 00:00:00.000000000
+2099-04-23 00:00:00.000000000
+2099-04-24 00:00:00.000000000
+2099-04-25 00:00:00.000000000
+2099-04-26 00:00:00.000000000
+2099-04-27 00:00:00.000000000
+2099-04-28 00:00:00.000000000
+2099-04-29 00:00:00.000000000
+2099-04-30 00:00:00.000000000
+2099-05-01 00:00:00.000000000
+2099-05-02 00:00:00.000000000
+2099-05-03 00:00:00.000000000
+2099-05-04 00:00:00.000000000
+2099-05-05 00:00:00.000000000
+2099-05-06 00:00:00.000000000
+2099-05-07 00:00:00.000000000
+2099-05-08 00:00:00.000000000
+2099-05-09 00:00:00.000000000
+2099-05-10 00:00:00.000000000
+2099-05-11 00:00:00.000000000
+2099-05-12 00:00:00.000000000
+2099-05-13 00:00:00.000000000
+2099-05-14 00:00:00.000000000
+2099-05-15 00:00:00.000000000
+2099-05-16 00:00:00.000000000
+2099-05-17 00:00:00.000000000
+2099-05-18 00:00:00.000000000
+2099-05-19 00:00:00.000000000
+2099-05-20 00:00:00.000000000
+2099-05-21 00:00:00.000000000
+2099-05-22 00:00:00.000000000
+2099-05-23 00:00:00.000000000
+2099-05-24 00:00:00.000000000
+2099-05-25 00:00:00.000000000
+2099-05-26 00:00:00.000000000
+2099-05-27 00:00:00.000000000
+2099-05-28 00:00:00.000000000
+2099-05-29 00:00:00.000000000
+2099-05-30 00:00:00.000000000
+2099-05-31 00:00:00.000000000
+2099-06-01 00:00:00.000000000
+2099-06-02 00:00:00.000000000
+2099-06-03 00:00:00.000000000
+2099-06-04 00:00:00.000000000
+2099-06-05 00:00:00.000000000
+2099-06-06 00:00:00.000000000
+2099-06-07 00:00:00.000000000
+2099-06-08 00:00:00.000000000
+2099-06-09 00:00:00.000000000
+2099-06-10 00:00:00.000000000
+2099-06-11 00:00:00.000000000
+2099-06-12 00:00:00.000000000
+2099-06-13 00:00:00.000000000
+2099-06-14 00:00:00.000000000
+2099-06-15 00:00:00.000000000
+2099-06-16 00:00:00.000000000
+2099-06-17 00:00:00.000000000
+2099-06-18 00:00:00.000000000
+2099-06-19 00:00:00.000000000
+2099-06-20 00:00:00.000000000
+2099-06-21 00:00:00.000000000
+2099-06-22 00:00:00.000000000
+2099-06-23 00:00:00.000000000
+2099-06-24 00:00:00.000000000
+2099-06-25 00:00:00.000000000
+2099-06-26 00:00:00.000000000
+2099-06-27 00:00:00.000000000
+2099-06-28 00:00:00.000000000
+2099-06-29 00:00:00.000000000
+2099-06-30 00:00:00.000000000
+2099-07-01 00:00:00.000000000
+2099-07-02 00:00:00.000000000
+2099-07-03 00:00:00.000000000
+2099-07-04 00:00:00.000000000
+2099-07-05 00:00:00.000000000
+2099-07-06 00:00:00.000000000
+2099-07-07 00:00:00.000000000
+2099-07-08 00:00:00.000000000
+2099-07-09 00:00:00.000000000
+2099-07-10 00:00:00.000000000
+2099-07-11 00:00:00.000000000
+2099-07-12 00:00:00.000000000
+2099-07-13 00:00:00.000000000
+2099-07-14 00:00:00.000000000
+2099-07-15 00:00:00.000000000
+2099-07-16 00:00:00.000000000
+2099-07-17 00:00:00.000000000
+2099-07-18 00:00:00.000000000
+2099-07-19 00:00:00.000000000
+2099-07-20 00:00:00.000000000
+2099-07-21 00:00:00.000000000
+2099-07-22 00:00:00.000000000
+2099-07-23 00:00:00.000000000
+2099-07-24 00:00:00.000000000
+2099-07-25 00:00:00.000000000
+2099-07-26 00:00:00.000000000
+2099-07-27 00:00:00.000000000
+2099-07-28 00:00:00.000000000
+2099-07-29 00:00:00.000000000
+2099-07-30 00:00:00.000000000
+2099-07-31 00:00:00.000000000
+2099-08-01 00:00:00.000000000
+2099-08-02 00:00:00.000000000
+2099-08-03 00:00:00.000000000
+2099-08-04 00:00:00.000000000
+2099-08-05 00:00:00.000000000
+2099-08-06 00:00:00.000000000
+2099-08-07 00:00:00.000000000
+2099-08-08 00:00:00.000000000
+2099-08-09 00:00:00.000000000
+2099-08-10 00:00:00.000000000
+2099-08-11 00:00:00.000000000
+2099-08-12 00:00:00.000000000
+2099-08-13 00:00:00.000000000
+2099-08-14 00:00:00.000000000
+2099-08-15 00:00:00.000000000
+2099-08-16 00:00:00.000000000
+2099-08-17 00:00:00.000000000
+2099-08-18 00:00:00.000000000
+2099-08-19 00:00:00.000000000
+2099-08-20 00:00:00.000000000
+2099-08-21 00:00:00.000000000
+2099-08-22 00:00:00.000000000
+2099-08-23 00:00:00.000000000
+2099-08-24 00:00:00.000000000
+2099-08-25 00:00:00.000000000
+2099-08-26 00:00:00.000000000
+2099-08-27 00:00:00.000000000
+2099-08-28 00:00:00.000000000
+2099-08-29 00:00:00.000000000
+2099-08-30 00:00:00.000000000
+2099-08-31 00:00:00.000000000
+2099-09-01 00:00:00.000000000
+2099-09-02 00:00:00.000000000
+2099-09-03 00:00:00.000000000
+2099-09-04 00:00:00.000000000
+2099-09-05 00:00:00.000000000
+2099-09-06 00:00:00.000000000
+2099-09-07 00:00:00.000000000
+2099-09-08 00:00:00.000000000
+2099-09-09 00:00:00.000000000
+2099-09-10 00:00:00.000000000
+2099-09-11 00:00:00.000000000
+2099-09-12 00:00:00.000000000
+2099-09-13 00:00:00.000000000
+2099-09-14 00:00:00.000000000
+2099-09-15 00:00:00.000000000
+2099-09-16 00:00:00.000000000
+2099-09-17 00:00:00.000000000
+2099-09-18 00:00:00.000000000
+2099-09-19 00:00:00.000000000
+2099-09-20 00:00:00.000000000
+2099-09-21 00:00:00.000000000
+2099-09-22 00:00:00.000000000
+2099-09-23 00:00:00.000000000
+2099-09-24 00:00:00.000000000
+2099-09-25 00:00:00.000000000
+2099-09-26 00:00:00.000000000
+2099-09-27 00:00:00.000000000
+2099-09-28 00:00:00.000000000
+2099-09-29 00:00:00.000000000
+2099-09-30 00:00:00.000000000
+2099-10-01 00:00:00.000000000
+2099-10-02 00:00:00.000000000
+2099-10-03 00:00:00.000000000
+2099-10-04 00:00:00.000000000
+2099-10-05 00:00:00.000000000
+2099-10-06 00:00:00.000000000
+2099-10-07 00:00:00.000000000
+2099-10-08 00:00:00.000000000
+2099-10-09 00:00:00.000000000
+2099-10-10 00:00:00.000000000
+2099-10-11 00:00:00.000000000
+2099-10-12 00:00:00.000000000
+2099-10-13 00:00:00.000000000
+2099-10-14 00:00:00.000000000
+2099-10-15 00:00:00.000000000
+2099-10-16 00:00:00.000000000
+2099-10-17 00:00:00.000000000
+2099-10-18 00:00:00.000000000
+2099-10-19 00:00:00.000000000
+2099-10-20 00:00:00.000000000
+2099-10-21 00:00:00.000000000
+2099-10-22 00:00:00.000000000
+2099-10-23 00:00:00.000000000
+2099-10-24 00:00:00.000000000
+2099-10-25 00:00:00.000000000
+2099-10-26 00:00:00.000000000
+2099-10-27 00:00:00.000000000
+2099-10-28 00:00:00.000000000
+2099-10-29 00:00:00.000000000
+2099-10-30 00:00:00.000000000
+2099-10-31 00:00:00.000000000
+2099-11-01 00:00:00.000000000
+2099-11-02 00:00:00.000000000
+2099-11-03 00:00:00.000000000
+2099-11-04 00:00:00.000000000
+2099-11-05 00:00:00.000000000
+2099-11-06 00:00:00.000000000
+2099-11-07 00:00:00.000000000
+2099-11-08 00:00:00.000000000
+2099-11-09 00:00:00.000000000
+2099-11-10 00:00:00.000000000
+2099-11-11 00:00:00.000000000
+2099-11-12 00:00:00.000000000
+2099-11-13 00:00:00.000000000
+2099-11-14 00:00:00.000000000
+2099-11-15 00:00:00.000000000
+2099-11-16 00:00:00.000000000
+2099-11-17 00:00:00.000000000
+2099-11-18 00:00:00.000000000
+2099-11-19 00:00:00.000000000
+2099-11-20 00:00:00.000000000
+2099-11-21 00:00:00.000000000
+2099-11-22 00:00:00.000000000
+2099-11-23 00:00:00.000000000
+2099-11-24 00:00:00.000000000
+2099-11-25 00:00:00.000000000
+2099-11-26 00:00:00.000000000
+2099-11-27 00:00:00.000000000
+2099-11-28 00:00:00.000000000
+2099-11-29 00:00:00.000000000
+2099-11-30 00:00:00.000000000
+2099-12-01 00:00:00.000000000
+2099-12-02 00:00:00.000000000
+2099-12-03 00:00:00.000000000
+2099-12-04 00:00:00.000000000
+2099-12-05 00:00:00.000000000
+2099-12-06 00:00:00.000000000
+2099-12-07 00:00:00.000000000
+2099-12-08 00:00:00.000000000
+2099-12-09 00:00:00.000000000
+2099-12-10 00:00:00.000000000
+2099-12-11 00:00:00.000000000
+2099-12-12 00:00:00.000000000
+2099-12-13 00:00:00.000000000
+2099-12-14 00:00:00.000000000
+2099-12-15 00:00:00.000000000
+2099-12-16 00:00:00.000000000
+2099-12-17 00:00:00.000000000
+2099-12-18 00:00:00.000000000
+2099-12-19 00:00:00.000000000
+2099-12-20 00:00:00.000000000
+2099-12-21 00:00:00.000000000
+2099-12-22 00:00:00.000000000
+2099-12-23 00:00:00.000000000
+2099-12-24 00:00:00.000000000
+2099-12-25 00:00:00.000000000
+2099-12-26 00:00:00.000000000
+2099-12-27 00:00:00.000000000
+2099-12-28 00:00:00.000000000
+2099-12-29 00:00:00.000000000
+2099-12-30 00:00:00.000000000
+2099-12-31 00:00:00.000000000
+2100-01-01 00:00:00.000000000
 
 --- 365 row(s) selected.
 >>
diff --git a/core/sql/regress/core/EXPECTEDRTS b/core/sql/regress/core/EXPECTEDRTS
index 95af9ad..fe867e0 100644
--- a/core/sql/regress/core/EXPECTEDRTS
+++ b/core/sql/regress/core/EXPECTEDRTS
@@ -3546,6 +3546,7 @@
 SSCP Reply Message Bytes      139,848
 RMS Stats Reset Timestamp     2017/11/23 16:54:16.511971
 No. Query Invalidation Keys   121
+Configured Pid Max            32768
 
 
 --- SQL operation complete.
diff --git a/core/sql/regress/core/FILTERRTS b/core/sql/regress/core/FILTERRTS
index c7f92bc..3832ed8 100755
--- a/core/sql/regress/core/FILTERRTS
+++ b/core/sql/regress/core/FILTERRTS
@@ -81,6 +81,7 @@
 s/SSCP Reply Message Count[ ]*[0-9,]*/SSCP Reply Message Count @sscpReplytMessageCount@/
 s/SSCP Reply Message Bytes[ ]*[0-9,]*/SSCP Reply Message Bytes @sscpReplyMessageBytes@/
 s/Query Invalidation Keys[ ]*[0-9]*/Query Invalidation Keys/
+s/Configured Pid Max[ ]*[0-9]*/Configured Pid Max @configuredPidMax@/
 s/IPC Memory Allocated[ 0-9]*/IPC Memory Allocated @exeMemory@/
 s/EXE Memory Allocated[ 0-9]*/EXE Memory Allocated @ipcMemory@/
 s/IPC Memory Used High WM[ 0-9]*/IPC Memory Used High WM @exeMemory@/
diff --git a/core/sql/regress/core/TEST002 b/core/sql/regress/core/TEST002
index a9db00c..19bdede 100755
--- a/core/sql/regress/core/TEST002
+++ b/core/sql/regress/core/TEST002
@@ -590,6 +590,31 @@
 
 -- Should return 7
 select x from (select [first 1] x from t002sol order by x desc );
+
+-- Tests of limit n in subqueries
+
+-- Should return 1
+select 
+(select y aa from t002sub b where b.x = a.b limit 1) as result_value
+from t002main a;
+
+-- Should get a cardinality violation (error 8401)
+select 
+(select y aa from t002sub b where b.y = a.b limit 2) as result_value
+from t002main a;
+
+-- Should return 1
+select 
+(select y aa from t002sub b where b.y = a.b limit 1) as result_value
+from t002main a;
+
+-- Should return 2
+select
+(select count(*) from t002sub limit 20) as result_value
+from t002main;
+
+-- Should return 7
+select x from (select x from t002sol order by x desc limit 1);
 log;
 obey TEST002(clnup);
 exit;
diff --git a/core/sql/regress/core/TEST037 b/core/sql/regress/core/TEST037
index 370554c..c7c51c5 100755
--- a/core/sql/regress/core/TEST037
+++ b/core/sql/regress/core/TEST037
@@ -80,7 +80,6 @@
 , CONSTRAINT_SCHEMA int not null 
 , CONTROL int not null 
 , CURSOR_NAME int not null 
-, CRC32 int not null
 , DATA int not null 
 --,DATETIME int not null 
 , DATETIME_CODE int not null 
@@ -127,7 +126,6 @@
 , LOW_VALUE int not null 
 , MAXSIZE int not null 
 , MBYTES int not null 
-, MD5 int not null
 , MESSAGE_LEN int not null 
 , MESSAGE_OCTET_LEN int not null 
 , MESSAGE_TEXT int not null 
@@ -160,9 +158,6 @@
 , SERIALIZABLE int not null 
 , SERIALWRITES int not null 
 , SERVER_NAME int not null 
-, SHA int not null
-, SHA1 int not null
-, SHA2 int not null
 , SHAPE int not null 
 , SHARE int not null 
 , SIDEINSERTS int not null 
@@ -1306,9 +1301,6 @@
 prepare s1 from SELECT COST COST from (values(0)) COST(COST);
 
 -- Expect success
-prepare s1 from SELECT CRC32 CRC32 from (values(0)) CRC32(CRC32);
-
--- Expect success
 prepare s1 from SELECT CURDATE CURDATE from (values(0)) CURDATE(CURDATE);
 
 -- Expect success
@@ -1567,9 +1559,6 @@
 prepare s1 from SELECT M M from (values(0)) M(M);
 
 -- Expect success
-prepare s1 from SELECT MD5 MD5 from (values(0)) MD5(MD5);
-
--- Expect success
 prepare s1 from SELECT MAXSIZE MAXSIZE from (values(0)) MAXSIZE(MAXSIZE);
 
 -- Expect success
@@ -1810,15 +1799,6 @@
 prepare s1 from SELECT SERVER_NAME SERVER_NAME from (values(0)) SERVER_NAME(SERVER_NAME);
 
 -- Expect success
-prepare s1 from SELECT SHA SHA from (values(0)) SHA(SHA);
-
--- Expect success
-prepare s1 from SELECT SHA1 SHA1 from (values(0)) SHA1(SHA1);
-
--- Expect success
-prepare s1 from SELECT SHA2 SHA2 from (values(0)) SHA2(SHA2);
-
--- Expect success
 prepare s1 from SELECT SHAPE SHAPE from (values(0)) SHAPE(SHAPE);
 
 -- Expect success
diff --git a/core/sql/regress/core/TEST038 b/core/sql/regress/core/TEST038
index ea540af..593822e 100755
--- a/core/sql/regress/core/TEST038
+++ b/core/sql/regress/core/TEST038
@@ -1139,6 +1139,27 @@
 select RPAD (b, 12, '5'), LPAD (c, 13) from T038sf where RPAD( RPAD(b, 13, 'X'), 10, 'W') = b;
 -- 4 rows
 
+-- test SPLIT_PART function
+
+select split_part('sa:sbl:sc', ':', 1) from t038sf;
+select split_part('sa:sbl:sc', ':', 2) from t038sf;
+select split_part('sa:sbl:sc', ':', 3) from t038sf;
+
+-- **EMPTY RESULT** 
+select split_part('sa:sbl:sc', ':', 0) from t038sf;
+select split_part('sa:sbl:sc', ':', 4) from t038sf;
+
+insert into T038sf values(110, 'a/b/c', 'sa/dsd/s');
+insert into T038sf values(111, 'sasd', 'dsa:/~sd');
+insert into T038sf values(112, '#$%$#@', 'dsasggggsad');
+insert into T038sf values(114, 'a', '这是^中文:测试');
+
+select split_part(c, '/', 2) from t038sf;
+select split_part(c, 'ggg', 2) from t038sf;
+select split_part(c, 'sd', 1) from t038sf;
+select split_part(c, ':', 1) from t038sf;
+
+
 -- Test for Genesis soln: 10-071004-7982
 -- Previously this would run out of memory in the Generator.
 -- Now it compiles successfully with Query Cache off.
@@ -1260,7 +1281,7 @@
 drop table T038a;
 drop table T038b;
 drop table T038c;
-drop table T038d;
+drop table T038d cascade;
 drop table T038e;
 drop table T038f;
 drop table T038g;
diff --git a/core/sql/regress/executor/EXPECTED022.SB b/core/sql/regress/executor/EXPECTED022.SB
index b3b566e..b1ad245 100644
--- a/core/sql/regress/executor/EXPECTED022.SB
+++ b/core/sql/regress/executor/EXPECTED022.SB
@@ -1,11 +1,5 @@
 >>obey TEST022 (test);
 >>-------------------------------------------------------------------------------
->>create table t022t1 (a int);
-
---- SQL operation complete.
->>create table t022t2 (a int);
-
---- SQL operation complete.
 >>create table t022t3 (a int unsigned);
 
 --- SQL operation complete.
@@ -13,12 +7,6 @@
 
 --- SQL operation complete.
 >>
->>insert into t022t1 values (1);
-
---- 1 row(s) inserted.
->>insert into t022t2 values (1), (2);
-
---- 2 row(s) inserted.
 >>insert into t022t3 values (4294967295), (3000000000);
 
 --- 2 row(s) inserted.
@@ -26,18 +14,10 @@
 
 --- 1 row(s) inserted.
 >>
->>?ifMX
->>create table t022u (a int);
-
---- SQL operation complete.
->>insert into t022u values (1), (2);
-
---- 2 row(s) inserted.
 >>create table t022a7 (c1 float(22), c2 float not null);
 
 --- SQL operation complete.
->>?ifNT
->>-- The ifNT setting is also enabled when run on Linux platforms.
+>>
 >>prepare insertIntoT022A7 from insert into t022a7 values (?,?);
 
 --- SQL command prepared.
@@ -50,17 +30,10 @@
 >>sh sh -c 'echo "execute insertIntoT022A7 using 1 , 2.E3 ; "      >> t022xxx ';
 >>sh sh -c 'echo "execute insertIntoT022A7 using 3 , 123.456E2 ; " >> t022xxx ';
 >>sh sh -c 'echo "commit work;"                                    >> t022xxx ';
->>?ifNT
->>?ifNSK
->>sh echo 0 , 1.   > t022xxx;
->>sh echo 1 , 2.E3  >> t022xxx;
->>sh echo 3 , 123.456E2 >> t022xxx;
->>?ifNSK
->>?ifMX
 >>
 >>-- Positive cases to test the limits of each data type.
 >>
->>select cast (-9 as numeric(1)) from t022t1;
+>>select cast (-9 as numeric(1)) from dual;
 
 (EXPR)
 ------
@@ -68,7 +41,7 @@
     -9
 
 --- 1 row(s) selected.
->>select cast (9 as numeric(1)) from t022t1;
+>>select cast (9 as numeric(1)) from dual;
 
 (EXPR)
 ------
@@ -76,7 +49,7 @@
      9
 
 --- 1 row(s) selected.
->>select cast (-9999 as numeric(4)) from t022t1;
+>>select cast (-9999 as numeric(4)) from dual;
 
 (EXPR)
 ------
@@ -84,7 +57,7 @@
  -9999
 
 --- 1 row(s) selected.
->>select cast (9999 as numeric(4)) from t022t1;
+>>select cast (9999 as numeric(4)) from dual;
 
 (EXPR)
 ------
@@ -92,7 +65,7 @@
   9999
 
 --- 1 row(s) selected.
->>select cast (-32768 as smallint) from t022t1;
+>>select cast (-32768 as smallint) from dual;
 
 (EXPR)
 ------
@@ -100,7 +73,7 @@
 -32768
 
 --- 1 row(s) selected.
->>select cast (32767 as smallint) from t022t1;
+>>select cast (32767 as smallint) from dual;
 
 (EXPR)
 ------
@@ -109,7 +82,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (0 as numeric(1) unsigned) from t022t1;
+>>select cast (0 as numeric(1) unsigned) from dual;
 
 (EXPR)
 ------
@@ -117,7 +90,7 @@
      0
 
 --- 1 row(s) selected.
->>select cast (9 as numeric(1) unsigned) from t022t1;
+>>select cast (9 as numeric(1) unsigned) from dual;
 
 (EXPR)
 ------
@@ -125,7 +98,7 @@
      9
 
 --- 1 row(s) selected.
->>select cast (0 as numeric(4) unsigned) from t022t1;
+>>select cast (0 as numeric(4) unsigned) from dual;
 
 (EXPR)
 ------
@@ -133,7 +106,7 @@
      0
 
 --- 1 row(s) selected.
->>select cast (9999 as numeric(4) unsigned) from t022t1;
+>>select cast (9999 as numeric(4) unsigned) from dual;
 
 (EXPR)
 ------
@@ -141,7 +114,7 @@
   9999
 
 --- 1 row(s) selected.
->>select cast (0 as smallint unsigned) from t022t1;
+>>select cast (0 as smallint unsigned) from dual;
 
 (EXPR)
 ------
@@ -149,7 +122,7 @@
      0
 
 --- 1 row(s) selected.
->>select cast (65535 as smallint unsigned) from t022t1;
+>>select cast (65535 as smallint unsigned) from dual;
 
 (EXPR)
 ------
@@ -158,7 +131,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (-99999 as numeric(5)) from t022t1;
+>>select cast (-99999 as numeric(5)) from dual;
 
 (EXPR)     
 -----------
@@ -166,7 +139,7 @@
      -99999
 
 --- 1 row(s) selected.
->>select cast (99999 as numeric(5)) from t022t1;
+>>select cast (99999 as numeric(5)) from dual;
 
 (EXPR)     
 -----------
@@ -174,7 +147,7 @@
       99999
 
 --- 1 row(s) selected.
->>select cast (-999999999 as numeric(9)) from t022t1;
+>>select cast (-999999999 as numeric(9)) from dual;
 
 (EXPR)     
 -----------
@@ -182,7 +155,7 @@
  -999999999
 
 --- 1 row(s) selected.
->>select cast (999999999 as numeric(9)) from t022t1;
+>>select cast (999999999 as numeric(9)) from dual;
 
 (EXPR)     
 -----------
@@ -190,7 +163,7 @@
   999999999
 
 --- 1 row(s) selected.
->>select cast (-2147483648 as int) from t022t1;
+>>select cast (-2147483648 as int) from dual;
 
 (EXPR)     
 -----------
@@ -198,7 +171,7 @@
 -2147483648
 
 --- 1 row(s) selected.
->>select cast (2147483647 as int) from t022t1;
+>>select cast (2147483647 as int) from dual;
 
 (EXPR)     
 -----------
@@ -207,7 +180,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (0 as numeric(5) unsigned) from t022t1;
+>>select cast (0 as numeric(5) unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -215,7 +188,7 @@
          0
 
 --- 1 row(s) selected.
->>select cast (99999 as numeric(5) unsigned) from t022t1;
+>>select cast (99999 as numeric(5) unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -223,7 +196,7 @@
      99999
 
 --- 1 row(s) selected.
->>select cast (0 as numeric(9) unsigned) from t022t1;
+>>select cast (0 as numeric(9) unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -231,7 +204,7 @@
          0
 
 --- 1 row(s) selected.
->>select cast (999999999 as numeric(9) unsigned) from t022t1;
+>>select cast (999999999 as numeric(9) unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -239,7 +212,7 @@
  999999999
 
 --- 1 row(s) selected.
->>select cast (0 as int unsigned) from t022t1;
+>>select cast (0 as int unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -247,7 +220,7 @@
          0
 
 --- 1 row(s) selected.
->>select cast (4294967295 as int unsigned) from t022t1;
+>>select cast (4294967295 as int unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -256,7 +229,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (-9999999999 as numeric(10)) from t022t1;
+>>select cast (-9999999999 as numeric(10)) from dual;
 
 (EXPR)              
 --------------------
@@ -264,7 +237,7 @@
          -9999999999
 
 --- 1 row(s) selected.
->>select cast (9999999999 as numeric(10)) from t022t1;
+>>select cast (9999999999 as numeric(10)) from dual;
 
 (EXPR)              
 --------------------
@@ -272,7 +245,7 @@
           9999999999
 
 --- 1 row(s) selected.
->>select cast (-999999999999999999 as numeric(18)) from t022t1;
+>>select cast (-999999999999999999 as numeric(18)) from dual;
 
 (EXPR)              
 --------------------
@@ -280,7 +253,7 @@
  -999999999999999999
 
 --- 1 row(s) selected.
->>select cast (999999999999999999 as numeric(18)) from t022t1;
+>>select cast (999999999999999999 as numeric(18)) from dual;
 
 (EXPR)              
 --------------------
@@ -288,7 +261,7 @@
   999999999999999999
 
 --- 1 row(s) selected.
->>select cast (-9223372036854775808 as largeint) from t022t1;
+>>select cast (-9223372036854775808 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -296,7 +269,7 @@
 -9223372036854775808
 
 --- 1 row(s) selected.
->>select cast (9223372036854775807 as largeint) from t022t1;
+>>select cast (9223372036854775807 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -305,7 +278,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (-9 as decimal(1)) from t022t1;
+>>select cast (-9 as decimal(1)) from dual;
 
 (EXPR)
 ------
@@ -313,7 +286,7 @@
     -9
 
 --- 1 row(s) selected.
->>select cast (9 as decimal(1)) from t022t1;
+>>select cast (9 as decimal(1)) from dual;
 
 (EXPR)
 ------
@@ -321,7 +294,7 @@
      9
 
 --- 1 row(s) selected.
->>select cast (-999999999999999999 as decimal(18)) from t022t1;
+>>select cast (-999999999999999999 as decimal(18)) from dual;
 
 (EXPR)             
 -------------------
@@ -329,7 +302,7 @@
 -999999999999999999
 
 --- 1 row(s) selected.
->>select cast (999999999999999999 as decimal(18)) from t022t1;
+>>select cast (999999999999999999 as decimal(18)) from dual;
 
 (EXPR)             
 -------------------
@@ -338,7 +311,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (0 as decimal(1) unsigned) from t022t1;
+>>select cast (0 as decimal(1) unsigned) from dual;
 
 (EXPR)
 ------
@@ -346,7 +319,7 @@
      0
 
 --- 1 row(s) selected.
->>select cast (9 as decimal(1) unsigned) from t022t1;
+>>select cast (9 as decimal(1) unsigned) from dual;
 
 (EXPR)
 ------
@@ -354,7 +327,7 @@
      9
 
 --- 1 row(s) selected.
->>select cast (0 as decimal(9) unsigned) from t022t1;
+>>select cast (0 as decimal(9) unsigned) from dual;
 
 (EXPR)   
 ---------
@@ -362,7 +335,7 @@
         0
 
 --- 1 row(s) selected.
->>select cast (999999999 as decimal(9) unsigned) from t022t1;
+>>select cast (999999999 as decimal(9) unsigned) from dual;
 
 (EXPR)   
 ---------
@@ -371,7 +344,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (10 as tinyint) from t022t1;
+>>select cast (10 as tinyint) from dual;
 
 (EXPR)
 ------
@@ -379,7 +352,7 @@
     10
 
 --- 1 row(s) selected.
->>select cast (-10 as tinyint) from t022t1;
+>>select cast (-10 as tinyint) from dual;
 
 (EXPR)
 ------
@@ -387,7 +360,7 @@
    -10
 
 --- 1 row(s) selected.
->>select cast (127 as tinyint) from t022t1;
+>>select cast (127 as tinyint) from dual;
 
 (EXPR)
 ------
@@ -395,7 +368,7 @@
    127
 
 --- 1 row(s) selected.
->>select cast (-128 as tinyint) from t022t1;
+>>select cast (-128 as tinyint) from dual;
 
 (EXPR)
 ------
@@ -403,7 +376,7 @@
   -128
 
 --- 1 row(s) selected.
->>select cast (10 as tinyint unsigned) from t022t1;
+>>select cast (10 as tinyint unsigned) from dual;
 
 (EXPR)
 ------
@@ -411,7 +384,7 @@
     10
 
 --- 1 row(s) selected.
->>select cast (0 as tinyint unsigned) from t022t1;
+>>select cast (0 as tinyint unsigned) from dual;
 
 (EXPR)
 ------
@@ -419,7 +392,7 @@
      0
 
 --- 1 row(s) selected.
->>select cast (255 as tinyint unsigned) from t022t1;
+>>select cast (255 as tinyint unsigned) from dual;
 
 (EXPR)
 ------
@@ -428,7 +401,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (date'12/31/9999' as timestamp(3)) from t022t1;
+>>select cast (date'12/31/9999' as timestamp(3)) from dual;
 
 (EXPR)                 
 -----------------------
@@ -436,7 +409,7 @@
 9999-12-31 00:00:00.000
 
 --- 1 row(s) selected.
->>select cast (timestamp'12/31/9999 11:59:59.999999 pm' as date) from t022t1;
+>>select cast (timestamp'12/31/9999 11:59:59.999999 pm' as date) from dual;
 
 (EXPR)    
 ----------
@@ -444,7 +417,7 @@
 9999-12-31
 
 --- 1 row(s) selected.
->>select cast (timestamp'12/31/9999 11:59:59.999999 pm' as time(3)) from t022t1;
+>>select cast (timestamp'12/31/9999 11:59:59.999999 pm' as time(3)) from dual;
 
 (EXPR)      
 ------------
@@ -453,7 +426,7 @@
 
 --- 1 row(s) selected.
 >>
->>select interval'0.1'second + timestamp'12/31/9998 11:59:59.9 pm' from t022t1;
+>>select interval'0.1'second + timestamp'12/31/9998 11:59:59.9 pm' from dual;
 
 (EXPR)               
 ---------------------
@@ -461,7 +434,7 @@
 9999-01-01 00:00:00.0
 
 --- 1 row(s) selected.
->>select timestamp'12/31/9998 11:59:59.9 pm' + interval'0.1'second from t022t1;
+>>select timestamp'12/31/9998 11:59:59.9 pm' + interval'0.1'second from dual;
 
 (EXPR)               
 ---------------------
@@ -469,7 +442,7 @@
 9999-01-01 00:00:00.0
 
 --- 1 row(s) selected.
->>select timestamp'01/01/9999 00:00:00.0' + interval-'0.1'second from t022t1;
+>>select timestamp'01/01/9999 00:00:00.0' + interval-'0.1'second from dual;
 
 (EXPR)               
 ---------------------
@@ -477,7 +450,7 @@
 9998-12-31 23:59:59.9
 
 --- 1 row(s) selected.
->>select timestamp'01/01/9999 00:00:00.0' - interval'0.1'second from t022t1;
+>>select timestamp'01/01/9999 00:00:00.0' - interval'0.1'second from dual;
 
 (EXPR)               
 ---------------------
@@ -485,7 +458,7 @@
 9998-12-31 23:59:59.9
 
 --- 1 row(s) selected.
->>select (date'12/31/9999' - date'12/31/9998') day(3) from t022t1;
+>>select (date'12/31/9999' - date'12/31/9998') day(3) from dual;
 
 (EXPR)
 ------
@@ -493,7 +466,7 @@
    365
 
 --- 1 row(s) selected.
->>select (date'12/31/9998' - date'12/31/9999') day(3) from t022t1;
+>>select (date'12/31/9998' - date'12/31/9999') day(3) from dual;
 
 (EXPR)
 ------
@@ -502,7 +475,7 @@
 
 --- 1 row(s) selected.
 >>
->>select interval'1'month + timestamp'12/31/9998 11:59:59.999 pm' from t022t1;
+>>select interval'1'month + timestamp'12/31/9998 11:59:59.999 pm' from dual;
 
 (EXPR)                 
 -----------------------
@@ -510,7 +483,7 @@
 9999-01-31 23:59:59.999
 
 --- 1 row(s) selected.
->>select timestamp'12/31/9998 11:59:59.999 pm' + interval'1'month from t022t1;
+>>select timestamp'12/31/9998 11:59:59.999 pm' + interval'1'month from dual;
 
 (EXPR)                 
 -----------------------
@@ -518,7 +491,7 @@
 9999-01-31 23:59:59.999
 
 --- 1 row(s) selected.
->>select timestamp'01/31/9999 11:59:59.999 pm' + interval-'1'month from t022t1;
+>>select timestamp'01/31/9999 11:59:59.999 pm' + interval-'1'month from dual;
 
 (EXPR)                 
 -----------------------
@@ -526,7 +499,7 @@
 9998-12-31 23:59:59.999
 
 --- 1 row(s) selected.
->>select timestamp'01/31/9999 11:59:59.999 pm' - interval'1'month from t022t1;
+>>select timestamp'01/31/9999 11:59:59.999 pm' - interval'1'month from dual;
 
 (EXPR)                 
 -----------------------
@@ -534,32 +507,32 @@
 9998-12-31 23:59:59.999
 
 --- 1 row(s) selected.
->>select (date'12/31/9999' - date'12/31/9998') month from t022t1;
+>>select (date'12/31/9999' - date'12/31/9998') month from dual;
 
-*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL MONTH(2).
+*** ERROR[4035] Type INTERVAL DAY(18) cannot be cast to type INTERVAL MONTH(2).
 
 *** ERROR[8822] The statement was not prepared.
 
->>select (date'12/31/9998' - date'12/31/9999') month from t022t1;
+>>select (date'12/31/9998' - date'12/31/9999') month from dual;
 
-*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL MONTH(2).
+*** ERROR[4035] Type INTERVAL DAY(18) cannot be cast to type INTERVAL MONTH(2).
 
 *** ERROR[8822] The statement was not prepared.
 
->>select (date'12/31/9999' - date'12/31/9998') year to month from t022t1;
+>>select (date'12/31/9999' - date'12/31/9998') year to month from dual;
 
-*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL YEAR(2) TO MONTH.
+*** ERROR[4035] Type INTERVAL DAY(18) cannot be cast to type INTERVAL YEAR(2) TO MONTH.
 
 *** ERROR[8822] The statement was not prepared.
 
->>select (date'12/31/9998' - date'12/31/9999') year to month from t022t1;
+>>select (date'12/31/9998' - date'12/31/9999') year to month from dual;
 
-*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL YEAR(2) TO MONTH.
+*** ERROR[4035] Type INTERVAL DAY(18) cannot be cast to type INTERVAL YEAR(2) TO MONTH.
 
 *** ERROR[8822] The statement was not prepared.
 
 >>
->>select interval'1'second + time'11:59:59 pm' from t022t1;
+>>select interval'1'second + time'11:59:59 pm' from dual;
 
 (EXPR)  
 --------
@@ -567,7 +540,7 @@
 00:00:00
 
 --- 1 row(s) selected.
->>select time'11:59:59 pm' + interval'1'second from t022t1;
+>>select time'11:59:59 pm' + interval'1'second from dual;
 
 (EXPR)  
 --------
@@ -575,7 +548,7 @@
 00:00:00
 
 --- 1 row(s) selected.
->>select time'12:00:00 am' + interval-'1'second from t022t1;
+>>select time'12:00:00 am' + interval-'1'second from dual;
 
 (EXPR)  
 --------
@@ -583,7 +556,7 @@
 23:59:59
 
 --- 1 row(s) selected.
->>select time'12:00:00 am' - interval'1'second from t022t1;
+>>select time'12:00:00 am' - interval'1'second from dual;
 
 (EXPR)  
 --------
@@ -592,7 +565,7 @@
 
 --- 1 row(s) selected.
 >>
->>select timestamp '2015-05-31T10:11:12' from t022t1;
+>>select timestamp '2015-05-31T10:11:12' from dual;
 
 (EXPR)             
 -------------------
@@ -600,7 +573,7 @@
 2015-05-31 10:11:12
 
 --- 1 row(s) selected.
->>select timestamp '2015-05-31T10:11:12Z' from t022t1;
+>>select timestamp '2015-05-31T10:11:12Z' from dual;
 
 (EXPR)             
 -------------------
@@ -608,7 +581,7 @@
 2015-05-31 10:11:12
 
 --- 1 row(s) selected.
->>select timestamp '2015-05-31T10:11:12-05:00' from t022t1;
+>>select timestamp '2015-05-31T10:11:12-05:00' from dual;
 
 (EXPR)             
 -------------------
@@ -616,7 +589,7 @@
 2015-05-31 15:11:12
 
 --- 1 row(s) selected.
->>select timestamp '2015-05-31T10:11:12+05:00' from t022t1;
+>>select timestamp '2015-05-31T10:11:12+05:00' from dual;
 
 (EXPR)             
 -------------------
@@ -624,7 +597,7 @@
 2015-05-31 05:11:12
 
 --- 1 row(s) selected.
->>select timestamp '2015-05-31T10:11:12.123-05:00' from t022t1;
+>>select timestamp '2015-05-31T10:11:12.123-05:00' from dual;
 
 (EXPR)                 
 -----------------------
@@ -632,7 +605,7 @@
 2015-05-31 15:11:12.123
 
 --- 1 row(s) selected.
->>select timestamp '2015-05-31T10:11:12.123+05:00' from t022t1;
+>>select timestamp '2015-05-31T10:11:12.123+05:00' from dual;
 
 (EXPR)                 
 -----------------------
@@ -641,7 +614,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast('2015-05-31T10:11:12' as timestamp) from t022t1;
+>>select cast('2015-05-31T10:11:12' as timestamp) from dual;
 
 (EXPR)                    
 --------------------------
@@ -649,7 +622,7 @@
 2015-05-31 10:11:12.000000
 
 --- 1 row(s) selected.
->>select cast('2015-05-31T10:11:12Z' as timestamp) from t022t1;
+>>select cast('2015-05-31T10:11:12Z' as timestamp) from dual;
 
 (EXPR)                    
 --------------------------
@@ -657,7 +630,7 @@
 2015-05-31 10:11:12.000000
 
 --- 1 row(s) selected.
->>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 dual;
 
 (EXPR)                    
 --------------------------
@@ -665,7 +638,7 @@
 2015-05-31 15:11:12.000000
 
 --- 1 row(s) selected.
->>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 dual;
 
 (EXPR)                    
 --------------------------
@@ -673,7 +646,7 @@
 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;
+>>select cast('2015-05-31T10:11:12.123-05:00' as timestamp) from dual;
 
 (EXPR)                    
 --------------------------
@@ -681,7 +654,7 @@
 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;
+>>select cast('2015-05-31T10:11:12.123+05:00' as timestamp) from dual;
 
 (EXPR)                    
 --------------------------
@@ -690,7 +663,7 @@
 
 --- 1 row(s) selected.
 >>
->>select time '10:11:12' from t022t1;
+>>select time '10:11:12' from dual;
 
 (EXPR)  
 --------
@@ -698,7 +671,7 @@
 10:11:12
 
 --- 1 row(s) selected.
->>select time '10:11:12Z' from t022t1;
+>>select time '10:11:12Z' from dual;
 
 (EXPR)  
 --------
@@ -706,7 +679,7 @@
 10:11:12
 
 --- 1 row(s) selected.
->>select time '10:11:12-05:00' from t022t1;
+>>select time '10:11:12-05:00' from dual;
 
 (EXPR)  
 --------
@@ -714,7 +687,7 @@
 15:11:12
 
 --- 1 row(s) selected.
->>select time '10:11:12+05:00' from t022t1;
+>>select time '10:11:12+05:00' from dual;
 
 (EXPR)  
 --------
@@ -722,7 +695,7 @@
 05:11:12
 
 --- 1 row(s) selected.
->>select time '10:11:12.123-05:00' from t022t1;
+>>select time '10:11:12.123-05:00' from dual;
 
 (EXPR)      
 ------------
@@ -730,7 +703,7 @@
 15:11:12.123
 
 --- 1 row(s) selected.
->>select time '10:11:12.123+05:00' from t022t1;
+>>select time '10:11:12.123+05:00' from dual;
 
 (EXPR)      
 ------------
@@ -739,7 +712,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast('10:11:12' as time) from t022t1;
+>>select cast('10:11:12' as time) from dual;
 
 (EXPR)  
 --------
@@ -747,7 +720,7 @@
 10:11:12
 
 --- 1 row(s) selected.
->>select cast('10:11:12Z' as time) from t022t1;
+>>select cast('10:11:12Z' as time) from dual;
 
 (EXPR)  
 --------
@@ -755,7 +728,7 @@
 10:11:12
 
 --- 1 row(s) selected.
->>select cast('10:11:12-05:00' as time) from t022t1;
+>>select cast('10:11:12-05:00' as time) from dual;
 
 (EXPR)  
 --------
@@ -763,7 +736,7 @@
 15:11:12
 
 --- 1 row(s) selected.
->>select cast('10:11:12+05:00' as time) from t022t1;
+>>select cast('10:11:12+05:00' as time) from dual;
 
 (EXPR)  
 --------
@@ -771,7 +744,7 @@
 05:11:12
 
 --- 1 row(s) selected.
->>select cast('10:11:12.123-05:00' as time) from t022t1;
+>>select cast('10:11:12.123-05:00' as time) from dual;
 
 (EXPR)  
 --------
@@ -779,7 +752,7 @@
 15:11:12
 
 --- 1 row(s) selected.
->>select cast('10:11:12.123+05:00' as time) from t022t1;
+>>select cast('10:11:12.123+05:00' as time) from dual;
 
 (EXPR)  
 --------
@@ -788,7 +761,7 @@
 
 --- 1 row(s) selected.
 >>
->>select time '23:11:06.123' from t022t1;
+>>select time '23:11:06.123' from dual;
 
 (EXPR)      
 ------------
@@ -796,7 +769,7 @@
 23:11:06.123
 
 --- 1 row(s) selected.
->>select cast ('23:11:06.123' as time(2)) from t022t1;
+>>select cast ('23:11:06.123' as time(2)) from dual;
 
 (EXPR)     
 -----------
@@ -805,7 +778,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast('2010-01-01' as timestamp(3)) from t022t1;
+>>select cast('2010-01-01' as timestamp(3)) from dual;
 
 (EXPR)                 
 -----------------------
@@ -813,7 +786,7 @@
 2010-01-01 00:00:00.000
 
 --- 1 row(s) selected.
->>select cast('2010-01-01 10' as timestamp) from t022t1;
+>>select cast('2010-01-01 10' as timestamp) from dual;
 
 (EXPR)                    
 --------------------------
@@ -841,61 +814,61 @@
 --- 1 row(s) selected.
 >>
 >>-- negative cases
->>select cast('2016-01-29Z' as date) from t022t1;
+>>select cast('2016-01-29Z' as date) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 2016-01-29Z
 
 --- 0 row(s) selected.
->>select cast('2016-01-29+05:00' as date) from t022t1;
+>>select cast('2016-01-29+05:00' as date) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 2016-01-29+05:00
 
 --- 0 row(s) selected.
->>select cast('10:11:12-05:000' as time) from t022t1;
+>>select cast('10:11:12-05:000' as time) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 10:11:12-05:000
 
 --- 0 row(s) selected.
->>select date '2016-01-29Z' from t022t1;
+>>select date '2016-01-29Z' from dual;
 
 *** 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;
+>>select date '2016-01-29+05:00' from dual;
 
 *** 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;
+>>select time '25:11:11' from dual;
 
 *** 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;
+>>select time '23:11:11.1234567890' from dual;
 
-*** ERROR[3046] The time '23:11:11.1234567' is not valid.
+*** ERROR[3046] The time '23:11:11.1234567890' is not valid.
 
 *** ERROR[8822] The statement was not prepared.
 
->>select cast ('23:11:61' as time) from t022t1;
+>>select cast ('23:11:61' as time) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 23:11:61
 
 --- 0 row(s) selected.
->>select cast ('23:11:06' as timestamp) from t022t1;
+>>select cast ('23:11:06' as timestamp) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 23:11:06
 
 --- 0 row(s) selected.
->>select cast('2010-01-01' as time) from t022t1;
+>>select cast('2010-01-01' as time) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 2010-01-01
 
 --- 0 row(s) selected.
->>select timestamp'2010-01-01 10' from t022t1;
+>>select timestamp'2010-01-01 10' from dual;
 
 *** ERROR[3047] The timestamp '2010-01-01 10' is not valid.
 
@@ -904,7 +877,7 @@
 >>
 >>-- Prove these cases work since they're used in the succeeding negative tests.
 >>
->>select cast (cast (-10 as smallint) as numeric(2)) from t022t1;
+>>select cast (cast (-10 as smallint) as numeric(2)) from dual;
 
 (EXPR)
 ------
@@ -912,7 +885,7 @@
    -10
 
 --- 1 row(s) selected.
->>select cast (cast (10 as smallint) as numeric(2)) from t022t1;
+>>select cast (cast (10 as smallint) as numeric(2)) from dual;
 
 (EXPR)
 ------
@@ -920,7 +893,7 @@
     10
 
 --- 1 row(s) selected.
->>select cast (cast (-10 as numeric(2)) as smallint) from t022t1;
+>>select cast (cast (-10 as numeric(2)) as smallint) from dual;
 
 (EXPR)
 ------
@@ -928,7 +901,7 @@
    -10
 
 --- 1 row(s) selected.
->>select cast (cast (10 as numeric(2)) as smallint) from t022t1;
+>>select cast (cast (10 as numeric(2)) as smallint) from dual;
 
 (EXPR)
 ------
@@ -936,7 +909,7 @@
     10
 
 --- 1 row(s) selected.
->>select cast (-1 as smallint) from t022t1;
+>>select cast (-1 as smallint) from dual;
 
 (EXPR)
 ------
@@ -945,7 +918,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (32768 as smallint unsigned) from t022t1;
+>>select cast (32768 as smallint unsigned) from dual;
 
 (EXPR)
 ------
@@ -953,7 +926,7 @@
  32768
 
 --- 1 row(s) selected.
->>select cast (10 as smallint unsigned) from t022t1;
+>>select cast (10 as smallint unsigned) from dual;
 
 (EXPR)
 ------
@@ -962,7 +935,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (-32769 as int) from t022t1;
+>>select cast (-32769 as int) from dual;
 
 (EXPR)     
 -----------
@@ -970,7 +943,7 @@
      -32769
 
 --- 1 row(s) selected.
->>select cast (32768 as int) from t022t1;
+>>select cast (32768 as int) from dual;
 
 (EXPR)     
 -----------
@@ -978,7 +951,7 @@
       32768
 
 --- 1 row(s) selected.
->>select cast (-10 as int) from t022t1;
+>>select cast (-10 as int) from dual;
 
 (EXPR)     
 -----------
@@ -986,7 +959,7 @@
         -10
 
 --- 1 row(s) selected.
->>select cast (10 as int) from t022t1;
+>>select cast (10 as int) from dual;
 
 (EXPR)     
 -----------
@@ -994,7 +967,7 @@
          10
 
 --- 1 row(s) selected.
->>select cast (-1 as int) from t022t1;
+>>select cast (-1 as int) from dual;
 
 (EXPR)     
 -----------
@@ -1002,7 +975,7 @@
          -1
 
 --- 1 row(s) selected.
->>select cast (65536 as int) from t022t1;
+>>select cast (65536 as int) from dual;
 
 (EXPR)     
 -----------
@@ -1010,7 +983,7 @@
       65536
 
 --- 1 row(s) selected.
->>select cast (-100000 as int) from t022t1;
+>>select cast (-100000 as int) from dual;
 
 (EXPR)     
 -----------
@@ -1018,7 +991,7 @@
     -100000
 
 --- 1 row(s) selected.
->>select cast (100000 as int) from t022t1;
+>>select cast (100000 as int) from dual;
 
 (EXPR)     
 -----------
@@ -1027,7 +1000,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (32768 as int unsigned) from t022t1;
+>>select cast (32768 as int unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -1035,7 +1008,7 @@
      32768
 
 --- 1 row(s) selected.
->>select cast (10 as int unsigned) from t022t1;
+>>select cast (10 as int unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -1043,7 +1016,7 @@
         10
 
 --- 1 row(s) selected.
->>select cast (65536 as int unsigned) from t022t1;
+>>select cast (65536 as int unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -1051,7 +1024,7 @@
      65536
 
 --- 1 row(s) selected.
->>select cast (2147483648 as int unsigned) from t022t1;
+>>select cast (2147483648 as int unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -1059,7 +1032,7 @@
 2147483648
 
 --- 1 row(s) selected.
->>select cast (100000 as int unsigned) from t022t1;
+>>select cast (100000 as int unsigned) from dual;
 
 (EXPR)    
 ----------
@@ -1068,7 +1041,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (-32769 as largeint) from t022t1;
+>>select cast (-32769 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1076,7 +1049,7 @@
               -32769
 
 --- 1 row(s) selected.
->>select cast (32768 as largeint) from t022t1;
+>>select cast (32768 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1084,7 +1057,7 @@
                32768
 
 --- 1 row(s) selected.
->>select cast (-10 as largeint) from t022t1;
+>>select cast (-10 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1092,7 +1065,7 @@
                  -10
 
 --- 1 row(s) selected.
->>select cast (10 as largeint) from t022t1;
+>>select cast (10 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1100,7 +1073,7 @@
                   10
 
 --- 1 row(s) selected.
->>select cast (-1 as largeint) from t022t1;
+>>select cast (-1 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1108,7 +1081,7 @@
                   -1
 
 --- 1 row(s) selected.
->>select cast (65536 as largeint) from t022t1;
+>>select cast (65536 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1116,7 +1089,7 @@
                65536
 
 --- 1 row(s) selected.
->>select cast (-2147483649 as largeint) from t022t1;
+>>select cast (-2147483649 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1124,7 +1097,7 @@
          -2147483649
 
 --- 1 row(s) selected.
->>select cast (2147483648 as largeint) from t022t1;
+>>select cast (2147483648 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1132,7 +1105,7 @@
           2147483648
 
 --- 1 row(s) selected.
->>select cast (-100000 as largeint) from t022t1;
+>>select cast (-100000 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1140,7 +1113,7 @@
              -100000
 
 --- 1 row(s) selected.
->>select cast (100000 as largeint) from t022t1;
+>>select cast (100000 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1148,7 +1121,7 @@
               100000
 
 --- 1 row(s) selected.
->>select cast (4294967296 as largeint) from t022t1;
+>>select cast (4294967296 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1156,7 +1129,7 @@
           4294967296
 
 --- 1 row(s) selected.
->>select cast (-10000000000 as largeint) from t022t1;
+>>select cast (-10000000000 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1164,7 +1137,7 @@
         -10000000000
 
 --- 1 row(s) selected.
->>select cast (10000000000 as largeint) from t022t1;
+>>select cast (10000000000 as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1173,7 +1146,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (-32769 as decimal(5)) from t022t1;
+>>select cast (-32769 as decimal(5)) from dual;
 
 (EXPR)
 ------
@@ -1181,7 +1154,7 @@
 -32769
 
 --- 1 row(s) selected.
->>select cast (32768 as decimal(5)) from t022t1;
+>>select cast (32768 as decimal(5)) from dual;
 
 (EXPR)
 ------
@@ -1189,7 +1162,7 @@
  32768
 
 --- 1 row(s) selected.
->>select cast (-10 as decimal(2)) from t022t1;
+>>select cast (-10 as decimal(2)) from dual;
 
 (EXPR)
 ------
@@ -1197,7 +1170,7 @@
    -10
 
 --- 1 row(s) selected.
->>select cast (10 as decimal(2)) from t022t1;
+>>select cast (10 as decimal(2)) from dual;
 
 (EXPR)
 ------
@@ -1205,7 +1178,7 @@
     10
 
 --- 1 row(s) selected.
->>select cast (-1 as decimal(1)) from t022t1;
+>>select cast (-1 as decimal(1)) from dual;
 
 (EXPR)
 ------
@@ -1213,7 +1186,7 @@
     -1
 
 --- 1 row(s) selected.
->>select cast (65536 as decimal(5)) from t022t1;
+>>select cast (65536 as decimal(5)) from dual;
 
 (EXPR)
 ------
@@ -1221,7 +1194,7 @@
  65536
 
 --- 1 row(s) selected.
->>select cast (-2147483649 as decimal(10)) from t022t1;
+>>select cast (-2147483649 as decimal(10)) from dual;
 
 (EXPR)     
 -----------
@@ -1229,7 +1202,7 @@
 -2147483649
 
 --- 1 row(s) selected.
->>select cast (2147483648 as decimal(10)) from t022t1;
+>>select cast (2147483648 as decimal(10)) from dual;
 
 (EXPR)     
 -----------
@@ -1237,7 +1210,7 @@
  2147483648
 
 --- 1 row(s) selected.
->>select cast (-100000 as decimal(6)) from t022t1;
+>>select cast (-100000 as decimal(6)) from dual;
 
 (EXPR) 
 -------
@@ -1245,7 +1218,7 @@
 -100000
 
 --- 1 row(s) selected.
->>select cast (100000 as decimal(6)) from t022t1;
+>>select cast (100000 as decimal(6)) from dual;
 
 (EXPR) 
 -------
@@ -1253,7 +1226,7 @@
  100000
 
 --- 1 row(s) selected.
->>select cast (4294967296 as decimal(10)) from t022t1;
+>>select cast (4294967296 as decimal(10)) from dual;
 
 (EXPR)     
 -----------
@@ -1261,7 +1234,7 @@
  4294967296
 
 --- 1 row(s) selected.
->>select cast (-10000000000 as decimal(11)) from t022t1;
+>>select cast (-10000000000 as decimal(11)) from dual;
 
 (EXPR)      
 ------------
@@ -1269,7 +1242,7 @@
 -10000000000
 
 --- 1 row(s) selected.
->>select cast (10000000000 as decimal(11)) from t022t1;
+>>select cast (10000000000 as decimal(11)) from dual;
 
 (EXPR)      
 ------------
@@ -1278,7 +1251,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (32768 as decimal(5) unsigned) from t022t1;
+>>select cast (32768 as decimal(5) unsigned) from dual;
 
 (EXPR)
 ------
@@ -1286,7 +1259,7 @@
  32768
 
 --- 1 row(s) selected.
->>select cast (10 as decimal(2) unsigned) from t022t1;
+>>select cast (10 as decimal(2) unsigned) from dual;
 
 (EXPR)
 ------
@@ -1294,7 +1267,7 @@
     10
 
 --- 1 row(s) selected.
->>select cast (65536 as decimal(5) unsigned) from t022t1;
+>>select cast (65536 as decimal(5) unsigned) from dual;
 
 (EXPR)
 ------
@@ -1302,7 +1275,7 @@
  65536
 
 --- 1 row(s) selected.
->>select cast (100000 as decimal(6) unsigned) from t022t1;
+>>select cast (100000 as decimal(6) unsigned) from dual;
 
 (EXPR)
 ------
@@ -1311,7 +1284,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (-32769 as real) from t022t1;
+>>select cast (-32769 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1319,7 +1292,7 @@
 -3.2769000E+004
 
 --- 1 row(s) selected.
->>select cast (32768 as real) from t022t1;
+>>select cast (32768 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1327,7 +1300,7 @@
  3.2768000E+004
 
 --- 1 row(s) selected.
->>select cast (-10 as real) from t022t1;
+>>select cast (-10 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1335,7 +1308,7 @@
 -1.0000000E+001
 
 --- 1 row(s) selected.
->>select cast (10 as real) from t022t1;
+>>select cast (10 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1343,7 +1316,7 @@
  1.0000000E+001
 
 --- 1 row(s) selected.
->>select cast (-1 as real) from t022t1;
+>>select cast (-1 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1351,7 +1324,7 @@
 -1.0000000E+000
 
 --- 1 row(s) selected.
->>select cast (65536 as real) from t022t1;
+>>select cast (65536 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1359,7 +1332,7 @@
  6.5536000E+004
 
 --- 1 row(s) selected.
->>select cast (-2147483649 as real) from t022t1;
+>>select cast (-2147483649 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1367,7 +1340,7 @@
 -2.1474836E+009
 
 --- 1 row(s) selected.
->>select cast (9999999999 as real) from t022t1;
+>>select cast (9999999999 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1375,7 +1348,7 @@
  1.0000000E+010
 
 --- 1 row(s) selected.
->>select cast (-100000 as real) from t022t1;
+>>select cast (-100000 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1383,7 +1356,7 @@
 -1.0000000E+005
 
 --- 1 row(s) selected.
->>select cast (100000 as real) from t022t1;
+>>select cast (100000 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1391,7 +1364,7 @@
  1.0000000E+005
 
 --- 1 row(s) selected.
->>select cast (9999999999 as real) from t022t1;
+>>select cast (9999999999 as real) from dual;
 
 (EXPR)         
 ---------------
@@ -1400,7 +1373,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (-32769 as double precision) from t022t1;
+>>select cast (-32769 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1408,7 +1381,7 @@
 -3.27690000000000064E+004
 
 --- 1 row(s) selected.
->>select cast (32768 as double precision) from t022t1;
+>>select cast (32768 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1416,7 +1389,7 @@
  3.27680000000000000E+004
 
 --- 1 row(s) selected.
->>select cast (-10 as double precision) from t022t1;
+>>select cast (-10 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1424,7 +1397,7 @@
 -1.00000000000000000E+001
 
 --- 1 row(s) selected.
->>select cast (10 as double precision) from t022t1;
+>>select cast (10 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1432,7 +1405,7 @@
  1.00000000000000000E+001
 
 --- 1 row(s) selected.
->>select cast (-1 as double precision) from t022t1;
+>>select cast (-1 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1440,7 +1413,7 @@
 -1.00000000000000000E+000
 
 --- 1 row(s) selected.
->>select cast (65536 as double precision) from t022t1;
+>>select cast (65536 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1448,7 +1421,7 @@
  6.55360000000000000E+004
 
 --- 1 row(s) selected.
->>select cast (-2147483649 as double precision) from t022t1;
+>>select cast (-2147483649 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1456,7 +1429,7 @@
 -2.14748364900000032E+009
 
 --- 1 row(s) selected.
->>select cast (2147483648 as double precision) from t022t1;
+>>select cast (2147483648 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1464,7 +1437,7 @@
  2.14748364800000000E+009
 
 --- 1 row(s) selected.
->>select cast (-100000 as double precision) from t022t1;
+>>select cast (-100000 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1472,7 +1445,7 @@
 -1.00000000000000000E+005
 
 --- 1 row(s) selected.
->>select cast (100000 as double precision) from t022t1;
+>>select cast (100000 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1480,7 +1453,7 @@
  1.00000000000000000E+005
 
 --- 1 row(s) selected.
->>select cast (4294967296 as double precision) from t022t1;
+>>select cast (4294967296 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1489,43 +1462,39 @@
 
 --- 1 row(s) selected.
 >>
->>select cast ('Hello, world!' as char(13)) from t022t2;
+>>select cast ('Hello, world!' as char(13)) from dual;
 
 (EXPR)       
 -------------
 
 Hello, world!
-Hello, world!
 
---- 2 row(s) selected.
->>select cast ('Hello, world!' as varchar(13)) from t022t2;
+--- 1 row(s) selected.
+>>select cast ('Hello, world!' as varchar(13)) from dual;
 
 (EXPR)       
 -------------
 
 Hello, world!
-Hello, world!
 
---- 2 row(s) selected.
->>select cast (cast ('Hello        ' as char(13)) as char(5)) from t022t2;
+--- 1 row(s) selected.
+>>select cast (cast ('Hello        ' as char(13)) as char(5)) from dual;
 
 (EXPR)
 ------
 
 Hello 
-Hello 
 
---- 2 row(s) selected.
->>select cast (cast ('Hello        ' as char(13)) as varchar(5)) from t022t2;
+--- 1 row(s) selected.
+>>select cast (cast ('Hello        ' as char(13)) as varchar(5)) from dual;
 
 (EXPR)
 ------
 
 Hello 
-Hello 
 
---- 2 row(s) selected.
->>select cast (cast ('Hello, world!' as char(13)) as char(5)) from t022t2;
+--- 1 row(s) selected.
+>>select cast (cast ('Hello, world!' as char(13)) as char(5)) from dual;
 
 *** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
 
@@ -1534,12 +1503,8 @@
 
 Hello 
 
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast ('Hello, world!' as char(13)) as varchar(5)) from t022t2;
+--- 1 row(s) selected.
+>>select cast (cast ('Hello, world!' as char(13)) as varchar(5)) from dual;
 
 *** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
 
@@ -1548,30 +1513,24 @@
 
 Hello 
 
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast ('Hello        ' as varchar(13)) as char(5)) from t022t2;
+--- 1 row(s) selected.
+>>select cast (cast ('Hello        ' as varchar(13)) as char(5)) from dual;
 
 (EXPR)
 ------
 
 Hello 
-Hello 
 
---- 2 row(s) selected.
->>select cast (cast ('Hello        ' as varchar(13)) as varchar(5)) from t022t2;
+--- 1 row(s) selected.
+>>select cast (cast ('Hello        ' as varchar(13)) as varchar(5)) from dual;
 
 (EXPR)
 ------
 
 Hello 
-Hello 
 
---- 2 row(s) selected.
->>select cast (cast ('Hello, world!' as varchar(13)) as char(5)) from t022t2;
+--- 1 row(s) selected.
+>>select cast (cast ('Hello, world!' as varchar(13)) as char(5)) from dual;
 
 *** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
 
@@ -1580,12 +1539,8 @@
 
 Hello 
 
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast ('Hello, world!' as varchar(13)) as varchar(5)) from t022t2;
+--- 1 row(s) selected.
+>>select cast (cast ('Hello, world!' as varchar(13)) as varchar(5)) from dual;
 
 *** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
 
@@ -1594,12 +1549,8 @@
 
 Hello 
 
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast (-2147483649 as double precision) as largeint) from t022t1;
+--- 1 row(s) selected.
+>>select cast (cast (-2147483649 as double precision) as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1607,7 +1558,7 @@
          -2147483649
 
 --- 1 row(s) selected.
->>select cast (cast (2147483648 as double precision) as largeint) from t022t1;
+>>select cast (cast (2147483648 as double precision) as largeint) from dual;
 
 (EXPR)              
 --------------------
@@ -1618,7 +1569,7 @@
 >>
 >>-- Positive cases to test division.
 >>
->>select cast (1 as numeric(1)) / cast (1 as numeric(1)) from t022t1;
+>>select cast (1 as numeric(1)) / cast (1 as numeric(1)) from dual;
 
 (EXPR) 
 -------
@@ -1626,7 +1577,7 @@
     1.0
 
 --- 1 row(s) selected.
->>select cast (1 as numeric(5)) / cast (1 as numeric(1)) from t022t1;
+>>select cast (1 as numeric(5)) / cast (1 as numeric(1)) from dual;
 
 (EXPR)      
 ------------
@@ -1634,7 +1585,7 @@
          1.0
 
 --- 1 row(s) selected.
->>select cast (1 as numeric(1)) / cast (1 as numeric(5)) from t022t1;
+>>select cast (1 as numeric(1)) / cast (1 as numeric(5)) from dual;
 
 (EXPR)      
 ------------
@@ -1642,7 +1593,7 @@
      1.00000
 
 --- 1 row(s) selected.
->>select cast (1 as numeric(5)) / cast (1 as numeric(5)) from t022t1;
+>>select cast (1 as numeric(5)) / cast (1 as numeric(5)) from dual;
 
 (EXPR)               
 ---------------------
@@ -1650,7 +1601,7 @@
               1.00000
 
 --- 1 row(s) selected.
->>select cast (1 as numeric(10)) / cast (1 as numeric(10)) from t022t1;
+>>select cast (1 as numeric(10)) / cast (1 as numeric(10)) from dual;
 
 (EXPR)               
 ---------------------
@@ -1660,7 +1611,7 @@
 --- 1 row(s) selected.
 >>
 >>select cast (1 as numeric(1) unsigned) /
-+>       cast (1 as numeric(1) unsigned) from t022t1;
++>       cast (1 as numeric(1) unsigned) from dual;
 
 (EXPR)
 ------
@@ -1669,7 +1620,7 @@
 
 --- 1 row(s) selected.
 >>select cast (1 as numeric(5) unsigned) /
-+>       cast (1 as numeric(1) unsigned) from t022t1;
++>       cast (1 as numeric(1) unsigned) from dual;
 
 (EXPR)     
 -----------
@@ -1678,7 +1629,7 @@
 
 --- 1 row(s) selected.
 >>select cast (1 as numeric(1) unsigned) /
-+>       cast (1 as numeric(5) unsigned) from t022t1;
++>       cast (1 as numeric(5) unsigned) from dual;
 
 (EXPR)     
 -----------
@@ -1687,7 +1638,7 @@
 
 --- 1 row(s) selected.
 >>select cast (1 as numeric(5) unsigned) /
-+>       cast (1 as numeric(5) unsigned) from t022t1;
++>       cast (1 as numeric(5) unsigned) from dual;
 
 (EXPR)               
 ---------------------
@@ -1696,7 +1647,7 @@
 
 --- 1 row(s) selected.
 >>select cast (1 as numeric(9) unsigned) /
-+>       cast (1 as numeric(9) unsigned) from t022t1;
++>       cast (1 as numeric(9) unsigned) from dual;
 
 (EXPR)               
 ---------------------
@@ -1705,7 +1656,7 @@
 
 --- 1 row(s) selected.
 >>
->>select cast (1 as double precision) / cast (1 as double precision) from t022t1;
+>>select cast (1 as double precision) / cast (1 as double precision) from dual;
 
 (EXPR)                   
 -------------------------
@@ -1716,771 +1667,766 @@
 >>
 >>-- Negative tests.
 >>
->>select cast (cast (-10 as smallint) as numeric(1)) from t022t1;
+>>select cast (cast (-10 as smallint) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:-10 Target Type:LARGEINT(IBIN64S) Min Target Value:-9. Instruction:RANGE_LOW_S16S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as smallint) as numeric(1)) from t022t1;
+>>select cast (cast (10 as smallint) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_S16S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (-10 as numeric(2)) as numeric(1)) from t022t1;
+>>select cast (cast (-10 as numeric(2)) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:TINYINT SIGNED(MBIN8S) Source Value:-10 Target Type:LARGEINT(IBIN64S) Min Target Value:-9. Instruction:RANGE_LOW_S8S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as numeric(2)) as numeric(1)) from t022t1;
+>>select cast (cast (10 as numeric(2)) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:TINYINT SIGNED(MBIN8S) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_S8S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as smallint) as smallint unsigned) from t022t1;
+>>select cast (cast (-1 as smallint) as smallint unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S16S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as smallint) as numeric(1) unsigned) from t022t1;
+>>select cast (cast (10 as smallint) as numeric(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_S16S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as smallint) as int unsigned) from t022t1;
+>>select cast (cast (-1 as smallint) as int unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S16S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (-10 as smallint) as decimal(1)) from t022t1;
+>>select cast (cast (-10 as smallint) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as smallint) as decimal(1)) from t022t1;
+>>select cast (cast (10 as smallint) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as smallint) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (-1 as smallint) as decimal(1) unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as smallint) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (10 as smallint) as decimal(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
->>select cast (cast (32768 as smallint unsigned) as smallint) from t022t1;
+>>select cast (cast (32768 as smallint unsigned) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT UNSIGNED(MBIN16U) Source Value:32768 Target Type:LARGEINT(IBIN64S) Max Target Value:32767. Instruction:RANGE_HIGH_U16S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as smallint unsigned) as numeric(1)) from t022t1;
+>>select cast (cast (10 as smallint unsigned) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT UNSIGNED(MBIN16U) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_U16S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as smallint unsigned) as numeric(1)unsigned) from t022t1;
+>>select cast (cast (10 as smallint unsigned) as numeric(1)unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT UNSIGNED(MBIN16U) Source Value:10 Target Type:LARGEINT(IBIN64S) Max Target Value:9. Instruction:RANGE_HIGH_U16S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as smallint unsigned) as decimal(1)) from t022t1;
+>>select cast (cast (10 as smallint unsigned) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as smallint unsigned) as decimal(1)unsigned) from t022t1;
+>>select cast (cast (10 as smallint unsigned) as decimal(1)unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
->>select cast (cast (-32769 as int) as smallint) from t022t1;
+>>select cast (cast (-32769 as int) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:-32769 Target Type:LARGEINT(IBIN64S) Min Target Value:-32768. Instruction:RANGE_LOW_S32S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (32768 as int) as smallint) from t022t1;
+>>select cast (cast (32768 as int) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:32768 Target Type:LARGEINT(IBIN64S) Max Target Value:32767. Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (-10 as int) as numeric(1)) from t022t1;
+>>select cast (cast (-10 as int) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:-10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as int) as numeric(1)) from t022t1;
+>>select cast (cast (10 as int) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as int) as smallint unsigned) from t022t1;
+>>select cast (cast (-1 as int) as smallint unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:INTEGER SIGNED(MBIN32S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S32S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (65536 as int) as smallint unsigned) from t022t1;
+>>select cast (cast (65536 as int) as smallint unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:65536 Target Type:LARGEINT(IBIN64S) Max Target Value:65535. Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as int) as numeric(1) unsigned) from t022t1;
+>>select cast (cast (10 as int) as numeric(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-100000 as int) as numeric(5)) from t022t1;
+>>select cast (cast (-100000 as int) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:-100000 Target Type:LARGEINT(IBIN64S) Min Target Value:-99999. Instruction:RANGE_LOW_S32S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as int) as numeric(5)) from t022t1;
+>>select cast (cast (100000 as int) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as int) as int unsigned) from t022t1;
+>>select cast (cast (-1 as int) as int unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:INTEGER SIGNED(MBIN32S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S32S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as int) as numeric(5) unsigned) from t022t1;
+>>select cast (cast (100000 as int) as numeric(5) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (-10 as int) as decimal(1)) from t022t1;
+>>select cast (cast (-10 as int) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as int) as decimal(1)) from t022t1;
+>>select cast (cast (10 as int) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as int) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (-1 as int) as decimal(1) unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as int) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (10 as int) as decimal(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
->>select cast (cast (32768 as int unsigned) as smallint) from t022t1;
+>>select cast (cast (32768 as int unsigned) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:32768 Target Type:LARGEINT(IBIN64S) Max Target Value:32767. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as int unsigned) as numeric(1)) from t022t1;
+>>select cast (cast (10 as int unsigned) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (65536 as int unsigned) as smallint unsigned) from t022t1;
+>>select cast (cast (65536 as int unsigned) as smallint unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:65536 Target Type:LARGEINT(IBIN64S) Max Target Value:65535. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as int unsigned) as numeric(1) unsigned) from t022t1;
+>>select cast (cast (10 as int unsigned) as numeric(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (2147483648 as int unsigned) as int) from t022t1;
+>>select cast (cast (2147483648 as int unsigned) as int) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:2147483648 Target Type:LARGEINT(IBIN64S) Max Target Value:2147483647. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as int unsigned) as numeric(5)) from t022t1;
+>>select cast (cast (100000 as int unsigned) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as int unsigned) as numeric(5) unsigned) from t022t1;
+>>select cast (cast (100000 as int unsigned) as numeric(5) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:INTEGER UNSIGNED(MBIN32U) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_U32S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as int unsigned) as decimal(1)) from t022t1;
+>>select cast (cast (10 as int unsigned) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as int unsigned) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (10 as int unsigned) as decimal(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
->>select cast (cast (-32769 as largeint) as smallint) from t022t1;
+>>select cast (cast (-32769 as largeint) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:-32769 Target Type:LARGEINT(IBIN64S) Min Target Value:-32768. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (32768 as largeint) as smallint) from t022t1;
+>>select cast (cast (32768 as largeint) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:32768 Target Type:LARGEINT(IBIN64S) Max Target Value:32767. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (-10 as largeint) as numeric(1)) from t022t1;
+>>select cast (cast (-10 as largeint) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as largeint) as numeric(1)) from t022t1;
+>>select cast (cast (10 as largeint) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as largeint) as smallint unsigned) from t022t1;
+>>select cast (cast (-1 as largeint) as smallint unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (65536 as largeint) as smallint unsigned) from t022t1;
+>>select cast (cast (65536 as largeint) as smallint unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as largeint) as numeric(1) unsigned) from t022t1;
+>>select cast (cast (10 as largeint) as numeric(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-2147483649 as largeint) as int) from t022t1;
+>>select cast (cast (-2147483649 as largeint) as int) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:-2147483649 Target Type:LARGEINT(IBIN64S) Min Target Value:-2147483648. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (2147483648 as largeint) as int) from t022t1;
+>>select cast (cast (2147483648 as largeint) as int) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:2147483648 Target Type:LARGEINT(IBIN64S) Max Target Value:2147483647. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (-100000 as largeint) as numeric(5)) from t022t1;
+>>select cast (cast (-100000 as largeint) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:-100000 Target Type:LARGEINT(IBIN64S) Min Target Value:-99999. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as largeint) as numeric(5)) from t022t1;
+>>select cast (cast (100000 as largeint) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as largeint) as int unsigned) from t022t1;
+>>select cast (cast (-1 as largeint) as int unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:LARGEINT(MBIN64S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (4294967296 as largeint) as int unsigned) from t022t1;
+>>select cast (cast (4294967296 as largeint) as int unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:4294967296 Target Type:LARGEINT(IBIN64S) Max Target Value:4294967295. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as largeint) as numeric(5) unsigned) from t022t1;
+>>select cast (cast (100000 as largeint) as numeric(5) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:100000 Target Type:LARGEINT(IBIN64S) Max Target Value:99999. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (-10000000000 as largeint) as numeric(10)) from t022t1;
+>>select cast (cast (-10000000000 as largeint) as numeric(10)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:-10000000000 Target Type:LARGEINT(IBIN64S) Min Target Value:-9999999999. Instruction:RANGE_LOW_S64S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast (cast (10000000000 as largeint) as numeric(10)) from t022t1;
+>>select cast (cast (10000000000 as largeint) as numeric(10)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:LARGEINT(MBIN64S) Source Value:10000000000 Target Type:LARGEINT(IBIN64S) Max Target Value:9999999999. Instruction:RANGE_HIGH_S64S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as largeint) as decimal(1)) from t022t1;
+>>select cast (cast (10 as largeint) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as largeint) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (-1 as largeint) as decimal(1) unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as largeint) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (10 as largeint) as decimal(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
->>select cast (cast (-32769 as decimal(5)) as smallint) from t022t1;
+>>select cast (cast (-32769 as decimal(5)) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-32769 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (32768 as decimal(5)) as smallint) from t022t1;
+>>select cast (cast (32768 as decimal(5)) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:32768 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-10 as decimal(2)) as numeric(1)) from t022t1;
+>>select cast (cast (-10 as decimal(2)) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as decimal(2)) as numeric(1)) from t022t1;
+>>select cast (cast (10 as decimal(2)) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as decimal(1)) as smallint unsigned) from t022t1;
+>>select cast (cast (-1 as decimal(1)) as smallint unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (65536 as decimal(5)) as smallint unsigned) from t022t1;
+>>select cast (cast (65536 as decimal(5)) as smallint unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as decimal(2)) as numeric(1) unsigned) from t022t1;
+>>select cast (cast (10 as decimal(2)) as numeric(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-2147483649 as decimal(10)) as int) from t022t1;
+>>select cast (cast (-2147483649 as decimal(10)) as int) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-2147483649 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (2147483648 as decimal(10)) as int) from t022t1;
+>>select cast (cast (2147483648 as decimal(10)) as int) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:2147483648 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-100000 as decimal(6)) as numeric(5)) from t022t1;
+>>select cast (cast (-100000 as decimal(6)) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as decimal(6)) as numeric(5)) from t022t1;
+>>select cast (cast (100000 as decimal(6)) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as decimal(1)) as int unsigned) from t022t1;
+>>select cast (cast (-1 as decimal(1)) as int unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (4294967296 as decimal(10)) as int unsigned) from t022t1;
+>>select cast (cast (4294967296 as decimal(10)) as int unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:4294967296 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as decimal(6)) as numeric(5) unsigned) from t022t1;
+>>select cast (cast (100000 as decimal(6)) as numeric(5) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-10000000000 as decimal(11)) as numeric(10)) from t022t1;
+>>select cast (cast (-10000000000 as decimal(11)) as numeric(10)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10000000000 to Target Type:LARGEINT(REC_BIN64_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10000000000 as decimal(11)) as numeric(10)) from t022t1;
+>>select cast (cast (10000000000 as decimal(11)) as numeric(10)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10000000000 to Target Type:LARGEINT(REC_BIN64_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as decimal(2)) as decimal(1)) from t022t1;
+>>select cast (cast (10 as decimal(2)) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as decimal(1)) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (-1 as decimal(1)) as decimal(1) unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (10 as decimal(2)) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (10 as decimal(2)) as decimal(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
->>select cast (cast (32768 as decimal(5) unsigned) as smallint) from t022t1;
+>>select cast (cast (32768 as decimal(5) unsigned) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:32768 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as decimal(2) unsigned) as numeric(1)) from t022t1;
+>>select cast (cast (10 as decimal(2) unsigned) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (65536 as decimal(5) unsigned) as smallint unsigned) from t022t1;
+>>select cast (cast (65536 as decimal(5) unsigned) as smallint unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as decimal(2) unsigned) as numeric(1) unsigned) from t022t1;
+>>select cast (cast (10 as decimal(2) unsigned) as numeric(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as decimal(6) unsigned) as numeric(5)) from t022t1;
+>>select cast (cast (100000 as decimal(6) unsigned) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as decimal(6) unsigned) as numeric(5) unsigned) from t022t1;
+>>select cast (cast (100000 as decimal(6) unsigned) as numeric(5) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as decimal(2) unsigned) as decimal(1)) from t022t1;
+>>select cast (cast (10 as decimal(2) unsigned) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as decimal(2) unsigned) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (10 as decimal(2) unsigned) as decimal(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
->>select cast (cast (-32769 as real) as smallint) from t022t1;
+>>select cast (cast (-32769 as real) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:-3.2769000E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (32768 as real) as smallint) from t022t1;
+>>select cast (cast (32768 as real) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:3.2768000E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-10 as real) as numeric(1)) from t022t1;
+>>select cast (cast (-10 as real) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:0.0000000E+000 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as real) as numeric(1)) from t022t1;
+>>select cast (cast (10 as real) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-044 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as real) as smallint unsigned) from t022t1;
+>>select cast (cast (-1 as real) as smallint unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (65536 as real) as smallint unsigned) from t022t1;
+>>select cast (cast (65536 as real) as smallint unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:6.5536000E+004 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as real) as numeric(1) unsigned) from t022t1;
+>>select cast (cast (10 as real) as numeric(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-044 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-2147484160 as real) as int) from t022t1;
+>>select cast (cast (-2147484160 as real) as int) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:-2.1474841E+009 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (9999999999 as real) as int) from t022t1;
+>>select cast (cast (9999999999 as real) as int) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+010 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-100000 as real) as numeric(5)) from t022t1;
+>>select cast (cast (-100000 as real) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:0.0000000E+000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as real) as numeric(5)) from t022t1;
+>>select cast (cast (100000 as real) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-040 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as real) as int unsigned) from t022t1;
+>>select cast (cast (-1 as real) as int unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (9999999999 as real) as int unsigned) from t022t1;
+>>select cast (cast (9999999999 as real) as int unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+010 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as real) as numeric(5) unsigned) from t022t1;
+>>select cast (cast (100000 as real) as numeric(5) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-040 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as real) as decimal(1)) from t022t1;
+>>select cast (cast (10 as real) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+001 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as real) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (-1 as real) as decimal(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:-1.0000000E+000 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as real) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (10 as real) as decimal(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+001 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
->>select cast (cast (-32769 as double precision) as smallint) from t022t1;
+>>select cast (cast (-32769 as double precision) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:-3.27690000000000064E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (32768 as double precision) as smallint) from t022t1;
+>>select cast (cast (32768 as double precision) as smallint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:3.27680000000000000E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-10 as double precision) as numeric(1)) from t022t1;
+>>select cast (cast (-10 as double precision) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:0.00000000000000000E+000 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as double precision) as numeric(1)) from t022t1;
+>>select cast (cast (10 as double precision) as numeric(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246592E-323 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as double precision) as smallint unsigned) from t022t1;
+>>select cast (cast (-1 as double precision) as smallint unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (65536 as double precision) as smallint unsigned) from t022t1;
+>>select cast (cast (65536 as double precision) as smallint unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:6.55360000000000000E+004 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as double precision) as numeric(1) unsigned) from t022t1;
+>>select cast (cast (10 as double precision) as numeric(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246592E-323 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-2147483649 as double precision) as int) from t022t1;
+>>select cast (cast (-2147483649 as double precision) as int) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:-2.14748364900000032E+009 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (2147483648 as double precision) as int) from t022t1;
+>>select cast (cast (2147483648 as double precision) as int) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:2.14748364800000000E+009 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-100000 as double precision) as numeric(5)) from t022t1;
+>>select cast (cast (-100000 as double precision) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:0.00000000000000000E+000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as double precision) as numeric(5)) from t022t1;
+>>select cast (cast (100000 as double precision) as numeric(5)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246528E-319 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as double precision) as int unsigned) from t022t1;
+>>select cast (cast (-1 as double precision) as int unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
 
 --- 0 row(s) selected.
->>select cast (cast (4294967296 as double precision) as int unsigned) from t022t1;
+>>select cast (cast (4294967296 as double precision) as int unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.29496729600000000E+009 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (100000 as double precision) as numeric(5) unsigned) from t022t1;
+>>select cast (cast (100000 as double precision) as numeric(5) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246528E-319 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as double precision) as decimal(1)) from t022t1;
+>>select cast (cast (10 as double precision) as decimal(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:1.00000000000000000E+001 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast (cast (-1 as double precision) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (-1 as double precision) as decimal(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:-1.00000000000000000E+000 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast (cast (10 as double precision) as decimal(1) unsigned) from t022t1;
+>>select cast (cast (10 as double precision) as decimal(1) unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:1.00000000000000000E+001 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
 >>-- negative tests for tinyint
->>select cast(-129 as tinyint) from t022t1;
+>>select cast(-129 as tinyint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:-129 Target Type:LARGEINT(IBIN64S) Min Target Value:-128. Instruction:RANGE_LOW_S16S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
->>select cast(128 as tinyint) from t022t1;
+>>select cast(128 as tinyint) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:128 Target Type:LARGEINT(IBIN64S) Max Target Value:127. Instruction:RANGE_HIGH_S16S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast(256 as tinyint unsigned) from t022t1;
+>>select cast(256 as tinyint unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:256 Target Type:LARGEINT(IBIN64S) Max Target Value:255. Instruction:RANGE_HIGH_S16S64 Operation:RANGE_HIGH.
 
 --- 0 row(s) selected.
->>select cast(-1 as tinyint unsigned) from t022t1;
+>>select cast(-1 as tinyint unsigned) from dual;
 
 *** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype. Source Type:SMALLINT SIGNED(MBIN16S) Source Value:-1 Target Type:LARGEINT(IBIN64S) Max Target Value:0. Instruction:RANGE_LOW_S16S64 Operation:RANGE_LOW.
 
 --- 0 row(s) selected.
 >>
 >>-- tests for DATE, TIME, TIMESTAMP
->>select cast ('12.07.1961 03.04.55.123456' as timestamp) from t022t2;
+>>select cast ('12.07.1961 03.04.55.123456' as timestamp) from dual;
 
 (EXPR)                    
 --------------------------
 
 1961-07-12 03:04:55.123456
-1961-07-12 03:04:55.123456
 
---- 2 row(s) selected.
->>select cast ('12.07.1961 03.04.55.123456' as timestamp(3)) from t022t2;
+--- 1 row(s) selected.
+>>select cast ('12.07.1961 03.04.55.123456' as timestamp(3)) from dual;
 
 (EXPR)                 
 -----------------------
 
 1961-07-12 03:04:55.123
-1961-07-12 03:04:55.123
 
---- 2 row(s) selected.
->>select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as DATE) from t022t2;
+--- 1 row(s) selected.
+>>select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as DATE) from dual;
 
 (EXPR)    
 ----------
 
 1961-07-12
-1961-07-12
 
---- 2 row(s) selected.
->>select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as char(21)) from t022t2;
+--- 1 row(s) selected.
+>>select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as char(21)) from dual;
 
 (EXPR)               
 ---------------------
 
 1961-07-12 03:04:55.1
-1961-07-12 03:04:55.1
 
---- 2 row(s) selected.
->>select cast ('12/13/1987' as date) from t022t2;
+--- 1 row(s) selected.
+>>select cast ('12/13/1987' as date) from dual;
 
 (EXPR)    
 ----------
 
 1987-12-13
-1987-12-13
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- some negative DATE, TIME, TIMESTAMP
 >>-- illegal european format
->>select cast ('12.13.1987' as date) from t022t2;
+>>select cast ('12.13.1987' as date) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 12.13.1987
 
 --- 0 row(s) selected.
 >>
 >>-- illegal US format
->>select cast ('13/12/1987' as date) from t022t2;
+>>select cast ('13/12/1987' as date) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 13/12/1987
 
 --- 0 row(s) selected.
 >>
 >>-- string overflow
->>select cast (cast ('12.07.1961 03:04:55.123456' as timestamp) as char(18)) from t022t2;
+>>select cast (cast ('12.07.1961 03:04:55.123456' as timestamp) as char(18)) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 12.07.1961 03:04:55.123456
 
 --- 0 row(s) selected.
 >>
 >>-- Feb. 30th doesn't exist
->>select cast('1997-30-02' as DATE) from t022t2;
+>>select cast('1997-30-02' as DATE) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 1997-30-02
 
 --- 0 row(s) selected.
 >>
->>select interval'0.1'second + timestamp'12/31/9999 11:59:59.9 pm' from t022t1;
+>>select interval'0.1'second + timestamp'12/31/9999 11:59:59.9 pm' from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
->>select timestamp'12/31/9999 11:59:59.9 pm' + interval'0.1'second from t022t1;
+>>select timestamp'12/31/9999 11:59:59.9 pm' + interval'0.1'second from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
->>select timestamp'01/01/0001 00:00:00.0' + interval-'0.1'second from t022t1;
+>>select timestamp'01/01/0001 00:00:00.0' + interval-'0.1'second from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
->>select timestamp'01/01/0001 00:00:00.0' - interval'0.1'second from t022t1;
+>>select timestamp'01/01/0001 00:00:00.0' - interval'0.1'second from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
 >>
->>select interval'1'month + date'12/31/9999' from t022t1;
+>>select interval'1'month + date'12/31/9999' from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
->>select date'12/31/9999' + interval'1'month from t022t1;
+>>select date'12/31/9999' + interval'1'month from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
->>select date'01/01/0001' + interval-'1'month from t022t1;
+>>select date'01/01/0001' + interval-'1'month from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
->>select date'01/01/0001' - interval'1'month from t022t1;
+>>select date'01/01/0001' - interval'1'month from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
 >>
->>select interval'1'month + date'01/31/9999' from t022t1;
+>>select interval'1'month + date'01/31/9999' from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
->>select date'01/31/9999' + interval'1'month from t022t1;
+>>select date'01/31/9999' + interval'1'month from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
->>select date'03/30/9999' + interval-'1'month from t022t1;
+>>select date'03/30/9999' + interval-'1'month from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- 0 row(s) selected.
->>select date'03/30/9999' - interval'1'month from t022t1;
+>>select date'03/30/9999' - interval'1'month from dual;
 
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
@@ -2488,71 +2434,71 @@
 >>
 >>-- Negative cases to test division by zero.
 >>
->>select cast (1 as numeric(1)) / cast (0 as numeric(1)) from t022t1;
+>>select cast (1 as numeric(1)) / cast (0 as numeric(1)) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero.
 
 --- 0 row(s) selected.
->>select cast (1 as numeric(5)) / cast (0 as numeric(1)) from t022t1;
+>>select cast (1 as numeric(5)) / cast (0 as numeric(1)) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero.
 
 --- 0 row(s) selected.
->>select cast (1 as numeric(1)) / cast (0 as numeric(5)) from t022t1;
+>>select cast (1 as numeric(1)) / cast (0 as numeric(5)) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero.
 
 --- 0 row(s) selected.
->>select cast (1 as numeric(5)) / cast (0 as numeric(5)) from t022t1;
+>>select cast (1 as numeric(5)) / cast (0 as numeric(5)) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero. Operand1 Type:LARGEINT(MBIN64S) Operand1 Value:100000 Operand2 Type:LARGEINT(MBIN64S) Operand2 Value:0. Instruction:DIV_MBIN64S_MBIN64S_MBIN64S Operation:DIV.
 
 --- 0 row(s) selected.
->>select cast (1 as numeric(10)) / cast (0 as numeric(10)) from t022t1;
+>>select cast (1 as numeric(10)) / cast (0 as numeric(10)) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero.
 
 --- 0 row(s) selected.
 >>
 >>select cast (1 as numeric(1) unsigned) /
-+>       cast (0 as numeric(1) unsigned) from t022t1;
++>       cast (0 as numeric(1) unsigned) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero.
 
 --- 0 row(s) selected.
 >>select cast (1 as numeric(5) unsigned) /
-+>       cast (0 as numeric(1) unsigned) from t022t1;
++>       cast (0 as numeric(1) unsigned) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero.
 
 --- 0 row(s) selected.
 >>select cast (1 as numeric(1) unsigned) /
-+>       cast (0 as numeric(5) unsigned) from t022t1;
++>       cast (0 as numeric(5) unsigned) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero.
 
 --- 0 row(s) selected.
 >>select cast (1 as numeric(5) unsigned) /
-+>       cast (0 as numeric(5) unsigned) from t022t1;
++>       cast (0 as numeric(5) unsigned) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero. Operand1 Type:LARGEINT(MBIN64S) Operand1 Value:100000 Operand2 Type:LARGEINT(MBIN64S) Operand2 Value:0. Instruction:DIV_MBIN64S_MBIN64S_MBIN64S Operation:DIV.
 
 --- 0 row(s) selected.
 >>select cast (1 as numeric(9) unsigned) /
-+>       cast (0 as numeric(9) unsigned) from t022t1;
++>       cast (0 as numeric(9) unsigned) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero. Operand1 Type:LARGEINT(MBIN64S) Operand1 Value:1000000000 Operand2 Type:LARGEINT(MBIN64S) Operand2 Value:0. Instruction:DIV_MBIN64S_MBIN64S_MBIN64S Operation:DIV.
 
 --- 0 row(s) selected.
 >>
->>select cast (1 as double precision) / cast (0 as double precision) from t022t1;
+>>select cast (1 as double precision) / cast (0 as double precision) from dual;
 
 *** ERROR[8419] An arithmetic expression attempted a division by zero. Operand1 Type:IEEE DOUBLE PRECISION(MFLT64) Operand1 Value:1.00000000000000000E+000 Operand2 Type:IEEE DOUBLE PRECISION(MFLT64) Operand2 Value:0.00000000000000000E+000. Instruction:DIV_MFLT64_MFLT64_MFLT64 Operation:DIV.
 
 --- 0 row(s) selected.
 >>
 >>-- results:  1 row selected
->>select cast('66.2' as float) from t022t1 where cast('66.2' as float) = 66.2;
+>>select cast('66.2' as float) from dual where cast('66.2' as float) = 66.2;
 
 (EXPR)                   
 -------------------------
@@ -2652,37 +2598,15 @@
 >>
 >>
 >>-- negative test cases
->>-- The next three tests get different results depending on whether they
->>-- are run using SQL/MX or SQL/MP tables.  Run them separately 
->>?ifMP
->>create table t022t5 (t022t5_c1 numeric( 9) unsigned,
-+>                     t022t5_c2 numeric(10) unsigned);
 >>create table t022t6 (t022t6_c1 decimal( 9) unsigned,
-+>                     t022t6_c2 decimal(10) unsigned);
->>create table t022t7 (t022t7_c1 dec    ( 9) unsigned,
-+>                     t022t7_c2 dec    (10) unsigned);
->>?ifMP
->>
->>?ifMX
->>create table t022t5 (t022t5_c1 numeric( 9) unsigned,
-+>                     t022t5_c2 numeric(10) unsigned);
-
---- SQL operation complete.
->>create table t022t6 (t022t6_c1 decimal( 9) unsigned,
-+>                     t022t6_c2 decimal(10) unsigned);
-
-*** ERROR[3008] Precision of DECIMAL UNSIGNED data type, 10, cannot exceed 9.
-
-*** ERROR[8822] The statement was not prepared.
-
->>create table t022t7 (t022t7_c1 dec    ( 9) unsigned,
++>                     t022t6_c2 decimal(10) unsigned,
++>                     t022t7_c1 dec    ( 9) unsigned,
 +>                     t022t7_c2 dec    (10) unsigned);
 
 *** ERROR[3008] Precision of DECIMAL UNSIGNED data type, 10, cannot exceed 9.
 
 *** ERROR[8822] The statement was not prepared.
 
->>?ifMX
 >>
 >>select cast(1 as numeric(10) unsigned) from (values(0))x;
 
@@ -3013,7 +2937,7 @@
  1.2300000E+002   1.2312000E+002   1.2300000E+004   1.2312000E+004
 
 --- 1 row(s) selected.
->>?ifNT
+>>
 >>obey t022xxx;
 >>begin work;
 
@@ -3040,13 +2964,6 @@
  3.00000000000000000E+000   1.23456000000000016E+004
 
 --- 3 row(s) selected.
->>?ifNT
->>?ifNSK
->>?ifMX
->>sh $mxcidir/import $$TEST_SCHEMA$$.t022a7 -I t022xxx;
->>select * from $$TEST_SCHEMA$$.t022a7;
->>?ifMX
->>?ifNSK
 >>
 >>-- negative cases (expect errors)
 >>select cast('.-2' as int) from t022t8;
@@ -3114,7 +3031,6 @@
 >>
 >>-- Testing solution 10-030707-7648
 >>-- Catch overflow while manipulating interval internal type (decimal)
->>?ifMX
 >>create table t022t9 (h10s4 interval hour(10) to second(4));
 
 --- SQL operation complete.
@@ -3126,14 +3042,6 @@
 +>   hour(10) to second(4));
 
 --- 1 row(s) inserted.
->>?ifMX
->>?ifMP
->>create table t022t9 (h10s4 interval hour(10) to fraction(4));
->>insert into t022t9 values (-interval '1111111111:12:00.1234'
-+>   hour(10) to fraction(4));
->>insert into t022t9 values (interval '1111111111:12:00.1234'
-+>   hour(10) to fraction(4));
->>?ifMP
 >>
 >>-- Should not overflow.
 >>update t022t9 set h10s4 = h10s4 * 1;
@@ -3183,7 +3091,6 @@
 >>-- End of testing solution 10-030707-7648
 >>
 >>-- Numeric to interval converion overflow checking
->>?ifMX
 >>create table t022ta(a interval second not null primary key);
 
 --- SQL operation complete.
@@ -3399,8 +3306,6 @@
 
 --- 1 row(s) selected.
 >>
->>?ifMX
->>?ifMX
 >>create table t022td (D_to_F      INTERVAL    DAY TO SECOND(3));
 
 --- SQL operation complete.
@@ -3410,12 +3315,6 @@
 >>insert into t022td values (interval '27 04:57:58.999' day to second(3));
 
 --- 1 row(s) inserted.
->>?ifMX
->>?ifMP
->>create table t022td (D_to_F      INTERVAL    DAY TO FRACTION(3));
->>insert into t022td values (interval '18 15:17:02.123' day to fraction(3));
->>insert into t022td values (interval '27 04:57:58.999' day to fraction(3));
->>?ifMP
 >>select D_to_F / 1  from t022td;
 
 (EXPR)          
@@ -3439,7 +3338,6 @@
 --- 1 row(s) inserted.
 >>
 >>-- should not overflow
->>?ifMX
 >>select CAST (dnum as INTERVAL second) from t022te;
 
 (EXPR)    
@@ -3448,12 +3346,7 @@
  23.123456
 
 --- 1 row(s) selected.
->>?ifMX
->>?ifMP
->>select CAST (dnum as INTERVAL second TO fraction) from t022te;
->>?ifMP
 >>
->>?ifMX
 >>create table t022tf (
 +>    ivyr interval year (4),
 +>    ivmt interval month,
@@ -3534,86 +3427,76 @@
 
 --- 1 row(s) selected.
 >>
->>?ifMX
 >>-- End of testing Solution 10-040226-3566
 >>
 >>-- negative tests on casts between CHAR/NCHAR 
->>?ifMX
->>select cast (N'Hello, world!' as char(13)) from t022u;
+>>select cast (N'Hello, world!' as char(13)) from dual;
 
 (EXPR)                    
 --------------------------
 
 Hello, world!             
-Hello, world!             
 
---- 2 row(s) selected.
->>select cast (N'Hello, world!' as varchar(13)) from t022u;
+--- 1 row(s) selected.
+>>select cast (N'Hello, world!' as varchar(13)) from dual;
 
 (EXPR)                    
 --------------------------
 
 Hello, world!             
-Hello, world!             
 
---- 2 row(s) selected.
->>select cast ('Hello, world!' as nchar(13)) from t022u;
+--- 1 row(s) selected.
+>>select cast ('Hello, world!' as nchar(13)) from dual;
 
 (EXPR)                    
 --------------------------
 
 Hello, world!             
-Hello, world!             
 
---- 2 row(s) selected.
->>select cast ('Hello, world!' as nchar varying(13)) from t022u;
+--- 1 row(s) selected.
+>>select cast ('Hello, world!' as nchar varying(13)) from dual;
 
 (EXPR)                    
 --------------------------
 
 Hello, world!             
-Hello, world!             
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- tests on cast VAR/NCHAR to VAR/NCHAR
->>select cast (N'Hello, world!' as nchar(13)) from t022u;
+>>select cast (N'Hello, world!' as nchar(13)) from dual;
 
 (EXPR)                    
 --------------------------
 
 Hello, world!             
-Hello, world!             
 
---- 2 row(s) selected.
->>select cast (N'Hello, world!' as nchar varying(13)) from t022u;
+--- 1 row(s) selected.
+>>select cast (N'Hello, world!' as nchar varying(13)) from dual;
 
 (EXPR)                    
 --------------------------
 
 Hello, world!             
-Hello, world!             
 
---- 2 row(s) selected.
->>select cast (cast (N'Hello        ' as nchar(13)) as nchar(5)) from t022u;
+--- 1 row(s) selected.
+>>select cast (cast (N'Hello        ' as nchar(13)) as nchar(5)) from dual;
 
 (EXPR)    
 ----------
 
 Hello     
-Hello     
 
---- 2 row(s) selected.
->>select cast (cast (N'Hello        ' as nchar(13)) as nchar varying(5)) from t022u;
+--- 1 row(s) selected.
+>>select cast (cast (N'Hello        ' as nchar(13)) as nchar varying(5)) from dual;
 
 (EXPR)    
 ----------
 
 Hello     
-Hello     
 
---- 2 row(s) selected.
->>select cast (cast (N'Hello, world!' as nchar(13)) as nchar(5)) from t022u;
+--- 1 row(s) selected.
+>>select cast (cast (N'Hello, world!' as nchar(13)) as nchar(5)) from dual;
 
 *** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
 
@@ -3622,12 +3505,8 @@
 
 Hello     
 
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello     
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello, world!' as nchar(13)) as nchar varying(5)) from t022u;
+--- 1 row(s) selected.
+>>select cast (cast (N'Hello, world!' as nchar(13)) as nchar varying(5)) from dual;
 
 *** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
 
@@ -3636,30 +3515,24 @@
 
 Hello     
 
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello     
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello        ' as nchar varying(13)) as nchar(5)) from t022u;
+--- 1 row(s) selected.
+>>select cast (cast (N'Hello        ' as nchar varying(13)) as nchar(5)) from dual;
 
 (EXPR)    
 ----------
 
 Hello     
-Hello     
 
---- 2 row(s) selected.
->>select cast (cast (N'Hello        ' as nchar varying(13)) as nchar varying(5)) from t022u;
+--- 1 row(s) selected.
+>>select cast (cast (N'Hello        ' as nchar varying(13)) as nchar varying(5)) from dual;
 
 (EXPR)    
 ----------
 
 Hello     
-Hello     
 
---- 2 row(s) selected.
->>select cast (cast (N'Hello, world!' as nchar varying(13)) as nchar(5)) from t022u;
+--- 1 row(s) selected.
+>>select cast (cast (N'Hello, world!' as nchar varying(13)) as nchar(5)) from dual;
 
 *** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
 
@@ -3668,12 +3541,8 @@
 
 Hello     
 
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello     
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello, world!' as nchar varying(13)) as nchar varying(5)) from t022u;
+--- 1 row(s) selected.
+>>select cast (cast (N'Hello, world!' as nchar varying(13)) as nchar varying(5)) from dual;
 
 *** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
 
@@ -3682,579 +3551,530 @@
 
 Hello     
 
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello     
-
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- tests on cast VAR/NCHAR to DATETIME
->>select cast (N'12.07.1961 03.04.55.123456' as timestamp) from t022u;
+>>select cast (N'12.07.1961 03.04.55.123456' as timestamp) from dual;
 
 (EXPR)                    
 --------------------------
 
 1961-07-12 03:04:55.123456
-1961-07-12 03:04:55.123456
 
---- 2 row(s) selected.
->>select cast (N'12.07.1961 03.04.55.123456' as timestamp(3)) from t022u;
+--- 1 row(s) selected.
+>>select cast (N'12.07.1961 03.04.55.123456' as timestamp(3)) from dual;
 
 (EXPR)                 
 -----------------------
 
 1961-07-12 03:04:55.123
-1961-07-12 03:04:55.123
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>select cast (cast (N'12.07.1961 03.04.55.123456' as timestamp) as DATE) 
-+>from t022u;
++>from dual;
 
 (EXPR)    
 ----------
 
 1961-07-12
-1961-07-12
 
---- 2 row(s) selected.
->>select cast (cast (N'12.07.1961 03.04.55.123456' as timestamp) as char(21)) from
-+>t022u;
+--- 1 row(s) selected.
+>>select cast (cast (N'12.07.1961 03.04.55.123456' as timestamp) as char(21)) from dual;
 
 (EXPR)               
 ---------------------
 
 1961-07-12 03:04:55.1
-1961-07-12 03:04:55.1
 
---- 2 row(s) selected.
->>select cast (N'12/13/1987' as date) from t022u;
+--- 1 row(s) selected.
+>>select cast (N'12/13/1987' as date) from dual;
 
 (EXPR)    
 ----------
 
 1987-12-13
-1987-12-13
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- some negative DATE, TIME, TIMESTAMP
 >>-- illegal european format
->>select cast (N'12.13.1987' as date) from t022u;
+>>select cast (N'12.13.1987' as date) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 12.13.1987
 
 --- 0 row(s) selected.
 >>
 >>-- illegal US format
->>select cast (N'13/12/1987' as date) from t022u;
+>>select cast (N'13/12/1987' as date) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 13/12/1987
 
 --- 0 row(s) selected.
 >>
 >>-- string overflow
->>select cast (cast (N'12/07/1961 03:04:55.123456' as timestamp) as char(18)) from
-+>t022u;
+>>select cast (cast (N'12/07/1961 03:04:55.123456' as timestamp) as char(18)) from dual;
 
 *** ERROR[8402] A string overflow occurred during the evaluation of a character expression.
 
 --- 0 row(s) selected.
 >>
 >>-- Feb. 32th doesn't exist
->>select cast(N'1997-02-32' as DATE) from t022u;
+>>select cast(N'1997-02-32' as DATE) from dual;
 
 *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 1997-02-32
 
 --- 0 row(s) selected.
 >>
 >>-- test on cast VAR/NCAR to smallint
->>select cast(N'2' as SMALLINT) from t022u;
+>>select cast(N'2' as SMALLINT) from dual;
 
 (EXPR)
 ------
 
      2
-     2
 
---- 2 row(s) selected.
->>select cast(N'-32768' as SMALLINT) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'-32768' as SMALLINT) from dual;
 
 (EXPR)
 ------
 
 -32768
--32768
 
---- 2 row(s) selected.
->>select cast(N'32767' as SMALLINT) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'32767' as SMALLINT) from dual;
 
 (EXPR)
 ------
 
  32767
- 32767
 
---- 2 row(s) selected.
->>select cast(N'0' as SMALLINT UNSIGNED) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'0' as SMALLINT UNSIGNED) from dual;
 
 (EXPR)
 ------
 
      0
-     0
 
---- 2 row(s) selected.
->>select cast(N'65535' as SMALLINT UNSIGNED) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'65535' as SMALLINT UNSIGNED) from dual;
 
 (EXPR)
 ------
 
  65535
- 65535
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- negative test on cast VAR/NCAR to smallint
->>select cast(N'-1' as SMALLINT UNSIGNED) from t022u;
+>>select cast(N'-1' as SMALLINT UNSIGNED) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,2 BYTES,ISO88591) Source Value:-1 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast(N'-32769' as SMALLINT) from t022u;
+>>select cast(N'-32769' as SMALLINT) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,6 BYTES,ISO88591) Source Value:-32769 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast(N'50000' as SMALLINT) from t022u;
+>>select cast(N'50000' as SMALLINT) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,5 BYTES,ISO88591) Source Value:50000 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
 
 --- 0 row(s) selected.
->>select cast(N'-32769' as SMALLINT UNSIGNED) from t022u;
+>>select cast(N'-32769' as SMALLINT UNSIGNED) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,6 BYTES,ISO88591) Source Value:-32769 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast(N'70000' as SMALLINT UNSIGNED) from t022u;
+>>select cast(N'70000' as SMALLINT UNSIGNED) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,5 BYTES,ISO88591) Source Value:70000 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast(N'70000' as SMALLINT UNSIGNED) from t022u;
+>>select cast(N'70000' as SMALLINT UNSIGNED) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,5 BYTES,ISO88591) Source Value:70000 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
 >>-- test on cast VAR/NCAR to bit precision integer(X) unsigned
->>select cast(N'1000' as bit precision integer(15) UNSIGNED) from t022u;
+>>select cast(N'1000' as bit precision integer(15) UNSIGNED) from dual;
 
 (EXPR)
 ------
 
   1000
-  1000
 
---- 2 row(s) selected.
->>select cast(N'0' as bit precision integer(15) UNSIGNED) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'0' as bit precision integer(15) UNSIGNED) from dual;
 
 (EXPR)
 ------
 
      0
-     0
 
---- 2 row(s) selected.
->>select cast(N'32767' as bit precision integer(15) UNSIGNED) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'32767' as bit precision integer(15) UNSIGNED) from dual;
 
 (EXPR)
 ------
 
  32767
- 32767
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- negative test on cast VAR/NCAR to bit precision integer(X) unsigned
->>select cast(N'32768' as bit precision integer(15) UNSIGNED) from t022u;
+>>select cast(N'32768' as bit precision integer(15) UNSIGNED) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:BIT PRECISION INTEGER(REC_BPINT_UNSIGNED) Source Value:32768 to Target Type:BIT PRECISION INTEGER(REC_BPINT_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast(N'-1' as bit precision integer(15) UNSIGNED) from t022u;
+>>select cast(N'-1' as bit precision integer(15) UNSIGNED) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,2 BYTES,ISO88591) Source Value:-1 to Target Type:BIT PRECISION INTEGER(REC_BPINT_UNSIGNED).
 
 --- 0 row(s) selected.
 >>
 >>-- test on cast VAR/NCAR to integer
->>select cast(N'4294967295' as integer unsigned) from t022u;
+>>select cast(N'4294967295' as integer unsigned) from dual;
 
 (EXPR)    
 ----------
 
 4294967295
-4294967295
 
---- 2 row(s) selected.
->>select cast(N'0' as integer unsigned) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'0' as integer unsigned) from dual;
 
 (EXPR)    
 ----------
 
          0
-         0
 
---- 2 row(s) selected.
->>select cast(N'2147483647' as integer) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'2147483647' as integer) from dual;
 
 (EXPR)     
 -----------
 
  2147483647
- 2147483647
 
---- 2 row(s) selected.
->>select cast(N'-2147483648' as integer) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'-2147483648' as integer) from dual;
 
 (EXPR)     
 -----------
 
 -2147483648
--2147483648
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- negative test on cast VAR/NCAR to integer
->>select cast(N'4294967296' as integer unsigned) from t022u;
+>>select cast(N'4294967296' as integer unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,10 BYTES,ISO88591) Source Value:4294967296 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast(N'-1' as integer unsigned) from t022u;
+>>select cast(N'-1' as integer unsigned) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,2 BYTES,ISO88591) Source Value:-1 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast(N'2147483648' as integer) from t022u;
+>>select cast(N'2147483648' as integer) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,10 BYTES,ISO88591) Source Value:2147483648 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast(N'-2147483649' as integer) from t022u;
+>>select cast(N'-2147483649' as integer) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,11 BYTES,ISO88591) Source Value:-2147483649 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
 >>
 >>-- test on cast VAR/NCAR to largeint
->>select cast(N'42949672960000' as largeint) from t022u;
+>>select cast(N'42949672960000' as largeint) from dual;
 
 (EXPR)              
 --------------------
 
       42949672960000
-      42949672960000
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- test on cast VAR/NCAR to DEC 
->>select cast(N'42949672960000' as DEC) from t022u;
+>>select cast(N'42949672960000' as DEC) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,14 BYTES,ISO88591) Source Value:42949672960000 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast(N'12345.56' as DEC (7,2) unsigned) from t022u;
+>>select cast(N'12345.56' as DEC (7,2) unsigned) from dual;
 
 (EXPR)  
 --------
 
 12345.56
-12345.56
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- negative test on cast VAR/NCAR to DEC 
->>select cast(N'1009a' as  DEC) from t022u;
+>>select cast(N'1009a' as  DEC) from dual;
 
 *** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 3130303961
 
 --- 0 row(s) selected.
 >>
->>?ifMX
->>?ifNT
 >>-- test on cast VAR/NCAR to float/real/double 
->>select cast(N'-107' as float) from t022u;
+>>select cast(N'-107' as float) from dual;
 
 (EXPR)                   
 -------------------------
 
 -1.07000000000000000E+002
--1.07000000000000000E+002
 
---- 2 row(s) selected.
->>select cast(N'1.2E-001' as real) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'1.2E-001' as real) from dual;
 
 (EXPR)         
 ---------------
 
  1.1999999E-001
- 1.1999999E-001
 
---- 2 row(s) selected.
->>select cast(N'12E-001' as double precision) from t022u;
+--- 1 row(s) selected.
+>>select cast(N'12E-001' as double precision) from dual;
 
 (EXPR)                   
 -------------------------
 
  1.20000000000000016E+000
- 1.20000000000000016E+000
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- negative test on cast VAR/NCAR to float/real/double 
->>select cast(N'this is not a number.' as float) from t022u;
+>>select cast(N'this is not a number.' as float) from dual;
 
 *** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 74686973206973206e6f742061206e756d6265722e
 
 --- 0 row(s) selected.
->>select cast(N'1023u' as real) from t022u;
+>>select cast(N'1023u' as real) from dual;
 
 *** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 3130323375
 
 --- 0 row(s) selected.
->>select cast(N'''\2' as double precision) from t022u;
+>>select cast(N'''\2' as double precision) from dual;
 
 *** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 275c32
 
 --- 0 row(s) selected.
->>?ifNT
->>?ifMX
 >>
 >>-- test on cast VAR/NCAR to interval 
->>select cast(N'-07' as interval year) from t022u;
+>>select cast(N'-07' as interval year) from dual;
 
 *** ERROR[8422] The provided INTERVAL is not valid and cannot be converted.
 
 --- 0 row(s) selected.
->>select cast(N'5' as interval year) from t022u;
+>>select cast(N'5' as interval year) from dual;
 
 (EXPR)
 ------
 
      5
-     5
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- test on cast smallint to VAR/NCAR 
->>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(10)) from t022u;
+>>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(10)) from dual;
 
 (EXPR)              
 --------------------
 
 65535               
-65535               
 
---- 2 row(s) selected.
->>select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR(10)) from t022u;
+--- 1 row(s) selected.
+>>select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR(10)) from dual;
 
 (EXPR)              
 --------------------
 
 -5535               
--5535               
 
---- 2 row(s) selected.
->>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(10)) from t022u;
+--- 1 row(s) selected.
+>>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(10)) from dual;
 
 (EXPR)              
 --------------------
 
 65535               
-65535               
 
---- 2 row(s) selected.
->>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR VARYING(10)) from t022u;
+--- 1 row(s) selected.
+>>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR VARYING(10)) from dual;
 
 (EXPR)              
 --------------------
 
 65535               
-65535               
 
---- 2 row(s) selected.
->>select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR VARYING(10)) from t022u;
+--- 1 row(s) selected.
+>>select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR VARYING(10)) from dual;
 
 (EXPR)              
 --------------------
 
 -5535               
--5535               
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- negative test on cast smallint to VAR/NCAR 
->>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(1)) from t022u;
+>>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(1)) from dual;
 
 *** ERROR[8402] A string overflow occurred during the evaluation of a character expression. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65535 to Target Type:CHAR(REC_BYTE_F_ASCII,1 BYTES,UTF8).
 
 --- 0 row(s) selected.
->>select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR VARYING(1)) from t022u;
+>>select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR VARYING(1)) from dual;
 
 *** ERROR[8402] A string overflow occurred during the evaluation of a character expression. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-5535 to Target Type:VARCHAR(REC_BYTE_V_ASCII,1 BYTES,UTF8).
 
 --- 0 row(s) selected.
 >>
 >>-- test on cast integer to VAR/NCAR 
->>select cast(cast(N'4294967295' as integer unsigned) as NCHAR VARYING(10)) from t022u;
+>>select cast(cast(N'4294967295' as integer unsigned) as NCHAR VARYING(10)) from dual;
 
 (EXPR)              
 --------------------
 
 4294967295          
-4294967295          
 
---- 2 row(s) selected.
->>select cast(cast(N'0' as integer unsigned) as NCHAR(2)) from t022u;
+--- 1 row(s) selected.
+>>select cast(cast(N'0' as integer unsigned) as NCHAR(2)) from dual;
 
 (EXPR)
 ------
 
 0     
-0     
 
---- 2 row(s) selected.
->>select cast(cast(N'2147483647' as integer) as NCHAR(12)) from t022u;
+--- 1 row(s) selected.
+>>select cast(cast(N'2147483647' as integer) as NCHAR(12)) from dual;
 
 (EXPR)                  
 ------------------------
 
 2147483647              
-2147483647              
 
---- 2 row(s) selected.
->>select cast(cast(N'-2147483648' as integer) as NCHAR(12)) from t022u;
+--- 1 row(s) selected.
+>>select cast(cast(N'-2147483648' as integer) as NCHAR(12)) from dual;
 
 (EXPR)                  
 ------------------------
 
 -2147483648             
--2147483648             
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- negative test on cast integer to VAR/NCAR
->>select cast(cast(N'4294967296' as integer unsigned) as nchar(1)) from t022u;
+>>select cast(cast(N'4294967296' as integer unsigned) as nchar(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,10 BYTES,ISO88591) Source Value:4294967296 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
 
 --- 0 row(s) selected.
->>select cast(cast(N'-10' as integer) as nchar(1)) from t022u;
+>>select cast(cast(N'-10' as integer) as nchar(1)) from dual;
 
 *** ERROR[8402] A string overflow occurred during the evaluation of a character expression. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:CHAR(REC_BYTE_F_ASCII,1 BYTES,UTF8).
 
 --- 0 row(s) selected.
->>select cast(cast(N'2147483648' as integer) as nchar varying(1)) from t022u;
+>>select cast(cast(N'2147483648' as integer) as nchar varying(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,10 BYTES,ISO88591) Source Value:2147483648 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
->>select cast(cast(N'-2147483649' as integer) as nchar(1)) from t022u;
+>>select cast(cast(N'-2147483649' as integer) as nchar(1)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,11 BYTES,ISO88591) Source Value:-2147483649 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
 
 --- 0 row(s) selected.
 >>
 >>-- test on cast DEC to VAR/NCAR 
->>select cast(cast(N'42949672960000' as DEC) as nchar(10)) from t022u;
+>>select cast(cast(N'42949672960000' as DEC) as nchar(10)) from dual;
 
 *** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,14 BYTES,ISO88591) Source Value:42949672960000 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
 
 --- 0 row(s) selected.
->>select cast(cast(N'12345.56' as DEC (7,2) unsigned) as nchar(20)) from t022u;
+>>select cast(cast(N'12345.56' as DEC (7,2) unsigned) as nchar(20)) from dual;
 
 (EXPR)                                  
 ----------------------------------------
 
 12345.56                                
-12345.56                                
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>
 >>-- "timestamp - timestamp" should return result in seconds
 >>select timestamp '2018-10-10 10:10:10' - timestamp '2017-10-10 10:10:10' from dual;
 
-(EXPR)       
--------------
+(EXPR)             
+-------------------
 
-     31536000
+           31536000
 
 --- 1 row(s) selected.
 >>
 >>-- negative test on cast DEC to VAR/NCAR 
->>select cast(cast(N'12345.56' as DEC (7,2) unsigned) as nchar(2)) from t022u;
+>>select cast(cast(N'12345.56' as DEC (7,2) unsigned) as nchar(2)) from dual;
 
 *** ERROR[8402] A string overflow occurred during the evaluation of a character expression. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:12345.56 to Target Type:CHAR(REC_BYTE_F_ASCII,2 BYTES,UTF8).
 
 --- 0 row(s) selected.
 >>
 >>-- test on cast date, time and timestamp to VAR/NCAR 
->>select cast(date '1998-03-02' as nchar varying(11)) from t022u;
+>>select cast(date '1998-03-02' as nchar varying(11)) from dual;
 
 (EXPR)                
 ----------------------
 
 1998-03-02            
-1998-03-02            
 
---- 2 row(s) selected.
->>select cast(date '1998-03-02' as nchar(11)) from t022u;
+--- 1 row(s) selected.
+>>select cast(date '1998-03-02' as nchar(11)) from dual;
 
 (EXPR)                
 ----------------------
 
 1998-03-02            
-1998-03-02            
 
---- 2 row(s) selected.
->>select cast(time '08:03:02' as nchar(11)) from t022u;
+--- 1 row(s) selected.
+>>select cast(time '08:03:02' as nchar(11)) from dual;
 
 (EXPR)                
 ----------------------
 
 08:03:02              
-08:03:02              
 
---- 2 row(s) selected.
->>select cast(time '08:03:02 pm' as nchar(11)) from t022u;
+--- 1 row(s) selected.
+>>select cast(time '08:03:02 pm' as nchar(11)) from dual;
 
 (EXPR)                
 ----------------------
 
 20:03:02              
-20:03:02              
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>select cast(timestamp 
-+>'1998-06-03 08:03:02.000000' as nchar varying(21)) from t022u;
++>'1998-06-03 08:03:02.000000' as nchar varying(21)) from dual;
 
 (EXPR)                                    
 ------------------------------------------
 
 1998-06-03 08:03:02.0                     
-1998-06-03 08:03:02.0                     
 
---- 2 row(s) selected.
->>select cast(timestamp '1998-06-03 08:03:02.000000' as nchar(21)) from t022u;
+--- 1 row(s) selected.
+>>select cast(timestamp '1998-06-03 08:03:02.000000' as nchar(21)) from dual;
 
 (EXPR)                                    
 ------------------------------------------
 
 1998-06-03 08:03:02.0                     
-1998-06-03 08:03:02.0                     
 
---- 2 row(s) selected.
+--- 1 row(s) selected.
 >>-- Genesis case-10-050208-6275
 >>-- Test on ascii to time
 >>
@@ -4271,13 +4091,13 @@
 (EXPR)         (EXPR)         (EXPR)                    
 -------------  -------------  --------------------------
 
-10:13:14.0000  10:13:14.0000  2017-04-19 20:56:28.350262
+10:13:14.0000  10:13:14.0000  2018-06-20 20:52:53.000980
 
 --- 1 row(s) selected.
 >>--test on precision of time
->>select cast('10:13:14' as time(7)),cast('10:13:14' as time(4));
+>>select cast('10:13:14' as time(10)),cast('10:13:14' as time(4)) from dual;
 
-*** ERROR[3134] The specified TIME or TIMESTAMP precision value, 7, cannot exceed 6.
+*** ERROR[3134] The specified TIME or TIMESTAMP precision value, 10, cannot exceed 9.
 
 *** ERROR[8822] The statement was not prepared.
 
@@ -4439,9 +4259,7 @@
 *** ERROR[8822] The statement was not prepared.
 
 >>-- not a char 
->>?ifMX
 >>
->>?ifMX
 >>-- New PCode comparison instructions for float32 and float64
 >>create table t022fltcmp(c0 char(23), c1 real not null, c2 float not null);
 
@@ -4607,8 +4425,6 @@
 
 --- 1 row(s) selected.
 >>
->>?ifMX
->>
 >>--to test comparison between shorter signed and longer unsigned
 >>--comparisons that involve implicit typecast of both operands
 >>--to signed int.
@@ -4771,4791 +4587,148 @@
 
 --- 1 row(s) selected.
 >>
->>-- done
->>log;
->>--Now we will run the same test again with PCODE CQD option 'OFF'
->>--to ensure PCODE and CLAUSE's evaluation are exactly similar.
->>Control Query Default PCODE_OPT_LEVEL 'OFF';
+>>-- tests for nanosecond precision for datetime and interval
+>>create table t022nanos(a timestamp(9), b time(9), c interval hour to second(9));
 
 --- SQL operation complete.
->>obey TEST022 (test);
->>-------------------------------------------------------------------------------
->>create table t022t1 (a int);
+>>invoke t022nanos;
+
+-- Definition of Trafodion table TRAFODION.SCH.T022NANOS
+-- Definition current  Wed Jun 20 20:53:22 2018
+
+  (
+    SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
+  , A                                TIMESTAMP(9) DEFAULT NULL
+  , B                                TIME(9) DEFAULT NULL
+  , C                                INTERVAL HOUR(2) TO SECOND(9) DEFAULT NULL
+  )
 
 --- SQL operation complete.
->>create table t022t2 (a int);
-
---- SQL operation complete.
->>create table t022t3 (a int unsigned);
-
---- SQL operation complete.
->>create table t022t4 (a smallint unsigned, b smallint);
-
---- SQL operation complete.
->>
->>insert into t022t1 values (1);
+>>insert into t022nanos values (timestamp '2018-01-01 10:10:10.123456789',
++>                              time '10:10:10.123456789',
++>                              interval '10:10:10.123456789' hour to second(9));
 
 --- 1 row(s) inserted.
->>insert into t022t2 values (1), (2);
-
---- 2 row(s) inserted.
->>insert into t022t3 values (4294967295), (3000000000);
-
---- 2 row(s) inserted.
->>insert into t022t4 values (65535, 32767);
-
---- 1 row(s) inserted.
->>
->>?ifMX
->>create table t022u (a int);
-
---- SQL operation complete.
->>insert into t022u values (1), (2);
-
---- 2 row(s) inserted.
->>create table t022a7 (c1 float(22), c2 float not null);
-
---- SQL operation complete.
->>?ifNT
->>-- The ifNT setting is also enabled when run on Linux platforms.
->>prepare insertIntoT022A7 from insert into t022a7 values (?,?);
+>>prepare s from insert into t022nanos values (?, ?, ?);
 
 --- SQL command prepared.
->>sh sh -c 'rm -f t022xxx > /dev/null 2>&1 ';
->>-- Must use "sh sh -c" if we want the command to work on NT platforms.
->>-- The space between t022xxx and the single quote (') is required by the SQLCI sh command.
->>-- If the space is not specified, the output is going into the file "t022xxx'" - Strange!
->>sh sh -c 'echo "begin work;"                                      > t022xxx ';
->>sh sh -c 'echo "execute insertIntoT022A7 using 0 , 1. ; "        >> t022xxx ';
->>sh sh -c 'echo "execute insertIntoT022A7 using 1 , 2.E3 ; "      >> t022xxx ';
->>sh sh -c 'echo "execute insertIntoT022A7 using 3 , 123.456E2 ; " >> t022xxx ';
->>sh sh -c 'echo "commit work;"                                    >> t022xxx ';
->>?ifNT
->>?ifNSK
->>sh echo 0 , 1.   > t022xxx;
->>sh echo 1 , 2.E3  >> t022xxx;
->>sh echo 3 , 123.456E2 >> t022xxx;
->>?ifNSK
->>?ifMX
+>>execute s using '2019-02-02 11:11:11.987654321', '01:01:01.112233445',
++>                 '02:02:02.111111111';
+
+--- 1 row(s) inserted.
+>>select * from t022nanos;
+
+A                              B                   C                  
+-----------------------------  ------------------  -------------------
+
+2018-01-01 10:10:10.123456789  10:10:10.123456789   10:10:10.123456789
+2019-02-02 11:11:11.987654321  01:01:01.112233445    2:02:02.111111111
+
+--- 2 row(s) selected.
+>>select a - a, b - b, c-c, c+c, a+c, a-c from t022nanos;
+
+(EXPR)                (EXPR)                (EXPR)                (EXPR)                (EXPR)                         (EXPR)
+--------------------  --------------------  --------------------  --------------------  -----------------------------  -----------------------------
+
+         0.000000000           0.000000000     0:00:00.000000000    20:20:20.246913578  2018-01-01 20:20:20.246913578  2018-01-01 00:00:00.000000000
+         0.000000000           0.000000000     0:00:00.000000000     4:04:04.222222222  2019-02-02 13:13:14.098765432  2019-02-02 09:09:09.876543210
+
+--- 2 row(s) selected.
+>>select cast(a as char(30)), cast(b as char(20)), cast(c as char(20)) from t022nanos;
+
+(EXPR)                          (EXPR)                (EXPR)
+------------------------------  --------------------  --------------------
+
+2018-01-01 10:10:10.123456789   10:10:10.123456789      10:10:10.123456789
+2019-02-02 11:11:11.987654321   01:01:01.112233445       2:02:02.111111111
+
+--- 2 row(s) selected.
+>>select * from t022nanos where a = timestamp '2018-01-01 10:10:10.123456789';
+
+A                              B                   C                  
+-----------------------------  ------------------  -------------------
+
+2018-01-01 10:10:10.123456789  10:10:10.123456789   10:10:10.123456789
+
+--- 1 row(s) selected.
+>>select * from t022nanos where a = timestamp '2018-01-01 10:10:10.123456788';
+
+--- 0 row(s) selected.
 >>
->>-- Positive cases to test the limits of each data type.
->>
->>select cast (-9 as numeric(1)) from t022t1;
-
-(EXPR)
-------
-
-    -9
-
---- 1 row(s) selected.
->>select cast (9 as numeric(1)) from t022t1;
-
-(EXPR)
-------
-
-     9
-
---- 1 row(s) selected.
->>select cast (-9999 as numeric(4)) from t022t1;
-
-(EXPR)
-------
-
- -9999
-
---- 1 row(s) selected.
->>select cast (9999 as numeric(4)) from t022t1;
-
-(EXPR)
-------
-
-  9999
-
---- 1 row(s) selected.
->>select cast (-32768 as smallint) from t022t1;
-
-(EXPR)
-------
-
--32768
-
---- 1 row(s) selected.
->>select cast (32767 as smallint) from t022t1;
-
-(EXPR)
-------
-
- 32767
-
---- 1 row(s) selected.
->>
->>select cast (0 as numeric(1) unsigned) from t022t1;
-
-(EXPR)
-------
-
-     0
-
---- 1 row(s) selected.
->>select cast (9 as numeric(1) unsigned) from t022t1;
-
-(EXPR)
-------
-
-     9
-
---- 1 row(s) selected.
->>select cast (0 as numeric(4) unsigned) from t022t1;
-
-(EXPR)
-------
-
-     0
-
---- 1 row(s) selected.
->>select cast (9999 as numeric(4) unsigned) from t022t1;
-
-(EXPR)
-------
-
-  9999
-
---- 1 row(s) selected.
->>select cast (0 as smallint unsigned) from t022t1;
-
-(EXPR)
-------
-
-     0
-
---- 1 row(s) selected.
->>select cast (65535 as smallint unsigned) from t022t1;
-
-(EXPR)
-------
-
- 65535
-
---- 1 row(s) selected.
->>
->>select cast (-99999 as numeric(5)) from t022t1;
-
-(EXPR)     
------------
-
-     -99999
-
---- 1 row(s) selected.
->>select cast (99999 as numeric(5)) from t022t1;
-
-(EXPR)     
------------
-
-      99999
-
---- 1 row(s) selected.
->>select cast (-999999999 as numeric(9)) from t022t1;
-
-(EXPR)     
------------
-
- -999999999
-
---- 1 row(s) selected.
->>select cast (999999999 as numeric(9)) from t022t1;
-
-(EXPR)     
------------
-
-  999999999
-
---- 1 row(s) selected.
->>select cast (-2147483648 as int) from t022t1;
-
-(EXPR)     
------------
-
--2147483648
-
---- 1 row(s) selected.
->>select cast (2147483647 as int) from t022t1;
-
-(EXPR)     
------------
-
- 2147483647
-
---- 1 row(s) selected.
->>
->>select cast (0 as numeric(5) unsigned) from t022t1;
-
-(EXPR)    
-----------
-
-         0
-
---- 1 row(s) selected.
->>select cast (99999 as numeric(5) unsigned) from t022t1;
-
-(EXPR)    
-----------
-
-     99999
-
---- 1 row(s) selected.
->>select cast (0 as numeric(9) unsigned) from t022t1;
-
-(EXPR)    
-----------
-
-         0
-
---- 1 row(s) selected.
->>select cast (999999999 as numeric(9) unsigned) from t022t1;
-
-(EXPR)    
-----------
-
- 999999999
-
---- 1 row(s) selected.
->>select cast (0 as int unsigned) from t022t1;
-
-(EXPR)    
-----------
-
-         0
-
---- 1 row(s) selected.
->>select cast (4294967295 as int unsigned) from t022t1;
-
-(EXPR)    
-----------
-
-4294967295
-
---- 1 row(s) selected.
->>
->>select cast (-9999999999 as numeric(10)) from t022t1;
-
-(EXPR)              
---------------------
-
-         -9999999999
-
---- 1 row(s) selected.
->>select cast (9999999999 as numeric(10)) from t022t1;
-
-(EXPR)              
---------------------
-
-          9999999999
-
---- 1 row(s) selected.
->>select cast (-999999999999999999 as numeric(18)) from t022t1;
-
-(EXPR)              
---------------------
-
- -999999999999999999
-
---- 1 row(s) selected.
->>select cast (999999999999999999 as numeric(18)) from t022t1;
-
-(EXPR)              
---------------------
-
-  999999999999999999
-
---- 1 row(s) selected.
->>select cast (-9223372036854775808 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
--9223372036854775808
-
---- 1 row(s) selected.
->>select cast (9223372036854775807 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
- 9223372036854775807
-
---- 1 row(s) selected.
->>
->>select cast (-9 as decimal(1)) from t022t1;
-
-(EXPR)
-------
-
-    -9
-
---- 1 row(s) selected.
->>select cast (9 as decimal(1)) from t022t1;
-
-(EXPR)
-------
-
-     9
-
---- 1 row(s) selected.
->>select cast (-999999999999999999 as decimal(18)) from t022t1;
-
-(EXPR)             
--------------------
-
--999999999999999999
-
---- 1 row(s) selected.
->>select cast (999999999999999999 as decimal(18)) from t022t1;
-
-(EXPR)             
--------------------
-
- 999999999999999999
-
---- 1 row(s) selected.
->>
->>select cast (0 as decimal(1) unsigned) from t022t1;
-
-(EXPR)
-------
-
-     0
-
---- 1 row(s) selected.
->>select cast (9 as decimal(1) unsigned) from t022t1;
-
-(EXPR)
-------
-
-     9
-
---- 1 row(s) selected.
->>select cast (0 as decimal(9) unsigned) from t022t1;
-
-(EXPR)   
----------
-
-        0
-
---- 1 row(s) selected.
->>select cast (999999999 as decimal(9) unsigned) from t022t1;
-
-(EXPR)   
----------
-
-999999999
-
---- 1 row(s) selected.
->>
->>select cast (10 as tinyint) from t022t1;
-
-(EXPR)
-------
-
-    10
-
---- 1 row(s) selected.
->>select cast (-10 as tinyint) from t022t1;
-
-(EXPR)
-------
-
-   -10
-
---- 1 row(s) selected.
->>select cast (127 as tinyint) from t022t1;
-
-(EXPR)
-------
-
-   127
-
---- 1 row(s) selected.
->>select cast (-128 as tinyint) from t022t1;
-
-(EXPR)
-------
-
-  -128
-
---- 1 row(s) selected.
->>select cast (10 as tinyint unsigned) from t022t1;
-
-(EXPR)
-------
-
-    10
-
---- 1 row(s) selected.
->>select cast (0 as tinyint unsigned) from t022t1;
-
-(EXPR)
-------
-
-     0
-
---- 1 row(s) selected.
->>select cast (255 as tinyint unsigned) from t022t1;
-
-(EXPR)
-------
-
-   255
-
---- 1 row(s) selected.
->>
->>select cast (date'12/31/9999' as timestamp(3)) from t022t1;
-
-(EXPR)                 
------------------------
-
-9999-12-31 00:00:00.000
-
---- 1 row(s) selected.
->>select cast (timestamp'12/31/9999 11:59:59.999999 pm' as date) from t022t1;
-
-(EXPR)    
-----------
-
-9999-12-31
-
---- 1 row(s) selected.
->>select cast (timestamp'12/31/9999 11:59:59.999999 pm' as time(3)) from t022t1;
-
-(EXPR)      
-------------
-
-23:59:59.999
-
---- 1 row(s) selected.
->>
->>select interval'0.1'second + timestamp'12/31/9998 11:59:59.9 pm' from t022t1;
-
-(EXPR)               
----------------------
-
-9999-01-01 00:00:00.0
-
---- 1 row(s) selected.
->>select timestamp'12/31/9998 11:59:59.9 pm' + interval'0.1'second from t022t1;
-
-(EXPR)               
----------------------
-
-9999-01-01 00:00:00.0
-
---- 1 row(s) selected.
->>select timestamp'01/01/9999 00:00:00.0' + interval-'0.1'second from t022t1;
-
-(EXPR)               
----------------------
-
-9998-12-31 23:59:59.9
-
---- 1 row(s) selected.
->>select timestamp'01/01/9999 00:00:00.0' - interval'0.1'second from t022t1;
-
-(EXPR)               
----------------------
-
-9998-12-31 23:59:59.9
-
---- 1 row(s) selected.
->>select (date'12/31/9999' - date'12/31/9998') day(3) from t022t1;
-
-(EXPR)
-------
-
-   365
-
---- 1 row(s) selected.
->>select (date'12/31/9998' - date'12/31/9999') day(3) from t022t1;
-
-(EXPR)
-------
-
-  -365
-
---- 1 row(s) selected.
->>
->>select interval'1'month + timestamp'12/31/9998 11:59:59.999 pm' from t022t1;
-
-(EXPR)                 
------------------------
-
-9999-01-31 23:59:59.999
-
---- 1 row(s) selected.
->>select timestamp'12/31/9998 11:59:59.999 pm' + interval'1'month from t022t1;
-
-(EXPR)                 
------------------------
-
-9999-01-31 23:59:59.999
-
---- 1 row(s) selected.
->>select timestamp'01/31/9999 11:59:59.999 pm' + interval-'1'month from t022t1;
-
-(EXPR)                 
------------------------
-
-9998-12-31 23:59:59.999
-
---- 1 row(s) selected.
->>select timestamp'01/31/9999 11:59:59.999 pm' - interval'1'month from t022t1;
-
-(EXPR)                 
------------------------
-
-9998-12-31 23:59:59.999
-
---- 1 row(s) selected.
->>select (date'12/31/9999' - date'12/31/9998') month from t022t1;
-
-*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL MONTH(2).
-
-*** ERROR[8822] The statement was not prepared.
-
->>select (date'12/31/9998' - date'12/31/9999') month from t022t1;
-
-*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL MONTH(2).
-
-*** ERROR[8822] The statement was not prepared.
-
->>select (date'12/31/9999' - date'12/31/9998') year to month from t022t1;
-
-*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL YEAR(2) TO MONTH.
-
-*** ERROR[8822] The statement was not prepared.
-
->>select (date'12/31/9998' - date'12/31/9999') year to month from t022t1;
-
-*** ERROR[4035] Type INTERVAL DAY(12) cannot be cast to type INTERVAL YEAR(2) TO MONTH.
-
-*** ERROR[8822] The statement was not prepared.
-
->>
->>select interval'1'second + time'11:59:59 pm' from t022t1;
-
-(EXPR)  
---------
-
-00:00:00
-
---- 1 row(s) selected.
->>select time'11:59:59 pm' + interval'1'second from t022t1;
-
-(EXPR)  
---------
-
-00:00:00
-
---- 1 row(s) selected.
->>select time'12:00:00 am' + interval-'1'second from t022t1;
-
-(EXPR)  
---------
-
-23:59:59
-
---- 1 row(s) selected.
->>select time'12:00:00 am' - interval'1'second from t022t1;
-
-(EXPR)  
---------
-
-23:59:59
-
---- 1 row(s) selected.
->>
->>select timestamp '2015-05-31T10:11:12' from t022t1;
-
-(EXPR)             
--------------------
-
-2015-05-31 10:11:12
-
---- 1 row(s) selected.
->>select timestamp '2015-05-31T10:11:12Z' from t022t1;
-
-(EXPR)             
--------------------
-
-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.
->>
->>select cast('2010-01-01' as timestamp(3)) from t022t1;
-
-(EXPR)                 
------------------------
-
-2010-01-01 00:00:00.000
-
---- 1 row(s) selected.
->>select cast('2010-01-01 10' as timestamp) from t022t1;
-
-(EXPR)                    
---------------------------
-
-2010-01-01 10:00:00.000000
-
---- 1 row(s) selected.
->>
->>create table if not exists t022dtime(a date not null, b time, c timestamp);
+>>drop table if exists hive.hive.thivets;
 
 --- SQL operation complete.
->>prepare s from upsert into t022dtime values (?, ?, ?);
-
---- SQL command prepared.
->>execute s using '2010-01-01', '10:10:10', '2010-01-01 10:10:10.123';
-
---- 1 row(s) inserted.
->>select * from t022dtime;
-
-A           B         C                         
-----------  --------  --------------------------
-
-2010-01-01  10:10:10  2010-01-01 10:10:10.123000
-
---- 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. Source data: 2016-01-29Z
-
---- 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. Source data: 2016-01-29+05:00
-
---- 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. Source data: 10:11:12-05:000
-
---- 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. Source data: 23:11:61
-
---- 0 row(s) selected.
->>select cast ('23:11:06' as timestamp) from t022t1;
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 23:11:06
-
---- 0 row(s) selected.
->>select cast('2010-01-01' as time) from t022t1;
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 2010-01-01
-
---- 0 row(s) selected.
->>select timestamp'2010-01-01 10' from t022t1;
-
-*** ERROR[3047] The timestamp '2010-01-01 10' is not valid.
-
-*** ERROR[8822] The statement was not prepared.
-
->>
->>-- Prove these cases work since they're used in the succeeding negative tests.
->>
->>select cast (cast (-10 as smallint) as numeric(2)) from t022t1;
-
-(EXPR)
-------
-
-   -10
-
---- 1 row(s) selected.
->>select cast (cast (10 as smallint) as numeric(2)) from t022t1;
-
-(EXPR)
-------
-
-    10
-
---- 1 row(s) selected.
->>select cast (cast (-10 as numeric(2)) as smallint) from t022t1;
-
-(EXPR)
-------
-
-   -10
-
---- 1 row(s) selected.
->>select cast (cast (10 as numeric(2)) as smallint) from t022t1;
-
-(EXPR)
-------
-
-    10
-
---- 1 row(s) selected.
->>select cast (-1 as smallint) from t022t1;
-
-(EXPR)
-------
-
-    -1
-
---- 1 row(s) selected.
->>
->>select cast (32768 as smallint unsigned) from t022t1;
-
-(EXPR)
-------
-
- 32768
-
---- 1 row(s) selected.
->>select cast (10 as smallint unsigned) from t022t1;
-
-(EXPR)
-------
-
-    10
-
---- 1 row(s) selected.
->>
->>select cast (-32769 as int) from t022t1;
-
-(EXPR)     
------------
-
-     -32769
-
---- 1 row(s) selected.
->>select cast (32768 as int) from t022t1;
-
-(EXPR)     
------------
-
-      32768
-
---- 1 row(s) selected.
->>select cast (-10 as int) from t022t1;
-
-(EXPR)     
------------
-
-        -10
-
---- 1 row(s) selected.
->>select cast (10 as int) from t022t1;
-
-(EXPR)     
------------
-
-         10
-
---- 1 row(s) selected.
->>select cast (-1 as int) from t022t1;
-
-(EXPR)     
------------
-
-         -1
-
---- 1 row(s) selected.
->>select cast (65536 as int) from t022t1;
-
-(EXPR)     
------------
-
-      65536
-
---- 1 row(s) selected.
->>select cast (-100000 as int) from t022t1;
-
-(EXPR)     
------------
-
-    -100000
-
---- 1 row(s) selected.
->>select cast (100000 as int) from t022t1;
-
-(EXPR)     
------------
-
-     100000
-
---- 1 row(s) selected.
->>
->>select cast (32768 as int unsigned) from t022t1;
-
-(EXPR)    
-----------
-
-     32768
-
---- 1 row(s) selected.
->>select cast (10 as int unsigned) from t022t1;
-
-(EXPR)    
-----------
-
-        10
-
---- 1 row(s) selected.
->>select cast (65536 as int unsigned) from t022t1;
-
-(EXPR)    
-----------
-
-     65536
-
---- 1 row(s) selected.
->>select cast (2147483648 as int unsigned) from t022t1;
-
-(EXPR)    
-----------
-
-2147483648
-
---- 1 row(s) selected.
->>select cast (100000 as int unsigned) from t022t1;
-
-(EXPR)    
-----------
-
-    100000
-
---- 1 row(s) selected.
->>
->>select cast (-32769 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-              -32769
-
---- 1 row(s) selected.
->>select cast (32768 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-               32768
-
---- 1 row(s) selected.
->>select cast (-10 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-                 -10
-
---- 1 row(s) selected.
->>select cast (10 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-                  10
-
---- 1 row(s) selected.
->>select cast (-1 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-                  -1
-
---- 1 row(s) selected.
->>select cast (65536 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-               65536
-
---- 1 row(s) selected.
->>select cast (-2147483649 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-         -2147483649
-
---- 1 row(s) selected.
->>select cast (2147483648 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-          2147483648
-
---- 1 row(s) selected.
->>select cast (-100000 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-             -100000
-
---- 1 row(s) selected.
->>select cast (100000 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-              100000
-
---- 1 row(s) selected.
->>select cast (4294967296 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-          4294967296
-
---- 1 row(s) selected.
->>select cast (-10000000000 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-        -10000000000
-
---- 1 row(s) selected.
->>select cast (10000000000 as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-         10000000000
-
---- 1 row(s) selected.
->>
->>select cast (-32769 as decimal(5)) from t022t1;
-
-(EXPR)
-------
-
--32769
-
---- 1 row(s) selected.
->>select cast (32768 as decimal(5)) from t022t1;
-
-(EXPR)
-------
-
- 32768
-
---- 1 row(s) selected.
->>select cast (-10 as decimal(2)) from t022t1;
-
-(EXPR)
-------
-
-   -10
-
---- 1 row(s) selected.
->>select cast (10 as decimal(2)) from t022t1;
-
-(EXPR)
-------
-
-    10
-
---- 1 row(s) selected.
->>select cast (-1 as decimal(1)) from t022t1;
-
-(EXPR)
-------
-
-    -1
-
---- 1 row(s) selected.
->>select cast (65536 as decimal(5)) from t022t1;
-
-(EXPR)
-------
-
- 65536
-
---- 1 row(s) selected.
->>select cast (-2147483649 as decimal(10)) from t022t1;
-
-(EXPR)     
------------
-
--2147483649
-
---- 1 row(s) selected.
->>select cast (2147483648 as decimal(10)) from t022t1;
-
-(EXPR)     
------------
-
- 2147483648
-
---- 1 row(s) selected.
->>select cast (-100000 as decimal(6)) from t022t1;
-
-(EXPR) 
--------
-
--100000
-
---- 1 row(s) selected.
->>select cast (100000 as decimal(6)) from t022t1;
-
-(EXPR) 
--------
-
- 100000
-
---- 1 row(s) selected.
->>select cast (4294967296 as decimal(10)) from t022t1;
-
-(EXPR)     
------------
-
- 4294967296
-
---- 1 row(s) selected.
->>select cast (-10000000000 as decimal(11)) from t022t1;
-
-(EXPR)      
-------------
-
--10000000000
-
---- 1 row(s) selected.
->>select cast (10000000000 as decimal(11)) from t022t1;
-
-(EXPR)      
-------------
-
- 10000000000
-
---- 1 row(s) selected.
->>
->>select cast (32768 as decimal(5) unsigned) from t022t1;
-
-(EXPR)
-------
-
- 32768
-
---- 1 row(s) selected.
->>select cast (10 as decimal(2) unsigned) from t022t1;
-
-(EXPR)
-------
-
-    10
-
---- 1 row(s) selected.
->>select cast (65536 as decimal(5) unsigned) from t022t1;
-
-(EXPR)
-------
-
- 65536
-
---- 1 row(s) selected.
->>select cast (100000 as decimal(6) unsigned) from t022t1;
-
-(EXPR)
-------
-
-100000
-
---- 1 row(s) selected.
->>
->>select cast (-32769 as real) from t022t1;
-
-(EXPR)         
----------------
-
--3.2769000E+004
-
---- 1 row(s) selected.
->>select cast (32768 as real) from t022t1;
-
-(EXPR)         
----------------
-
- 3.2768000E+004
-
---- 1 row(s) selected.
->>select cast (-10 as real) from t022t1;
-
-(EXPR)         
----------------
-
--1.0000000E+001
-
---- 1 row(s) selected.
->>select cast (10 as real) from t022t1;
-
-(EXPR)         
----------------
-
- 1.0000000E+001
-
---- 1 row(s) selected.
->>select cast (-1 as real) from t022t1;
-
-(EXPR)         
----------------
-
--1.0000000E+000
-
---- 1 row(s) selected.
->>select cast (65536 as real) from t022t1;
-
-(EXPR)         
----------------
-
- 6.5536000E+004
-
---- 1 row(s) selected.
->>select cast (-2147483649 as real) from t022t1;
-
-(EXPR)         
----------------
-
--2.1474836E+009
-
---- 1 row(s) selected.
->>select cast (9999999999 as real) from t022t1;
-
-(EXPR)         
----------------
-
- 1.0000000E+010
-
---- 1 row(s) selected.
->>select cast (-100000 as real) from t022t1;
-
-(EXPR)         
----------------
-
--1.0000000E+005
-
---- 1 row(s) selected.
->>select cast (100000 as real) from t022t1;
-
-(EXPR)         
----------------
-
- 1.0000000E+005
-
---- 1 row(s) selected.
->>select cast (9999999999 as real) from t022t1;
-
-(EXPR)         
----------------
-
- 1.0000000E+010
-
---- 1 row(s) selected.
->>
->>select cast (-32769 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
--3.27690000000000064E+004
-
---- 1 row(s) selected.
->>select cast (32768 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
- 3.27680000000000000E+004
-
---- 1 row(s) selected.
->>select cast (-10 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
--1.00000000000000000E+001
-
---- 1 row(s) selected.
->>select cast (10 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
- 1.00000000000000000E+001
-
---- 1 row(s) selected.
->>select cast (-1 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
--1.00000000000000000E+000
-
---- 1 row(s) selected.
->>select cast (65536 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
- 6.55360000000000000E+004
-
---- 1 row(s) selected.
->>select cast (-2147483649 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
--2.14748364900000032E+009
-
---- 1 row(s) selected.
->>select cast (2147483648 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
- 2.14748364800000000E+009
-
---- 1 row(s) selected.
->>select cast (-100000 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
--1.00000000000000000E+005
-
---- 1 row(s) selected.
->>select cast (100000 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
- 1.00000000000000000E+005
-
---- 1 row(s) selected.
->>select cast (4294967296 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
- 4.29496729600000000E+009
-
---- 1 row(s) selected.
->>
->>select cast ('Hello, world!' as char(13)) from t022t2;
-
-(EXPR)       
--------------
-
-Hello, world!
-Hello, world!
-
---- 2 row(s) selected.
->>select cast ('Hello, world!' as varchar(13)) from t022t2;
-
-(EXPR)       
--------------
-
-Hello, world!
-Hello, world!
-
---- 2 row(s) selected.
->>select cast (cast ('Hello        ' as char(13)) as char(5)) from t022t2;
-
-(EXPR)
-------
-
-Hello 
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast ('Hello        ' as char(13)) as varchar(5)) from t022t2;
-
-(EXPR)
-------
-
-Hello 
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast ('Hello, world!' as char(13)) as char(5)) from t022t2;
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-(EXPR)
-------
-
-Hello 
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast ('Hello, world!' as char(13)) as varchar(5)) from t022t2;
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-(EXPR)
-------
-
-Hello 
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast ('Hello        ' as varchar(13)) as char(5)) from t022t2;
-
-(EXPR)
-------
-
-Hello 
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast ('Hello        ' as varchar(13)) as varchar(5)) from t022t2;
-
-(EXPR)
-------
-
-Hello 
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast ('Hello, world!' as varchar(13)) as char(5)) from t022t2;
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-(EXPR)
-------
-
-Hello 
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast ('Hello, world!' as varchar(13)) as varchar(5)) from t022t2;
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-(EXPR)
-------
-
-Hello 
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello 
-
---- 2 row(s) selected.
->>select cast (cast (-2147483649 as double precision) as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-         -2147483649
-
---- 1 row(s) selected.
->>select cast (cast (2147483648 as double precision) as largeint) from t022t1;
-
-(EXPR)              
---------------------
-
-          2147483648
-
---- 1 row(s) selected.
->>
->>-- Positive cases to test division.
->>
->>select cast (1 as numeric(1)) / cast (1 as numeric(1)) from t022t1;
-
-(EXPR) 
--------
-
-    1.0
-
---- 1 row(s) selected.
->>select cast (1 as numeric(5)) / cast (1 as numeric(1)) from t022t1;
-
-(EXPR)      
-------------
-
-         1.0
-
---- 1 row(s) selected.
->>select cast (1 as numeric(1)) / cast (1 as numeric(5)) from t022t1;
-
-(EXPR)      
-------------
-
-     1.00000
-
---- 1 row(s) selected.
->>select cast (1 as numeric(5)) / cast (1 as numeric(5)) from t022t1;
-
-(EXPR)               
----------------------
-
-              1.00000
-
---- 1 row(s) selected.
->>select cast (1 as numeric(10)) / cast (1 as numeric(10)) from t022t1;
-
-(EXPR)               
----------------------
-
-           1.00000000
-
---- 1 row(s) selected.
->>
->>select cast (1 as numeric(1) unsigned) /
-+>       cast (1 as numeric(1) unsigned) from t022t1;
-
-(EXPR)
-------
-
-   1.0
-
---- 1 row(s) selected.
->>select cast (1 as numeric(5) unsigned) /
-+>       cast (1 as numeric(1) unsigned) from t022t1;
-
-(EXPR)     
------------
-
-        1.0
-
---- 1 row(s) selected.
->>select cast (1 as numeric(1) unsigned) /
-+>       cast (1 as numeric(5) unsigned) from t022t1;
-
-(EXPR)     
------------
-
-    1.00000
-
---- 1 row(s) selected.
->>select cast (1 as numeric(5) unsigned) /
-+>       cast (1 as numeric(5) unsigned) from t022t1;
-
-(EXPR)               
----------------------
-
-              1.00000
-
---- 1 row(s) selected.
->>select cast (1 as numeric(9) unsigned) /
-+>       cast (1 as numeric(9) unsigned) from t022t1;
-
-(EXPR)               
----------------------
-
-          1.000000000
-
---- 1 row(s) selected.
->>
->>select cast (1 as double precision) / cast (1 as double precision) from t022t1;
-
-(EXPR)                   
--------------------------
-
- 1.00000000000000000E+000
-
---- 1 row(s) selected.
->>
->>-- Negative tests.
->>
->>select cast (cast (-10 as smallint) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:SMALLINT SIGNED(REC_BIN16_SIGNED) Source Value:-10 to Target Type:TINYINT SIGNED(REC_BIN8_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as smallint) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:SMALLINT SIGNED(REC_BIN16_SIGNED) Source Value:10 to Target Type:TINYINT SIGNED(REC_BIN8_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-10 as numeric(2)) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:TINYINT SIGNED(REC_BIN8_SIGNED) Source Value:-10 to Target Type:TINYINT SIGNED(REC_BIN8_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as numeric(2)) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:TINYINT SIGNED(REC_BIN8_SIGNED) Source Value:10 to Target Type:TINYINT SIGNED(REC_BIN8_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as smallint) as smallint unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (10 as smallint) as numeric(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:SMALLINT SIGNED(REC_BIN16_SIGNED) Source Value:10 to Target Type:TINYINT UNSIGNED(REC_BIN8_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as smallint) as int unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (-10 as smallint) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (10 as smallint) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as smallint) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (10 as smallint) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>select cast (cast (32768 as smallint unsigned) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED) Source Value:32768 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as smallint unsigned) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED) Source Value:10 to Target Type:TINYINT SIGNED(REC_BIN8_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as smallint unsigned) as numeric(1)unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED) Source Value:10 to Target Type:TINYINT UNSIGNED(REC_BIN8_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as smallint unsigned) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (10 as smallint unsigned) as decimal(1)unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>select cast (cast (-32769 as int) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:-32769 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (32768 as int) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:32768 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-10 as int) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:-10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as int) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as int) as smallint unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (65536 as int) as smallint unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as int) as numeric(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-100000 as int) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:-100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as int) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as int) as int unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (100000 as int) as numeric(5) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER SIGNED(REC_BIN32_SIGNED) Source Value:100000 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-10 as int) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (10 as int) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as int) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (10 as int) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>select cast (cast (32768 as int unsigned) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED) Source Value:32768 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as int unsigned) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (65536 as int unsigned) as smallint unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as int unsigned) as numeric(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (2147483648 as int unsigned) as int) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED) Source Value:2147483648 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as int unsigned) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED) Source Value:100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as int unsigned) as numeric(5) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED) Source Value:100000 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as int unsigned) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (10 as int unsigned) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>select cast (cast (-32769 as largeint) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-32769 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (32768 as largeint) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:32768 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-10 as largeint) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as largeint) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as largeint) as smallint unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (65536 as largeint) as smallint unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as largeint) as numeric(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-2147483649 as largeint) as int) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-2147483649 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (2147483648 as largeint) as int) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:2147483648 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-100000 as largeint) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as largeint) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as largeint) as int unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (4294967296 as largeint) as int unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:4294967296 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as largeint) as numeric(5) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-10000000000 as largeint) as numeric(10)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10000000000 to Target Type:LARGEINT(REC_BIN64_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10000000000 as largeint) as numeric(10)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10000000000 to Target Type:LARGEINT(REC_BIN64_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as largeint) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as largeint) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (10 as largeint) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>select cast (cast (-32769 as decimal(5)) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-32769 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (32768 as decimal(5)) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:32768 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-10 as decimal(2)) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as decimal(2)) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as decimal(1)) as smallint unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (65536 as decimal(5)) as smallint unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as decimal(2)) as numeric(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-2147483649 as decimal(10)) as int) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-2147483649 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (2147483648 as decimal(10)) as int) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:2147483648 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-100000 as decimal(6)) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as decimal(6)) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as decimal(1)) as int unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (4294967296 as decimal(10)) as int unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:4294967296 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as decimal(6)) as numeric(5) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-10000000000 as decimal(11)) as numeric(10)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10000000000 to Target Type:LARGEINT(REC_BIN64_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10000000000 as decimal(11)) as numeric(10)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10000000000 to Target Type:LARGEINT(REC_BIN64_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as decimal(2)) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as decimal(1)) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (10 as decimal(2)) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>select cast (cast (32768 as decimal(5) unsigned) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:32768 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as decimal(2) unsigned) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (65536 as decimal(5) unsigned) as smallint unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65536 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as decimal(2) unsigned) as numeric(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as decimal(6) unsigned) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as decimal(6) unsigned) as numeric(5) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as decimal(2) unsigned) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (10 as decimal(2) unsigned) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:10 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>select cast (cast (-32769 as real) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:-3.2769000E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (32768 as real) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:3.2768000E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-10 as real) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:0.0000000E+000 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as real) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-044 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as real) as smallint unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (65536 as real) as smallint unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:6.5536000E+004 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as real) as numeric(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-044 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-2147484160 as real) as int) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:-2.1474841E+009 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (9999999999 as real) as int) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+010 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-100000 as real) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:0.0000000E+000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as real) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-040 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as real) as int unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (9999999999 as real) as int unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+010 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as real) as numeric(5) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.4012984E-040 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as real) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+001 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as real) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:-1.0000000E+000 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as real) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE FLOAT(REC_IEEE_FLOAT32) Source Value:1.0000000E+001 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>select cast (cast (-32769 as double precision) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:-3.27690000000000064E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (32768 as double precision) as smallint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:3.27680000000000000E+004 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-10 as double precision) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:0.00000000000000000E+000 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as double precision) as numeric(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246592E-323 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as double precision) as smallint unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (65536 as double precision) as smallint unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:6.55360000000000000E+004 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as double precision) as numeric(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246592E-323 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-2147483649 as double precision) as int) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:-2.14748364900000032E+009 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (2147483648 as double precision) as int) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:2.14748364800000000E+009 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-100000 as double precision) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:0.00000000000000000E+000 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as double precision) as numeric(5)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246528E-319 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as double precision) as int unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>select cast (cast (4294967296 as double precision) as int unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.29496729600000000E+009 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (100000 as double precision) as numeric(5) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:4.94065645841246528E-319 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as double precision) as decimal(1)) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:1.00000000000000000E+001 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast (cast (-1 as double precision) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:-1.00000000000000000E+000 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast (cast (10 as double precision) as decimal(1) unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:IEEE DOUBLE PRECISION(REC_IEEE_FLOAT64) Source Value:1.00000000000000000E+001 to Target Type:DECIMAL UNSIGNED(REC_DECIMAL_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>-- negative tests for tinyint
->>select cast(-129 as tinyint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:SMALLINT SIGNED(REC_BIN16_SIGNED) Source Value:-129 to Target Type:TINYINT SIGNED(REC_BIN8_SIGNED).
-
---- 0 row(s) selected.
->>select cast(128 as tinyint) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:SMALLINT SIGNED(REC_BIN16_SIGNED) Source Value:128 to Target Type:TINYINT SIGNED(REC_BIN8_SIGNED).
-
---- 0 row(s) selected.
->>select cast(256 as tinyint unsigned) from t022t1;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:SMALLINT SIGNED(REC_BIN16_SIGNED) Source Value:256 to Target Type:TINYINT UNSIGNED(REC_BIN8_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast(-1 as tinyint unsigned) from t022t1;
-
-*** ERROR[8432] A negative value cannot be converted to an unsigned numeric datatype.
-
---- 0 row(s) selected.
->>
->>-- tests for DATE, TIME, TIMESTAMP
->>select cast ('12.07.1961 03.04.55.123456' as timestamp) from t022t2;
-
-(EXPR)                    
---------------------------
-
-1961-07-12 03:04:55.123456
-1961-07-12 03:04:55.123456
-
---- 2 row(s) selected.
->>select cast ('12.07.1961 03.04.55.123456' as timestamp(3)) from t022t2;
-
-(EXPR)                 
------------------------
-
-1961-07-12 03:04:55.123
-1961-07-12 03:04:55.123
-
---- 2 row(s) selected.
->>select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as DATE) from t022t2;
-
-(EXPR)    
-----------
-
-1961-07-12
-1961-07-12
-
---- 2 row(s) selected.
->>select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as char(21)) from t022t2;
-
-(EXPR)               
----------------------
-
-1961-07-12 03:04:55.1
-1961-07-12 03:04:55.1
-
---- 2 row(s) selected.
->>select cast ('12/13/1987' as date) from t022t2;
-
-(EXPR)    
-----------
-
-1987-12-13
-1987-12-13
-
---- 2 row(s) selected.
->>
->>-- some negative DATE, TIME, TIMESTAMP
->>-- illegal european format
->>select cast ('12.13.1987' as date) from t022t2;
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 12.13.1987
-
---- 0 row(s) selected.
->>
->>-- illegal US format
->>select cast ('13/12/1987' as date) from t022t2;
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 13/12/1987
-
---- 0 row(s) selected.
->>
->>-- string overflow
->>select cast (cast ('12.07.1961 03:04:55.123456' as timestamp) as char(18)) from t022t2;
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 12.07.1961 03:04:55.123456
-
---- 0 row(s) selected.
->>
->>-- Feb. 30th doesn't exist
->>select cast('1997-30-02' as DATE) from t022t2;
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 1997-30-02
-
---- 0 row(s) selected.
->>
->>select interval'0.1'second + timestamp'12/31/9999 11:59:59.9 pm' from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>select timestamp'12/31/9999 11:59:59.9 pm' + interval'0.1'second from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>select timestamp'01/01/0001 00:00:00.0' + interval-'0.1'second from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>select timestamp'01/01/0001 00:00:00.0' - interval'0.1'second from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>
->>select interval'1'month + date'12/31/9999' from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>select date'12/31/9999' + interval'1'month from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>select date'01/01/0001' + interval-'1'month from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>select date'01/01/0001' - interval'1'month from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>
->>select interval'1'month + date'01/31/9999' from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>select date'01/31/9999' + interval'1'month from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>select date'03/30/9999' + interval-'1'month from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>select date'03/30/9999' - interval'1'month from t022t1;
-
-*** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
-
---- 0 row(s) selected.
->>
->>-- Negative cases to test division by zero.
->>
->>select cast (1 as numeric(1)) / cast (0 as numeric(1)) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>select cast (1 as numeric(5)) / cast (0 as numeric(1)) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>select cast (1 as numeric(1)) / cast (0 as numeric(5)) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>select cast (1 as numeric(5)) / cast (0 as numeric(5)) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>select cast (1 as numeric(10)) / cast (0 as numeric(10)) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>
->>select cast (1 as numeric(1) unsigned) /
-+>       cast (0 as numeric(1) unsigned) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>select cast (1 as numeric(5) unsigned) /
-+>       cast (0 as numeric(1) unsigned) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>select cast (1 as numeric(1) unsigned) /
-+>       cast (0 as numeric(5) unsigned) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>select cast (1 as numeric(5) unsigned) /
-+>       cast (0 as numeric(5) unsigned) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>select cast (1 as numeric(9) unsigned) /
-+>       cast (0 as numeric(9) unsigned) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>
->>select cast (1 as double precision) / cast (0 as double precision) from t022t1;
-
-*** ERROR[8419] An arithmetic expression attempted a division by zero.
-
---- 0 row(s) selected.
->>
->>-- results:  1 row selected
->>select cast('66.2' as float) from t022t1 where cast('66.2' as float) = 66.2;
-
-(EXPR)                   
--------------------------
-
- 6.62000000000000128E+001
-
---- 1 row(s) selected.
->>
->>-- to test comparisons between signed and unsigned numbers.
->>
->>select * from t022t3 where 2147483647 < a;
-
-A         
-----------
-
-4294967295
-3000000000
-
---- 2 row(s) selected.
->>select * from t022t3 where 2147483647 <= a;
-
-A         
-----------
-
-4294967295
-3000000000
-
---- 2 row(s) selected.
->>select * from t022t3 where a < 2147483647;
-
---- 0 row(s) selected.
->>select * from t022t3 where a <= 2147483647;
-
---- 0 row(s) selected.
->>select * from t022t3 where a < 0;
-
---- 0 row(s) selected.
->>select * from t022t3 where a <= 0;
-
---- 0 row(s) selected.
->>select * from t022t3 where -1 > a;
-
---- 0 row(s) selected.
->>select * from t022t3 where a > 0;
-
-A         
-----------
-
-4294967295
-3000000000
-
---- 2 row(s) selected.
->>select * from t022t3 where a >= 2147483647;
-
-A         
-----------
-
-4294967295
-3000000000
-
---- 2 row(s) selected.
->>select * from t022t3 where 2147483647 >= a;
-
---- 0 row(s) selected.
->>select * from t022t3 where a >= 32767;
-
-A         
-----------
-
-4294967295
-3000000000
-
---- 2 row(s) selected.
->>
->>select * from t022t4 where b < 3000000000;
-
-A      B     
------  ------
-
-65535   32767
-
---- 1 row(s) selected.
->>select * from t022t4 where b <= 3000000000;
-
-A      B     
------  ------
-
-65535   32767
-
---- 1 row(s) selected.
->>select * from t022t4 where b > 3000000000;
-
---- 0 row(s) selected.
->>select * from t022t4 where b >= 3000000000;
-
---- 0 row(s) selected.
->>
->>
->>-- negative test cases
->>-- The next three tests get different results depending on whether they
->>-- are run using SQL/MX or SQL/MP tables.  Run them separately 
->>?ifMP
->>create table t022t5 (t022t5_c1 numeric( 9) unsigned,
-+>                     t022t5_c2 numeric(10) unsigned);
->>create table t022t6 (t022t6_c1 decimal( 9) unsigned,
-+>                     t022t6_c2 decimal(10) unsigned);
->>create table t022t7 (t022t7_c1 dec    ( 9) unsigned,
-+>                     t022t7_c2 dec    (10) unsigned);
->>?ifMP
->>
->>?ifMX
->>create table t022t5 (t022t5_c1 numeric( 9) unsigned,
-+>                     t022t5_c2 numeric(10) unsigned);
+>>create table hive.hive.thivets (a timestamp);
 
 --- SQL operation complete.
->>create table t022t6 (t022t6_c1 decimal( 9) unsigned,
-+>                     t022t6_c2 decimal(10) unsigned);
+>>insert into hive.hive.thivets values (timestamp '2018-01-01 10:10:10.123456789');
 
-*** ERROR[3008] Precision of DECIMAL UNSIGNED data type, 10, cannot exceed 9.
+--- 1 row(s) inserted.
+>>select * from hive.hive.thivets;
 
-*** ERROR[8822] The statement was not prepared.
+A                            
+-----------------------------
 
->>create table t022t7 (t022t7_c1 dec    ( 9) unsigned,
-+>                     t022t7_c2 dec    (10) unsigned);
-
-*** ERROR[3008] Precision of DECIMAL UNSIGNED data type, 10, cannot exceed 9.
-
-*** ERROR[8822] The statement was not prepared.
-
->>?ifMX
->>
->>select cast(1 as numeric(10) unsigned) from (values(0))x;
-
-(EXPR)              
---------------------
-
-                   1
+2018-01-01 10:10:10.123456789
 
 --- 1 row(s) selected.
->>select cast(1 as decimal(10) unsigned) from (values(0))x;
+>>select * from hive.hive.thivets where a = timestamp '2018-01-01 10:10:10.123456788' + interval '0.000000001' second (1,9);
 
-*** ERROR[3008] Precision of DECIMAL UNSIGNED data type, 10, cannot exceed 9.
+A                            
+-----------------------------
 
-*** ERROR[8822] The statement was not prepared.
+2018-01-01 10:10:10.123456789
 
->>select cast(1 as dec    (10) unsigned) from (values(0))x;
+--- 1 row(s) selected.
+>>
+>>select extract(second from a), extract(second from b), extract(second from c)
++>  from t022nanos;
 
-*** ERROR[3008] Precision of DECIMAL UNSIGNED data type, 10, cannot exceed 9.
+(EXPR)                 (EXPR)                 (EXPR)               
+---------------------  ---------------------  ---------------------
+
+         10.123456789           10.123456789             .088598805
+         11.987654321            1.112233445             .000505799
+
+--- 2 row(s) selected.
+>>
+>>
+>>-- ERROR CASES
+>>
+>>-- total precision exceeds Int64 max.
+>>create table t022interr(a interval second(12, 9));
+
+*** ERROR[3044] The interval SECOND(12,9) is not valid.
 
 *** ERROR[8822] The statement was not prepared.
 
 >>
+>>select timestamp '9999-01-01 10:10:10.123456789' - timestamp '2018-01-01 10:10:10.123456' from dual;
+
+*** ERROR[8453] This expression results in an invalid interval value '251856000000000000789'
+
+--- 0 row(s) selected.
+>>select timestamp '2100-01-01 10:10:10.123456789' - timestamp '2018-01-01 10:10:10.123456' from dual;
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTERVAL SECOND(REC_INT_SECOND) Source Value:0x150362F83F49E923 to Target Type:INTERVAL SECOND(REC_INT_SECOND).
+
+--- 0 row(s) selected.
 >>
->>-- time/timestamp AM/PM tests (test convDoIt with timestamps)
->>create table t022t8 (c1 timestamp, c2 time);
+>>-- invalid timestamp, time, interval values
+>>execute s using '2019-02-02 11:11:11.98765432115', '01:01:01.1122334455',
++>                 '02:02:02.1111111115';
 
---- SQL operation complete.
->>
->>set param ?p '12/05/1998 03:15:08.123456 pm';
->>insert into t022t8 (c1) values ( ?p );
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 2019-02-02 11:11:11.98765432115
 
---- 1 row(s) inserted.
->>
->>set param ?p '2015-05-31T14:15:16Z';
->>insert into t022t8 (c1) values ( ?p );
+*** ERROR[15015] PARAM ?(UNNAMED_1) (value 2019-02-02 11:11:11.98765432115) cannot be converted to type TIMESTAMP(9).
 
---- 1 row(s) inserted.
->>
->>set param ?p '2015-05-31T14:15:16';
->>insert into t022t8 (c1) values ( ?p );
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 01:01:01.1122334455
 
---- 1 row(s) inserted.
->>
->>set param ?p '2100-01-01:00:00:47.250000';
->>insert into t022t8 (c1) values ( ?p );
+*** ERROR[15015] PARAM ?(UNNAMED_2) (value 01:01:01.1122334455) cannot be converted to type TIME(9).
 
---- 1 row(s) inserted.
->>
->>set param ?p '12/05/1998 10:15:08.889 pm';
->>insert into t022t8 (c1) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '06/28/1998 03:15:08 pm';
->>insert into t022t8 (c1) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '02/10/1998 12:15:08.123456 am';
->>insert into t022t8 (c1) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '12/05/1998 03:15:08.123456 am';
->>insert into t022t8 (c1) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '12/05/1998 03:15:08.123456';
->>insert into t022t8 (c1) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>-- expect error since 15 hours and am don't match
->>set param ?p '11/20/1997 15:15:08.123456 am';
->>insert into t022t8 (c1) values ( ?p );
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 11/20/1997 15:15:08.123456 am
-
-*** ERROR[15015] PARAM ?p (value 11/20/1997 15:15:08.123456 am) cannot be converted to type TIMESTAMP(6).
+*** ERROR[15015] PARAM ?(UNNAMED_3) (value 02:02:02.1111111115) cannot be converted to type INTERVAL HOUR(2) TO SECOND(9).
 
 --- 0 row(s) inserted.
 >>
->>-- expect an error
->>set param ?p '2100-01-01:ab:00:47.250000';
->>insert into t022t8 (c1) values ( ?p );
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 61623a30303a34372e323530303030
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 2100-01-01:ab:00:47.250000
-
-*** ERROR[15015] PARAM ?p (value 2100-01-01:ab:00:47.250000) cannot be converted to type TIMESTAMP(6).
-
---- 0 row(s) inserted.
->>
->>-- expect error since the date is not in US format
->>set param ?p '1998-03-12 03:15:08.123456 pm';
->>insert into t022t8 (c1) values ( ?p );
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 1998-03-12 03:15:08.123456 pm
-
-*** ERROR[15015] PARAM ?p (value 1998-03-12 03:15:08.123456 pm) cannot be converted to type TIMESTAMP(6).
-
---- 0 row(s) inserted.
->>
->>-- expect error since the date is not in US format
->>set param ?p '1996-05-23 16:15:08.123 am';
->>insert into t022t8 (c1) values ( ?p );
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 1996-05-23 16:15:08.123 am
-
-*** ERROR[15015] PARAM ?p (value 1996-05-23 16:15:08.123 am) cannot be converted to type TIMESTAMP(6).
-
---- 0 row(s) inserted.
->>
->>select c1 from t022t8;
-
-C1                        
---------------------------
-
-1998-12-05 15:15:08.123456
-2015-05-31 14:15:16.000000
-2015-05-31 14:15:16.000000
-2100-01-01 00:00:47.250000
-1998-12-05 22:15:08.889000
-1998-06-28 15:15:08.000000
-1998-02-10 00:15:08.123456
-1998-12-05 03:15:08.123456
-1998-12-05 03:15:08.123456
-
---- 9 row(s) selected.
->>
->>-- test convDoIt with time
->>set param ?p '03:15:08 pm';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '11:15:08 pm';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '10:15:08 am';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '12:59:59 am';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '10:05:59 am';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '09:00:00 am';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '11:00:00 am';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '08:00:00';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>set param ?p '00:01:00';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>-- expect error
->>set param ?p '00:a1:00';
->>insert into t022t8 (c2) values ( ?p );
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 61313a3030
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 00:a1:00
-
-*** ERROR[15015] PARAM ?p (value 00:a1:00) cannot be converted to type TIME(0).
-
---- 0 row(s) inserted.
->>
->>-- expect error since 14 and am don't match
->>set param ?p '14:59:59 am';
->>insert into t022t8 (c2) values ( ?p );
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 14:59:59 am
-
-*** ERROR[15015] PARAM ?p (value 14:59:59 am) cannot be converted to type TIME(0).
-
---- 0 row(s) inserted.
->>
->>-- expect error 
->>set param ?p '11:60:59 am';
->>insert into t022t8 (c2) values ( ?p );
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 11:60:59 am
-
-*** ERROR[15015] PARAM ?p (value 11:60:59 am) cannot be converted to type TIME(0).
-
---- 0 row(s) inserted.
->>
->>-- expect error
->>set param ?p '11:03:33';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>-- expect an error
->>set param ?p '00:01:00.03';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>-- expect an error
->>set param ?p '10:36:52.0781 pm';
->>insert into t022t8 (c2) values ( ?p );
-
---- 1 row(s) inserted.
->>
->>select c2 from t022t8;
-
-C2      
---------
-
-?       
-?       
-?       
-?       
-?       
-?       
-?       
-?       
-?       
-15:15:08
-23:15:08
-10:15:08
-00:59:59
-10:05:59
-09:00:00
-11:00:00
-08:00:00
-00:01:00
-11:03:33
-00:01:00
-22:36:52
-
---- 21 row(s) selected.
->>
->>-- test type casting involving the ordering of digits and other symbols 
->>-- like - . +
->>
->>-- positive cases 
->>select cast('-.3' as int), cast ('+1.4' as int) , cast('-32.3' as int) 
-+>      from t022t8;
-
-(EXPR)       (EXPR)       (EXPR)     
------------  -----------  -----------
-
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-          0            1          -32
-
---- 21 row(s) selected.
->>select c1 from t022t8 where cast('-.3' as int) < 1 and cast('+1.5' as int) <2;
-
-C1                        
---------------------------
-
-1998-12-05 15:15:08.123456
-2015-05-31 14:15:16.000000
-2015-05-31 14:15:16.000000
-2100-01-01 00:00:47.250000
-1998-12-05 22:15:08.889000
-1998-06-28 15:15:08.000000
-1998-02-10 00:15:08.123456
-1998-12-05 03:15:08.123456
-1998-12-05 03:15:08.123456
-?                         
-?                         
-?                         
-?                         
-?                         
-?                         
-?                         
-?                         
-?                         
-?                         
-?                         
-?                         
-
---- 21 row(s) selected.
->>
->>select cast ('123.' as real) ,
-+>       cast ('123.12' as real),
-+>       cast ('123.E2' as real),
-+>       cast ('123.12E2' as real)from (values(1)) as T;
-
-(EXPR)           (EXPR)           (EXPR)           (EXPR)         
----------------  ---------------  ---------------  ---------------
-
- 1.2300000E+002   1.2312000E+002   1.2300000E+004   1.2312000E+004
-
---- 1 row(s) selected.
->>?ifNT
->>obey t022xxx;
->>begin work;
-
---- SQL operation complete.
->>execute insertIntoT022A7 using 0 , 1. ;
-
---- 1 row(s) inserted.
->>execute insertIntoT022A7 using 1 , 2.E3 ;
-
---- 1 row(s) inserted.
->>execute insertIntoT022A7 using 3 , 123.456E2 ;
-
---- 1 row(s) inserted.
->>commit work;
-
---- SQL operation complete.
->>select * from $$TEST_SCHEMA$$.t022a7;
-
-C1                         C2                       
--------------------------  -------------------------
-
- 0.00000000000000000E+000   1.00000000000000000E+000
- 1.00000000000000000E+000   2.00000000000000000E+003
- 3.00000000000000000E+000   1.23456000000000016E+004
-
---- 3 row(s) selected.
->>?ifNT
->>?ifNSK
->>?ifMX
->>sh $mxcidir/import $$TEST_SCHEMA$$.t022a7 -I t022xxx;
->>select * from $$TEST_SCHEMA$$.t022a7;
->>?ifMX
->>?ifNSK
->>
->>-- negative cases (expect errors)
->>select cast('.-2' as int) from t022t8;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 2e2d32
-
---- 0 row(s) selected.
->>select cast('.+3' as int) from t022t8;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 2e2b33
-
---- 0 row(s) selected.
->>select cast('.4-' as numeric(4)) from t022t8;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 2e342d
-
---- 0 row(s) selected.
->>select cast('-. 3' as int) from t022t8;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 2e2033
-
---- 0 row(s) selected.
->>select cast('-3 . ' as int) from t022t8;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 33202e20
-
---- 0 row(s) selected.
->>
->>select c1 from t022t8 where cast('.-2' as int) < 1000;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 2e2d32
-
---- 0 row(s) selected.
->>select c1 from t022t8 where cast('.+3' as int) < 1000;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 2e2b33
-
---- 0 row(s) selected.
->>select c1 from t022t8 where cast('.4-' as numeric(4)) < 1;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 2e342d
-
---- 0 row(s) selected.
->>select c1 from t022t8 where cast('-. 3' as int) < 1;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 2e2033
-
---- 0 row(s) selected.
->>select c1 from t022t8 where cast('-3 .' as int) < 1;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 33202e
-
---- 0 row(s) selected.
->>
->>select cast ('123..' as real) from (values(1)) as T;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 3132332e2e
-
---- 0 row(s) selected.
->>select cast ('123..12' as real)from (values(1)) as T;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 3132332e2e3132
-
---- 0 row(s) selected.
->>
->>-- Testing solution 10-030707-7648
->>-- Catch overflow while manipulating interval internal type (decimal)
->>?ifMX
->>create table t022t9 (h10s4 interval hour(10) to second(4));
-
---- SQL operation complete.
->>insert into t022t9 values (-interval '1111111111:12:00.1234'
-+>   hour(10) to second(4));
-
---- 1 row(s) inserted.
->>insert into t022t9 values (interval '1111111111:12:00.1234'
-+>   hour(10) to second(4));
-
---- 1 row(s) inserted.
->>?ifMX
->>?ifMP
->>create table t022t9 (h10s4 interval hour(10) to fraction(4));
->>insert into t022t9 values (-interval '1111111111:12:00.1234'
-+>   hour(10) to fraction(4));
->>insert into t022t9 values (interval '1111111111:12:00.1234'
-+>   hour(10) to fraction(4));
->>?ifMP
->>
->>-- Should not overflow.
->>update t022t9 set h10s4 = h10s4 * 1;
-
---- 2 row(s) updated.
->>select * from t022t9;
-
-H10S4                 
-----------------------
-
--1111111111:12:00.1234
- 1111111111:12:00.1234
-
---- 2 row(s) selected.
->>
->>update t022t9 set h10s4 = h10s4 * 1.0;
-
---- 2 row(s) updated.
->>
->>select * from t022t9;
-
-H10S4                 
-----------------------
-
--1111111111:12:00.1234
- 1111111111:12:00.1234
-
---- 2 row(s) selected.
->>
->>-- Should overflow.
->>update t022t9 set h10s4 = h10s4 * 10;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTERVAL HOUR TO SECOND(REC_INT_HOUR_SECOND) Source Value:0xCC87EF871EEA72FA to Target Type:INTERVAL HOUR TO SECOND(REC_INT_HOUR_SECOND).
-
---- 0 row(s) updated.
->>
->>select * from t022t9;
-
-H10S4                 
-----------------------
-
--1111111111:12:00.1234
- 1111111111:12:00.1234
-
---- 2 row(s) selected.
->>
->>-- End of testing solution 10-030707-7648
->>
->>-- Numeric to interval converion overflow checking
->>?ifMX
->>create table t022ta(a interval second not null primary key);
-
---- SQL operation complete.
->>insert into t022ta values (interval '12.200' second(2,3));
-
---- 1 row(s) inserted.
->>insert into t022ta values (interval '12.300' second(2,4));
-
---- 1 row(s) inserted.
->>
->>select cast (10 + 90 as interval hour(3)) from t022ta;
-
-(EXPR)
-------
-
-   100
-   100
-
---- 2 row(s) selected.
->>select cast (10 + 89 as interval hour) from t022ta;
-
-(EXPR)
-------
-
-    99
-    99
-
---- 2 row(s) selected.
->>select cast (10 + 89 as interval second) from t022ta;
-
-(EXPR)    
-----------
-
- 99.000000
- 99.000000
-
---- 2 row(s) selected.
->>-- should overflow
->>select cast (10 + 90 as interval second) from t022ta;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000000 to Target Type:INTERVAL SECOND(REC_INT_SECOND).
-
---- 0 row(s) selected.
->>-- should overflow
->>select cast (100 as interval second) from t022ta;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:100000000 to Target Type:INTERVAL SECOND(REC_INT_SECOND).
-
---- 0 row(s) selected.
->>select cast (99 as interval second) from t022ta where a < interval '12.3' second;
-
-(EXPR)    
-----------
-
- 99.000000
-
---- 1 row(s) selected.
->>
->>create table t022tb(a integer);
-
---- SQL operation complete.
->>insert into t022tb values (10);
-
---- 1 row(s) inserted.
->>
->>select cast (a + 89 as interval second) from t022tb;
-
-(EXPR)    
-----------
-
- 99.000000
-
---- 1 row(s) selected.
->>-- should overflow
->>select cast (a + 100.0 as interval second) from t022tb;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:11000000.0 to Target Type:INTERVAL SECOND(REC_INT_SECOND).
-
---- 0 row(s) selected.
->>select cast (a + 100.00 as interval second(3)) from t022tb;
-
-(EXPR)     
------------
-
- 110.000000
-
---- 1 row(s) selected.
->>select cast (a + 100.00 as interval second(3,1)) from t022tb;
-
-(EXPR)
-------
-
- 110.0
-
---- 1 row(s) selected.
->>select cast (a + 100.00 as interval second(3,2)) from t022tb;
-
-(EXPR) 
--------
-
- 110.00
-
---- 1 row(s) selected.
->>select cast (a + 100.00 as interval second(3,3)) from t022tb;
-
-(EXPR)  
---------
-
- 110.000
-
---- 1 row(s) selected.
->>select time '11:58:59.236' + interval '1.12' second from t022tb;
-
-(EXPR)      
-------------
-
-11:59:00.356
-
---- 1 row(s) selected.
->>
->>select a*1 from (values (interval '10.0' second)) x(a);
-
-(EXPR)     
------------
-
-  10.000000
-
---- 1 row(s) selected.
->>select cast (a as numeric (2)) from (values(interval '12.00' second)) t(a);
-
-(EXPR)
-------
-
-    12
-
---- 1 row(s) selected.
->>select cast (a as numeric (18)) from (values(interval '12.00' second)) t(a);
-
-(EXPR)              
---------------------
-
-                  12
-
---- 1 row(s) selected.
->>-- should overflow
->>select cast (a as numeric (1)) from (values(interval '12.00' second)) t(a);
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTERVAL SECOND(REC_INT_SECOND) Source Value:0x0C000000 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>-- should overflow
->>select cast (a as numeric (19)) from (values(interval '12.00' second)) t(a);
-
-(EXPR)              
---------------------
-
-                  12
-
---- 1 row(s) selected.
->>
->>-- End of numeric to interval convertion overflow checking
->>
->>-- Testing for ALM bug 4419 (Feb 2012) 
->>--  - overflow check with mismatched fractional precision
->>create table t022th(inter interval hour to second not null primary key);
-
---- SQL operation complete.
->>insert into t022th values(interval '001:23:45' hour(3) to second);
-
---- 1 row(s) inserted.
->> -- OK
->>insert into t022th values(interval '901:23:45' hour(3) to second);
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTERVAL HOUR TO SECOND(REC_INT_HOUR_SECOND) Source Value:0x40FA8F8AF3020000 to Target Type:INTERVAL HOUR TO SECOND(REC_INT_HOUR_SECOND).
-
---- 0 row(s) inserted.
->>insert into t022th values(interval '90123:45' minute(5) to second(3));
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTERVAL MINUTE TO SECOND(REC_INT_MINUTE_SECOND) Source Value:0x4072A503EB040000 to Target Type:INTERVAL HOUR TO SECOND(REC_INT_HOUR_SECOND).
-
---- 0 row(s) inserted.
->>
->>create table t022ti(inter interval hour(3) to second(3) not null primary key);
-
---- SQL operation complete.
->>insert into t022ti values(interval '90123:45' minute(5) to second(6));
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:INTERVAL MINUTE TO SECOND(REC_INT_MINUTE_SECOND) Source Value:0xE8C14E4201000000 to Target Type:INTERVAL HOUR TO SECOND(REC_INT_HOUR_SECOND).
-
---- 0 row(s) inserted.
->>
->>-- End of ALM bug 4419
->>
->>-- Testing for solution 10-040302-3733
->>
->>-- RG: Build FCS040225, Select interval_second_col * 0.02 gets numeric overflow.
->>
->>create table t022tc (ivsc interval second);
-
---- SQL operation complete.
->>insert into t022tc values (interval '12' second);
-
---- 1 row(s) inserted.
->>
->>---  This select should get 0.1440 second.
->>
->>select ivsc * 0.02 from t022tc;
-
-(EXPR)     
------------
-
-   0.240000
-
---- 1 row(s) selected.
->>
->>?ifMX
->>?ifMX
->>create table t022td (D_to_F      INTERVAL    DAY TO SECOND(3));
-
---- SQL operation complete.
->>insert into t022td values (interval '18 15:17:02.123' day to second(3));
-
---- 1 row(s) inserted.
->>insert into t022td values (interval '27 04:57:58.999' day to second(3));
-
---- 1 row(s) inserted.
->>?ifMX
->>?ifMP
->>create table t022td (D_to_F      INTERVAL    DAY TO FRACTION(3));
->>insert into t022td values (interval '18 15:17:02.123' day to fraction(3));
->>insert into t022td values (interval '27 04:57:58.999' day to fraction(3));
->>?ifMP
->>select D_to_F / 1  from t022td;
-
-(EXPR)          
-----------------
-
- 18 15:17:02.123
- 27 04:57:58.999
-
---- 2 row(s) selected.
->>
->>-- End of testing solution 10-040302-3733
->>
->>-- Testing Solution 10-040226-3566
->>--RG:0218 'select cast from integer to interval second'got numeric overflow
->>
->>create table t022te (inum integer, dnum numeric (8,6));
-
---- SQL operation complete.
->>insert into t022te values (99, 23.123456);
-
---- 1 row(s) inserted.
->>
->>-- should not overflow
->>?ifMX
->>select CAST (dnum as INTERVAL second) from t022te;
-
-(EXPR)    
-----------
-
- 23.123456
-
---- 1 row(s) selected.
->>?ifMX
->>?ifMP
->>select CAST (dnum as INTERVAL second TO fraction) from t022te;
->>?ifMP
->>
->>?ifMX
->>create table t022tf (
-+>    ivyr interval year (4),
-+>    ivmt interval month,
-+>    ivdy interval day,
-+>    ivhr interval hour,
-+>    ivmn interval minute,
-+>    ivsc interval second (2,6)
-+>    );
-
---- SQL operation complete.
->>insert into t022tf values (         -- normal values
-+>    interval '2000' year (4),
-+>    interval '10' month,
-+>    interval '2' day,
-+>    interval '15' hour,
-+>    interval '60' minute,
-+>    interval '12' second
-+>    );
-
---- 1 row(s) inserted.
->>
->>-- should not overflow
->>select ivsc, ivsc * 0.02 from t022tf;
-
-IVSC        (EXPR)     
-----------  -----------
-
- 12.000000     0.240000
-
---- 1 row(s) selected.
->>
->>-- should not overflow
->>update t022tf set ivyr = ivyr * 1.5;
-
---- 1 row(s) updated.
->>
->>select * from t022tf;
-
-IVYR   IVMT  IVDY  IVHR  IVMN  IVSC      
------  ----  ----  ----  ----  ----------
-
- 3000    10     2    15    60   12.000000
-
---- 1 row(s) selected.
->>
->>delete from t022tf;
-
---- 1 row(s) deleted.
->>
->>insert into t022tf values (         -- min values
-+>    interval '0' year,
-+>    interval '0' month,
-+>    interval '0' day,
-+>    interval '0' hour,
-+>    interval '0' minute,
-+>    interval '0' second
-+>    );
-
---- 1 row(s) inserted.
->>
->>-- should not overflow
->>update t022tf set
-+>    IVYR = IVYR + interval '25' year,
-+>    IVMT = IVMT + interval '18' month,
-+>    IVDY = IVDY + interval '40' day,
-+>    IVHR = IVHR + interval '24' hour,
-+>    IVMN = IVMN + interval '60' minute,
-+>    IVSC = IVSC + interval '3.99' second;
-
---- 1 row(s) updated.
->>
->>select * from t022tf;
-
-IVYR   IVMT  IVDY  IVHR  IVMN  IVSC      
------  ----  ----  ----  ----  ----------
-
-   25    18    40    24    60    3.990000
-
---- 1 row(s) selected.
->>
->>?ifMX
->>-- End of testing Solution 10-040226-3566
->>
->>-- negative tests on casts between CHAR/NCHAR 
->>?ifMX
->>select cast (N'Hello, world!' as char(13)) from t022u;
-
-(EXPR)                    
---------------------------
-
-Hello, world!             
-Hello, world!             
-
---- 2 row(s) selected.
->>select cast (N'Hello, world!' as varchar(13)) from t022u;
-
-(EXPR)                    
---------------------------
-
-Hello, world!             
-Hello, world!             
-
---- 2 row(s) selected.
->>select cast ('Hello, world!' as nchar(13)) from t022u;
-
-(EXPR)                    
---------------------------
-
-Hello, world!             
-Hello, world!             
-
---- 2 row(s) selected.
->>select cast ('Hello, world!' as nchar varying(13)) from t022u;
-
-(EXPR)                    
---------------------------
-
-Hello, world!             
-Hello, world!             
-
---- 2 row(s) selected.
->>
->>-- tests on cast VAR/NCHAR to VAR/NCHAR
->>select cast (N'Hello, world!' as nchar(13)) from t022u;
-
-(EXPR)                    
---------------------------
-
-Hello, world!             
-Hello, world!             
-
---- 2 row(s) selected.
->>select cast (N'Hello, world!' as nchar varying(13)) from t022u;
-
-(EXPR)                    
---------------------------
-
-Hello, world!             
-Hello, world!             
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello        ' as nchar(13)) as nchar(5)) from t022u;
-
-(EXPR)    
-----------
-
-Hello     
-Hello     
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello        ' as nchar(13)) as nchar varying(5)) from t022u;
-
-(EXPR)    
-----------
-
-Hello     
-Hello     
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello, world!' as nchar(13)) as nchar(5)) from t022u;
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-(EXPR)    
-----------
-
-Hello     
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello     
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello, world!' as nchar(13)) as nchar varying(5)) from t022u;
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-(EXPR)    
-----------
-
-Hello     
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello     
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello        ' as nchar varying(13)) as nchar(5)) from t022u;
-
-(EXPR)    
-----------
-
-Hello     
-Hello     
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello        ' as nchar varying(13)) as nchar varying(5)) from t022u;
-
-(EXPR)    
-----------
-
-Hello     
-Hello     
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello, world!' as nchar varying(13)) as nchar(5)) from t022u;
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-(EXPR)    
-----------
-
-Hello     
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello     
-
---- 2 row(s) selected.
->>select cast (cast (N'Hello, world!' as nchar varying(13)) as nchar varying(5)) from t022u;
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-(EXPR)    
-----------
-
-Hello     
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-Hello     
-
---- 2 row(s) selected.
->>
->>-- tests on cast VAR/NCHAR to DATETIME
->>select cast (N'12.07.1961 03.04.55.123456' as timestamp) from t022u;
-
-(EXPR)                    
---------------------------
-
-1961-07-12 03:04:55.123456
-1961-07-12 03:04:55.123456
-
---- 2 row(s) selected.
->>select cast (N'12.07.1961 03.04.55.123456' as timestamp(3)) from t022u;
-
-(EXPR)                 
------------------------
-
-1961-07-12 03:04:55.123
-1961-07-12 03:04:55.123
-
---- 2 row(s) selected.
->>select cast (cast (N'12.07.1961 03.04.55.123456' as timestamp) as DATE) 
-+>from t022u;
-
-(EXPR)    
-----------
-
-1961-07-12
-1961-07-12
-
---- 2 row(s) selected.
->>select cast (cast (N'12.07.1961 03.04.55.123456' as timestamp) as char(21)) from
-+>t022u;
-
-(EXPR)               
----------------------
-
-1961-07-12 03:04:55.1
-1961-07-12 03:04:55.1
-
---- 2 row(s) selected.
->>select cast (N'12/13/1987' as date) from t022u;
-
-(EXPR)    
-----------
-
-1987-12-13
-1987-12-13
-
---- 2 row(s) selected.
->>
->>-- some negative DATE, TIME, TIMESTAMP
->>-- illegal european format
->>select cast (N'12.13.1987' as date) from t022u;
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 12.13.1987
-
---- 0 row(s) selected.
->>
->>-- illegal US format
->>select cast (N'13/12/1987' as date) from t022u;
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 13/12/1987
-
---- 0 row(s) selected.
->>
->>-- string overflow
->>select cast (cast (N'12/07/1961 03:04:55.123456' as timestamp) as char(18)) from
-+>t022u;
-
-*** ERROR[8402] A string overflow occurred during the evaluation of a character expression.
-
---- 0 row(s) selected.
->>
->>-- Feb. 32th doesn't exist
->>select cast(N'1997-02-32' as DATE) from t022u;
-
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 1997-02-32
-
---- 0 row(s) selected.
->>
->>-- test on cast VAR/NCAR to smallint
->>select cast(N'2' as SMALLINT) from t022u;
-
-(EXPR)
-------
-
-     2
-     2
-
---- 2 row(s) selected.
->>select cast(N'-32768' as SMALLINT) from t022u;
-
-(EXPR)
-------
-
--32768
--32768
-
---- 2 row(s) selected.
->>select cast(N'32767' as SMALLINT) from t022u;
-
-(EXPR)
-------
-
- 32767
- 32767
-
---- 2 row(s) selected.
->>select cast(N'0' as SMALLINT UNSIGNED) from t022u;
-
-(EXPR)
-------
-
-     0
-     0
-
---- 2 row(s) selected.
->>select cast(N'65535' as SMALLINT UNSIGNED) from t022u;
-
-(EXPR)
-------
-
- 65535
- 65535
-
---- 2 row(s) selected.
->>
->>-- negative test on cast VAR/NCAR to smallint
->>select cast(N'-1' as SMALLINT UNSIGNED) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,2 BYTES,ISO88591) Source Value:-1 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast(N'-32769' as SMALLINT) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,6 BYTES,ISO88591) Source Value:-32769 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast(N'50000' as SMALLINT) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,5 BYTES,ISO88591) Source Value:50000 to Target Type:SMALLINT SIGNED(REC_BIN16_SIGNED).
-
---- 0 row(s) selected.
->>select cast(N'-32769' as SMALLINT UNSIGNED) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,6 BYTES,ISO88591) Source Value:-32769 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast(N'70000' as SMALLINT UNSIGNED) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,5 BYTES,ISO88591) Source Value:70000 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast(N'70000' as SMALLINT UNSIGNED) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,5 BYTES,ISO88591) Source Value:70000 to Target Type:SMALLINT UNSIGNED(REC_BIN16_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>-- test on cast VAR/NCAR to bit precision integer(X) unsigned
->>select cast(N'1000' as bit precision integer(15) UNSIGNED) from t022u;
-
-(EXPR)
-------
-
-  1000
-  1000
-
---- 2 row(s) selected.
->>select cast(N'0' as bit precision integer(15) UNSIGNED) from t022u;
-
-(EXPR)
-------
-
-     0
-     0
-
---- 2 row(s) selected.
->>select cast(N'32767' as bit precision integer(15) UNSIGNED) from t022u;
-
-(EXPR)
-------
-
- 32767
- 32767
-
---- 2 row(s) selected.
->>
->>-- negative test on cast VAR/NCAR to bit precision integer(X) unsigned
->>select cast(N'32768' as bit precision integer(15) UNSIGNED) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Conversion of Source Type:BIT PRECISION INTEGER(REC_BPINT_UNSIGNED) Source Value:32768 to Target Type:BIT PRECISION INTEGER(REC_BPINT_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast(N'-1' as bit precision integer(15) UNSIGNED) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,2 BYTES,ISO88591) Source Value:-1 to Target Type:BIT PRECISION INTEGER(REC_BPINT_UNSIGNED).
-
---- 0 row(s) selected.
->>
->>-- test on cast VAR/NCAR to integer
->>select cast(N'4294967295' as integer unsigned) from t022u;
-
-(EXPR)    
-----------
-
-4294967295
-4294967295
-
---- 2 row(s) selected.
->>select cast(N'0' as integer unsigned) from t022u;
-
-(EXPR)    
-----------
-
-         0
-         0
-
---- 2 row(s) selected.
->>select cast(N'2147483647' as integer) from t022u;
-
-(EXPR)     
------------
-
- 2147483647
- 2147483647
-
---- 2 row(s) selected.
->>select cast(N'-2147483648' as integer) from t022u;
-
-(EXPR)     
------------
-
--2147483648
--2147483648
-
---- 2 row(s) selected.
->>
->>-- negative test on cast VAR/NCAR to integer
->>select cast(N'4294967296' as integer unsigned) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,10 BYTES,ISO88591) Source Value:4294967296 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast(N'-1' as integer unsigned) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,2 BYTES,ISO88591) Source Value:-1 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast(N'2147483648' as integer) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,10 BYTES,ISO88591) Source Value:2147483648 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast(N'-2147483649' as integer) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,11 BYTES,ISO88591) Source Value:-2147483649 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>
->>-- test on cast VAR/NCAR to largeint
->>select cast(N'42949672960000' as largeint) from t022u;
-
-(EXPR)              
---------------------
-
-      42949672960000
-      42949672960000
-
---- 2 row(s) selected.
->>
->>-- test on cast VAR/NCAR to DEC 
->>select cast(N'42949672960000' as DEC) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,14 BYTES,ISO88591) Source Value:42949672960000 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast(N'12345.56' as DEC (7,2) unsigned) from t022u;
-
-(EXPR)  
---------
-
-12345.56
-12345.56
-
---- 2 row(s) selected.
->>
->>-- negative test on cast VAR/NCAR to DEC 
->>select cast(N'1009a' as  DEC) from t022u;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 3130303961
-
---- 0 row(s) selected.
->>
->>?ifMX
->>?ifNT
->>-- test on cast VAR/NCAR to float/real/double 
->>select cast(N'-107' as float) from t022u;
-
-(EXPR)                   
--------------------------
-
--1.07000000000000000E+002
--1.07000000000000000E+002
-
---- 2 row(s) selected.
->>select cast(N'1.2E-001' as real) from t022u;
-
-(EXPR)         
----------------
-
- 1.1999999E-001
- 1.1999999E-001
-
---- 2 row(s) selected.
->>select cast(N'12E-001' as double precision) from t022u;
-
-(EXPR)                   
--------------------------
-
- 1.20000000000000016E+000
- 1.20000000000000016E+000
-
---- 2 row(s) selected.
->>
->>-- negative test on cast VAR/NCAR to float/real/double 
->>select cast(N'this is not a number.' as float) from t022u;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 74686973206973206e6f742061206e756d6265722e
-
---- 0 row(s) selected.
->>select cast(N'1023u' as real) from t022u;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 3130323375
-
---- 0 row(s) selected.
->>select cast(N'''\2' as double precision) from t022u;
-
-*** ERROR[8413] The string argument contains characters that cannot be converted. Source data(in hex): 275c32
-
---- 0 row(s) selected.
->>?ifNT
->>?ifMX
->>
->>-- test on cast VAR/NCAR to interval 
->>select cast(N'-07' as interval year) from t022u;
-
-*** ERROR[8422] The provided INTERVAL is not valid and cannot be converted.
-
---- 0 row(s) selected.
->>select cast(N'5' as interval year) from t022u;
-
-(EXPR)
-------
-
-     5
-     5
-
---- 2 row(s) selected.
->>
->>-- test on cast smallint to VAR/NCAR 
->>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(10)) from t022u;
-
-(EXPR)              
---------------------
-
-65535               
-65535               
-
---- 2 row(s) selected.
->>select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR(10)) from t022u;
-
-(EXPR)              
---------------------
-
--5535               
--5535               
-
---- 2 row(s) selected.
->>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(10)) from t022u;
-
-(EXPR)              
---------------------
-
-65535               
-65535               
-
---- 2 row(s) selected.
->>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR VARYING(10)) from t022u;
-
-(EXPR)              
---------------------
-
-65535               
-65535               
-
---- 2 row(s) selected.
->>select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR VARYING(10)) from t022u;
-
-(EXPR)              
---------------------
-
--5535               
--5535               
-
---- 2 row(s) selected.
->>
->>-- negative test on cast smallint to VAR/NCAR 
->>select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(1)) from t022u;
-
-*** ERROR[8402] A string overflow occurred during the evaluation of a character expression. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:65535 to Target Type:CHAR(REC_BYTE_F_ASCII,1 BYTES,UTF8).
-
---- 0 row(s) selected.
->>select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR VARYING(1)) from t022u;
-
-*** ERROR[8402] A string overflow occurred during the evaluation of a character expression. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-5535 to Target Type:VARCHAR(REC_BYTE_V_ASCII,1 BYTES,UTF8).
-
---- 0 row(s) selected.
->>
->>-- test on cast integer to VAR/NCAR 
->>select cast(cast(N'4294967295' as integer unsigned) as NCHAR VARYING(10)) from t022u;
-
-(EXPR)              
---------------------
-
-4294967295          
-4294967295          
-
---- 2 row(s) selected.
->>select cast(cast(N'0' as integer unsigned) as NCHAR(2)) from t022u;
-
-(EXPR)
-------
-
-0     
-0     
-
---- 2 row(s) selected.
->>select cast(cast(N'2147483647' as integer) as NCHAR(12)) from t022u;
-
-(EXPR)                  
-------------------------
-
-2147483647              
-2147483647              
-
---- 2 row(s) selected.
->>select cast(cast(N'-2147483648' as integer) as NCHAR(12)) from t022u;
-
-(EXPR)                  
-------------------------
-
--2147483648             
--2147483648             
-
---- 2 row(s) selected.
->>
->>-- negative test on cast integer to VAR/NCAR
->>select cast(cast(N'4294967296' as integer unsigned) as nchar(1)) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,10 BYTES,ISO88591) Source Value:4294967296 to Target Type:INTEGER UNSIGNED(REC_BIN32_UNSIGNED).
-
---- 0 row(s) selected.
->>select cast(cast(N'-10' as integer) as nchar(1)) from t022u;
-
-*** ERROR[8402] A string overflow occurred during the evaluation of a character expression. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:-10 to Target Type:CHAR(REC_BYTE_F_ASCII,1 BYTES,UTF8).
-
---- 0 row(s) selected.
->>select cast(cast(N'2147483648' as integer) as nchar varying(1)) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,10 BYTES,ISO88591) Source Value:2147483648 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>select cast(cast(N'-2147483649' as integer) as nchar(1)) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,11 BYTES,ISO88591) Source Value:-2147483649 to Target Type:INTEGER SIGNED(REC_BIN32_SIGNED).
-
---- 0 row(s) selected.
->>
->>-- test on cast DEC to VAR/NCAR 
->>select cast(cast(N'42949672960000' as DEC) as nchar(10)) from t022u;
-
-*** ERROR[8411] A numeric overflow occurred during an arithmetic computation or data conversion. Intermediate conversion of Source Type:CHAR(REC_BYTE_F_ASCII,14 BYTES,ISO88591) Source Value:42949672960000 to Target Type:DECIMAL SIGNED(REC_DECIMAL_LSE).
-
---- 0 row(s) selected.
->>select cast(cast(N'12345.56' as DEC (7,2) unsigned) as nchar(20)) from t022u;
-
-(EXPR)                                  
-----------------------------------------
-
-12345.56                                
-12345.56                                
-
---- 2 row(s) selected.
->>
->>-- "timestamp - timestamp" should return result in seconds
->>select timestamp '2018-10-10 10:10:10' - timestamp '2017-10-10 10:10:10' from dual;
-
-(EXPR)       
--------------
-
-     31536000
-
---- 1 row(s) selected.
->>
->>-- negative test on cast DEC to VAR/NCAR 
->>select cast(cast(N'12345.56' as DEC (7,2) unsigned) as nchar(2)) from t022u;
-
-*** ERROR[8402] A string overflow occurred during the evaluation of a character expression. Conversion of Source Type:LARGEINT(REC_BIN64_SIGNED) Source Value:12345.56 to Target Type:CHAR(REC_BYTE_F_ASCII,2 BYTES,UTF8).
-
---- 0 row(s) selected.
->>
->>-- test on cast date, time and timestamp to VAR/NCAR 
->>select cast(date '1998-03-02' as nchar varying(11)) from t022u;
-
-(EXPR)                
-----------------------
-
-1998-03-02            
-1998-03-02            
-
---- 2 row(s) selected.
->>select cast(date '1998-03-02' as nchar(11)) from t022u;
-
-(EXPR)                
-----------------------
-
-1998-03-02            
-1998-03-02            
-
---- 2 row(s) selected.
->>select cast(time '08:03:02' as nchar(11)) from t022u;
-
-(EXPR)                
-----------------------
-
-08:03:02              
-08:03:02              
-
---- 2 row(s) selected.
->>select cast(time '08:03:02 pm' as nchar(11)) from t022u;
-
-(EXPR)                
-----------------------
-
-20:03:02              
-20:03:02              
-
---- 2 row(s) selected.
->>select cast(timestamp 
-+>'1998-06-03 08:03:02.000000' as nchar varying(21)) from t022u;
-
-(EXPR)                                    
-------------------------------------------
-
-1998-06-03 08:03:02.0                     
-1998-06-03 08:03:02.0                     
-
---- 2 row(s) selected.
->>select cast(timestamp '1998-06-03 08:03:02.000000' as nchar(21)) from t022u;
-
-(EXPR)                                    
-------------------------------------------
-
-1998-06-03 08:03:02.0                     
-1998-06-03 08:03:02.0                     
-
---- 2 row(s) selected.
->>-- Genesis case-10-050208-6275
->>-- Test on ascii to time
->>
->>select cast('10:13:14' as time(4)),cast('10:13:14' as time(4)) from (values(1)) as x;
-
-(EXPR)         (EXPR)       
--------------  -------------
-
-10:13:14.0000  10:13:14.0000
-
---- 1 row(s) selected.
->>select cast('10:13:14' as time(4)),cast('10:13:14' as time(4)),current_timestamp from (values(1)) as x;
-
-(EXPR)         (EXPR)         (EXPR)                    
--------------  -------------  --------------------------
-
-10:13:14.0000  10:13:14.0000  2017-04-19 21:00:34.634137
-
---- 1 row(s) selected.
->>--test on precision of time
->>select cast('10:13:14' as time(7)),cast('10:13:14' as time(4));
-
-*** ERROR[3134] The specified TIME or TIMESTAMP precision value, 7, cannot exceed 6.
-
-*** ERROR[8822] The statement was not prepared.
-
->>--
->>-- testing translate.  1998 6/12
->>--
->>--  Syntax: translate(expr using translation)
->>--
->>-- 	where translation can be 
->>--  		1. ISO88591TOUCS2
->>--  		2. UCS2TOISO88591 
->>--  For case 1 and 2, the expr has to be [VAR]CHAR(X) CHARACTERSET ISO88591. 
->>--  The result is NCHAR VARYING(Y) CHARACTERSET UNICODE, where Y = X for both 
->>--  case 1 and 2.
->>--
->>--  IF expr is NULL, the result is NULL.
->>--
->>
->>create table t022u2 (a char(10) default NULL,
-+>		     b nchar(10) default NULL,
-+>		     c int
-+>		    );
-
---- SQL operation complete.
->>
->>insert into t022u2(c) values(1);
-
---- 1 row(s) inserted.
->>insert into t022u2(c) values(2);
-
---- 1 row(s) inserted.
->>insert into t022u2 values('abcdefg', N'abcdefg', 3);
-
---- 1 row(s) inserted.
->>insert into t022u2 values('hijkl', N'hijkl', 4);
-
---- 1 row(s) inserted.
->>
->>select translate(a using iso88591ToUcs2) from t022u2;
-
-(EXPR)              
---------------------
-
-?                   
-?                   
-abcdefg             
-hijkl               
-
---- 4 row(s) selected.
->>select translate(a using iso88591ToUCS2) from t022u2;
-
-(EXPR)              
---------------------
-
-?                   
-?                   
-abcdefg             
-hijkl               
-
---- 4 row(s) selected.
->>select translate(a using ISO88591TOUCS2) from t022u2;
-
-(EXPR)              
---------------------
-
-?                   
-?                   
-abcdefg             
-hijkl               
-
---- 4 row(s) selected.
->>
->>select translate(b using ucs2Toiso88591) from t022u2;
-
-(EXPR)    
-----------
-
-?         
-?         
-abcdefg   
-hijkl     
-
---- 4 row(s) selected.
->>
->>-- some negative tests
->>select translate(b using ucs2Toiso88591) from t022u2;
-
-(EXPR)    
-----------
-
-?         
-?         
-abcdefg   
-hijkl     
-
---- 4 row(s) selected.
->> -- wrong mapping name
->>select translate(a using ucs2Toiso88591) from t022u2;
-
-*** ERROR[4106] The character set for the operand of function TRANSLATE must be UCS2.
-
-*** ERROR[8822] The statement was not prepared.
-
->>-- character set mismatch 
->>select translate(b using ISO88591TOUCS2) from t022u2;
-
-*** ERROR[4106] The character set for the operand of function TRANSLATE must be ISO88591.
-
-*** ERROR[8822] The statement was not prepared.
-
->>-- charactet set mismatch
->>select translate(123 using ISO88591TOUCS2) from t022u2;
-
-*** ERROR[4043] The operand of function TRANSLATE must be character.
-
-*** ERROR[8822] The statement was not prepared.
-
->>-- not a char data type
->>select translate(12E-01 using ISO88591TOUCS2) from t022u2;
-
-*** ERROR[4043] The operand of function TRANSLATE must be character.
-
-*** ERROR[8822] The statement was not prepared.
-
->>-- not a char data type
->>select translate(-123 using ucs2Toiso88591) from t022u2;
-
-*** ERROR[4043] The operand of function TRANSLATE must be character.
-
-*** ERROR[8822] The statement was not prepared.
-
->>-- not a char data type
->>select translate(123.3 using ucs2Toiso88591) from t022u2;
-
-*** ERROR[4043] The operand of function TRANSLATE must be character.
-
-*** ERROR[8822] The statement was not prepared.
-
->>-- not a char data type
->>select translate(date '1998-06-15' using ucs2Toiso88591) from t022u2;
-
-*** ERROR[4043] The operand of function TRANSLATE must be character.
-
-*** ERROR[8822] The statement was not prepared.
-
->>-- not a char 
->>select translate(time '08:03:02 pm' using iso88591ToUcs) from t022u2;
-
-*** ERROR[4043] The operand of function TRANSLATE must be character.
-
-*** ERROR[8822] The statement was not prepared.
-
->>-- not a char 
->>select translate(timestamp '1998-06-03 08:03:02.000000' using iso88591ToUcs2) 
-+>from t022u2;
-
-*** ERROR[4043] The operand of function TRANSLATE must be character.
-
-*** ERROR[8822] The statement was not prepared.
-
->>-- not a char 
->>?ifMX
->>
->>?ifMX
->>-- New PCode comparison instructions for float32 and float64
->>create table t022fltcmp(c0 char(23), c1 real not null, c2 float not null);
-
---- SQL operation complete.
->>-- Insert some rows
->>insert into t022fltcmp values ('unaligned float access', 0, 20.12345),
-+>                              ('unaligned', 0, 20.56789);
-
---- 2 row(s) inserted.
->>insert into t022fltcmp values('unaligned float', 10.12345,
-+>                               1.7976931348623157e+308);
-
---- 1 row(s) inserted.
->>insert into t022fltcmp values('unaligned access', 3.40282346e+38, 10.12345);
-
---- 1 row(s) inserted.
->>insert into t022fltcmp values('float access', 1.17549436e-38,
-+>                               2.2250738585072014e-308);
-
---- 1 row(s) inserted.
->>
->>select * from t022fltcmp;
-
-C0                       C1               C2                       
------------------------  ---------------  -------------------------
-
-unaligned float access    0.0000000E+000   2.01234499999999968E+001
-unaligned                 0.0000000E+000   2.05678899999999968E+001
-unaligned float           1.0123450E+001   1.79769313486231520E+308
-unaligned access          3.4028234E+038   1.01234500000000000E+001
-float access              1.1754943E-038   2.22507385850720128E-308
-
---- 5 row(s) selected.
->>
->>-- Start the basic tests
->>-- New PCode instructions for FLOAT64 and FLOAT32: GT and LE
->>select c1 - 20.00, c2 + 20.00 from t022fltcmp where c1 > 10.02 and c2 <= 30.02;
-
-(EXPR)                     (EXPR)                   
--------------------------  -------------------------
-
- 3.40282346638528832E+038   3.01234500000000000E+001
-
---- 1 row(s) selected.
->>select c1 - 20.00, c2 + 20.00 from t022fltcmp where c1 > c1 and c2 <= 30.02;
-
---- 0 row(s) selected.
->>select c1 - 20.00, c2 + 20.00 from t022fltcmp where c1 <= 20.02 and c2 > 30.02;
-
-(EXPR)                     (EXPR)                   
--------------------------  -------------------------
-
--9.87654972076416000E+000   1.79769313486231520E+308
-
---- 1 row(s) selected.
->>select c1 - 20.00, c2 + 20.00 from t022fltcmp where c1 <= c1 and c2 > 30.02;
-
-(EXPR)                     (EXPR)                   
--------------------------  -------------------------
-
--9.87654972076416000E+000   1.79769313486231520E+308
-
---- 1 row(s) selected.
->>
->>-- New PCode instructions for FLOAT64 and FLOAT32: GE and LT
->>select c2 * 20.00 from t022fltcmp where c1 >= 20.12345 and c2 < 1.7976E208;
-
-(EXPR)                   
--------------------------
-
- 2.02469000000000000E+002
-
---- 1 row(s) selected.
->>select c2 * 20.00 from t022fltcmp where c1 >= c1 and c2 < 1.7976E208;
-
-(EXPR)                   
--------------------------
-
- 4.02468999999999936E+002
- 4.11357800000000064E+002
- 2.02469000000000000E+002
- 4.45014771701440256E-307
-
---- 4 row(s) selected.
->>select c1 * 20.00 from t022fltcmp where c1 < 20.12345
-+>                                    and c2 >= 2.2250738585072014e-308;
-
-(EXPR)                   
--------------------------
-
- 0.00000000000000000E+000
- 0.00000000000000000E+000
- 2.02469005584716800E+002
- 2.35098870164457504E-037
-
---- 4 row(s) selected.
->>select c1 * 20.00 from t022fltcmp where c1 < c1
-+>                                    and c2 >= 2.2250738585072014e-308;
-
---- 0 row(s) selected.
->>
->>-- New PCode instructions for FLOAT64 and FLOAT32: EQ and NE
->>select c2 from t022fltcmp where c1 = 1.17549436e-38 and
-+>                                c2 <> 1.7976931348623157e+308;
-
-C2                       
--------------------------
-
- 2.22507385850720128E-308
-
---- 1 row(s) selected.
->>select c2 from t022fltcmp where c1 = c1 and
-+>                                c2 <> 1.7976931348623157e+308;
-
-C2                       
--------------------------
-
- 2.01234499999999968E+001
- 2.05678899999999968E+001
- 1.01234500000000000E+001
- 2.22507385850720128E-308
-
---- 4 row(s) selected.
->>select c1 from t022fltcmp where c1 <> 10.12345
-+>                            and c2 = 2.2250738585072014e-308;
-
-C1             
----------------
-
- 1.1754943E-038
-
---- 1 row(s) selected.
->>select c1 from t022fltcmp where c1 <> c1
-+>                            and c2 = 2.2250738585072014e-308;
-
---- 0 row(s) selected.
->>
->>-- PCode bug fix validation
->>-- PCode constant and jump table setup for ALM CR5679 (64-bit)
->>create table t022bug (t1  date  not null
-+>                    , f2  real not null
-+>                    , z   char (8)
-+>                    , vc1 varchar(15)
-+>                    , primary key (t1)) no partition;
-
---- SQL operation complete.
->>create view vt022bug as select * from t022bug where trim(z) < 'Row05' or
-+>                       vc1 in ('~!#$%^\&', '~', '~');
-
---- SQL operation complete.
->>insert into t022bug values ( date '1959-12-31', 9, null, '~!#$%^\&');
-
---- 1 row(s) inserted.
->>
->>-- Expect 1 row selected
->>select f2 from vt022bug where f2 > 8.2399999E-1 and f2 < 9.1234567E01
-+>       group by vc1, f2 having vc1 in ('~', '~!#$%^\&');
-
-F2             
----------------
-
- 9.0000000E+000
-
---- 1 row(s) selected.
->>
->>?ifMX
->>
->>--to test comparison between shorter signed and longer unsigned
->>--comparisons that involve implicit typecast of both operands
->>--to signed int.
->>create table t022tg (iu int unsigned, ss smallint);
-
---- SQL operation complete.
->>insert into t022tg values(4294967295, -1),(3000000000,-1),(4294967295,32765);
-
---- 3 row(s) inserted.
->>
->>--Must return zero rows.
->>select * from t022tg where -1>iu;
-
---- 0 row(s) selected.
->>
->>--Must return 3 rows.
->>select * from t022tg where iu>ss;
-
-IU          SS    
-----------  ------
-
-4294967295      -1
-3000000000      -1
-4294967295   32765
-
---- 3 row(s) selected.
->>
->>--Must return zero rows.
->>select * from t022tg where iu<=ss;
-
---- 0 row(s) selected.
->>
->>--Must return 3 rows.
->>select * from t022tg where iu>=ss;
-
-IU          SS    
-----------  ------
-
-4294967295      -1
-3000000000      -1
-4294967295   32765
-
---- 3 row(s) selected.
->>
->>--Must return 3 rows.
->>select * from t022tg where ss<iu;
-
-IU          SS    
-----------  ------
-
-4294967295      -1
-3000000000      -1
-4294967295   32765
-
---- 3 row(s) selected.
->>
->>--Must return zero rows.
->>select * from t022tg where ss>iu;
-
---- 0 row(s) selected.
->>
->>--Must return 3 rows.
->>select * from t022tg where ss<=iu;
-
-IU          SS    
-----------  ------
-
-4294967295      -1
-3000000000      -1
-4294967295   32765
-
---- 3 row(s) selected.
->>
->>--Must return zero rows.
->>select * from t022tg where ss>=iu;
-
---- 0 row(s) selected.
->>
->>-- check for string truncation, with and without auto truncate
->>delete from t022u2;
-
---- 4 row(s) deleted.
->>insert into t022u2 (c) values (1);
-
---- 1 row(s) inserted.
->>
->>-- should return truncation error
->>insert into t022u2 (a) values ('abcdefghijkl');
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
---- 1 row(s) inserted.
->>update t022u2 set a = 'abcdefghijkl';
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
---- 2 row(s) updated.
->>
->>-- should not return truncation errors.
->>cqd traf_string_auto_truncate 'ON';
-
---- SQL operation complete.
->>delete from t022u2;
-
---- 2 row(s) deleted.
->>insert into t022u2 (a) values ('abcdefghijkl');
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
---- 1 row(s) inserted.
->>select * from t022u2;
-
-A           B                     C          
-----------  --------------------  -----------
-
-abcdefghij  ?                               ?
-
---- 1 row(s) selected.
->>update t022u2 set a = 'lkjihgfedcba';
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
---- 1 row(s) updated.
->>select * from t022u2;
-
-A           B                     C          
-----------  --------------------  -----------
-
-lkjihgfedc  ?                               ?
-
---- 1 row(s) selected.
->>
->>-- return warnings if truncation occurs
->>cqd traf_string_auto_truncate_warning 'ON';
-
---- SQL operation complete.
->>delete from t022u2;
-
---- 1 row(s) deleted.
->>insert into t022u2 (a) values ('abcdefghijkl');
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
---- 1 row(s) inserted.
->>select * from t022u2;
-
-A           B                     C          
-----------  --------------------  -----------
-
-abcdefghij  ?                               ?
-
---- 1 row(s) selected.
->>update t022u2 set a = 'lkjihgfedcba';
-
-*** WARNING[8402] A string overflow occurred during the evaluation of a character expression.
-
---- 1 row(s) updated.
->>select * from t022u2;
-
-A           B                     C          
-----------  --------------------  -----------
-
-lkjihgfedc  ?                               ?
-
---- 1 row(s) selected.
->>
 >>-- done
 >>log;
diff --git a/core/sql/regress/executor/EXPECTED130 b/core/sql/regress/executor/EXPECTED130
index fa69e88..8f97dad 100644
--- a/core/sql/regress/executor/EXPECTED130
+++ b/core/sql/regress/executor/EXPECTED130
@@ -652,12 +652,12 @@
 >>
 >>insert into tlob130txt_limit50 values(1,filetolob('lob_input_e1.txt'));
 
-*** ERROR[8442] Unable to access ExpLOBInterfaceInsert interface. Call to ExpLOBInterfaceInsert returned error LOB_MAX_LIMIT_ERROR(560). Error detail 0.
+*** ERROR[8442] Unable to access ExpLOBInterfaceInsert interface. Call to ExpLOBInterfaceInsert returned error LOB_MAX_LIMIT_ERROR(560). Error detail: 0. Cause: .
 
 --- 0 row(s) inserted.
 >>insert into tlob130bin_limit1K values(1,filetolob('anoush.jpg'));
 
-*** ERROR[8442] Unable to access ExpLOBInterfaceInsert interface. Call to ExpLOBInterfaceInsert returned error LOB_MAX_LIMIT_ERROR(560). Error detail 0.
+*** ERROR[8442] Unable to access ExpLOBInterfaceInsert interface. Call to ExpLOBInterfaceInsert returned error LOB_MAX_LIMIT_ERROR(560). Error detail: 0. Cause: .
 
 --- 0 row(s) inserted.
 >>--test extract 
@@ -1595,6 +1595,10 @@
 SB_PERSISTENT_SAMPLES
 TLOB130TS2
 
+=======================
+Summary info of get:
+Get 7 rows.
+
 --- SQL operation complete.
 >>drop schema trafodion.lobsch cascade;
 
diff --git a/core/sql/regress/executor/TEST022 b/core/sql/regress/executor/TEST022
index 96ac1f6..cda8a4f 100755
--- a/core/sql/regress/executor/TEST022
+++ b/core/sql/regress/executor/TEST022
@@ -23,17 +23,8 @@
 -- Functionality: Basic data type conversions, arithmetic and comparative
 --                operations, both positive and negative tests.
 -- Expected files: EXPECTED022, EXPECTED022.MX, EXPECTED022.MP
--- Table created: t022t1 - t022tg, t022u, t022u2
+-- Table created: 
 -- Limitations:
--- To do: - Remove DIFF022.KNOWN.NSK when Unicode is supported on MX tables
---          while Unicode may never be supported on MP tables
--- Revision history:
---     (1/28/02) - Copied from fullstack/TEST022
---     (2/27/02) - Merged in tests fullstack/TEST022U
---     (3/04/02) - Comment out Unicode tests for MP tables
---     (5/19/02) - Removed DIFF022.KNOWN.NSK as Unicode is supported
---     (4/05/04) - Addition interval conversion tests for overflow detection
---     (8/18/05) - Float comparisons and unaligned float accesses
 
 obey TEST022 (clean_up);
 
@@ -43,6 +34,7 @@
 
 obey TEST022 (clean_up);
 
+?ignore
 log LOG022;
 --Now we will run the same test again with PCODE CQD option 'OFF'
 --to ensure PCODE and CLAUSE's evaluation are exactly similar.
@@ -51,18 +43,16 @@
 log;
 
 obey TEST022 (clean_up);
+?ignore
+
 exit;
 
 -------------------------------------------------------------------------------
 ?section clean_up
 -------------------------------------------------------------------------------
-drop table t022t1;
-drop table t022t2;
 drop table t022t3;
 drop table t022t4;
-drop table t022t5;
 drop table t022t6;
-drop table t022t7;
 drop table t022t8;
 drop table t022t9;
 drop table t022ta;
@@ -74,34 +64,24 @@
 drop table t022tg;
 drop table t022th;
 drop table t022ti;
-?ifMX
-drop table t022u;
 drop table t022u2;
 drop table $$TEST_SCHEMA$$.t022a7;
 drop table t022fltcmp;
 drop table t022bug cascade;
-?ifMX
 drop table t022dtime;
+drop table t022nanos;
 
 -------------------------------------------------------------------------------
 ?section test
 -------------------------------------------------------------------------------
-create table t022t1 (a int);
-create table t022t2 (a int);
 create table t022t3 (a int unsigned);
 create table t022t4 (a smallint unsigned, b smallint); 
 
-insert into t022t1 values (1);
-insert into t022t2 values (1), (2);
 insert into t022t3 values (4294967295), (3000000000);
 insert into t022t4 values (65535, 32767);
 
-?ifMX
-create table t022u (a int);
-insert into t022u values (1), (2);
 create table t022a7 (c1 float(22), c2 float not null);
-?ifNT
--- The ifNT setting is also enabled when run on Linux platforms.
+
 prepare insertIntoT022A7 from insert into t022a7 values (?,?);
 sh sh -c 'rm -f t022xxx > /dev/null 2>&1 ';
 -- Must use "sh sh -c" if we want the command to work on NT platforms.
@@ -112,125 +92,120 @@
 sh sh -c 'echo "execute insertIntoT022A7 using 1 , 2.E3 ; "      >> t022xxx ';
 sh sh -c 'echo "execute insertIntoT022A7 using 3 , 123.456E2 ; " >> t022xxx ';
 sh sh -c 'echo "commit work;"                                    >> t022xxx ';
-?ifNT
-?ifNSK
-sh echo 0 , 1.   > t022xxx;sh echo 1 , 2.E3  >> t022xxx;sh echo 3 , 123.456E2 >> t022xxx;
-?ifNSK
-?ifMX
 
 -- Positive cases to test the limits of each data type.
 
-select cast (-9 as numeric(1)) from t022t1;
-select cast (9 as numeric(1)) from t022t1;
-select cast (-9999 as numeric(4)) from t022t1;
-select cast (9999 as numeric(4)) from t022t1;
-select cast (-32768 as smallint) from t022t1;
-select cast (32767 as smallint) from t022t1;
+select cast (-9 as numeric(1)) from dual;
+select cast (9 as numeric(1)) from dual;
+select cast (-9999 as numeric(4)) from dual;
+select cast (9999 as numeric(4)) from dual;
+select cast (-32768 as smallint) from dual;
+select cast (32767 as smallint) from dual;
 
-select cast (0 as numeric(1) unsigned) from t022t1;
-select cast (9 as numeric(1) unsigned) from t022t1;
-select cast (0 as numeric(4) unsigned) from t022t1;
-select cast (9999 as numeric(4) unsigned) from t022t1;
-select cast (0 as smallint unsigned) from t022t1;
-select cast (65535 as smallint unsigned) from t022t1;
+select cast (0 as numeric(1) unsigned) from dual;
+select cast (9 as numeric(1) unsigned) from dual;
+select cast (0 as numeric(4) unsigned) from dual;
+select cast (9999 as numeric(4) unsigned) from dual;
+select cast (0 as smallint unsigned) from dual;
+select cast (65535 as smallint unsigned) from dual;
 
-select cast (-99999 as numeric(5)) from t022t1;
-select cast (99999 as numeric(5)) from t022t1;
-select cast (-999999999 as numeric(9)) from t022t1;
-select cast (999999999 as numeric(9)) from t022t1;
-select cast (-2147483648 as int) from t022t1;
-select cast (2147483647 as int) from t022t1;
+select cast (-99999 as numeric(5)) from dual;
+select cast (99999 as numeric(5)) from dual;
+select cast (-999999999 as numeric(9)) from dual;
+select cast (999999999 as numeric(9)) from dual;
+select cast (-2147483648 as int) from dual;
+select cast (2147483647 as int) from dual;
 
-select cast (0 as numeric(5) unsigned) from t022t1;
-select cast (99999 as numeric(5) unsigned) from t022t1;
-select cast (0 as numeric(9) unsigned) from t022t1;
-select cast (999999999 as numeric(9) unsigned) from t022t1;
-select cast (0 as int unsigned) from t022t1;
-select cast (4294967295 as int unsigned) from t022t1;
+select cast (0 as numeric(5) unsigned) from dual;
+select cast (99999 as numeric(5) unsigned) from dual;
+select cast (0 as numeric(9) unsigned) from dual;
+select cast (999999999 as numeric(9) unsigned) from dual;
+select cast (0 as int unsigned) from dual;
+select cast (4294967295 as int unsigned) from dual;
 
-select cast (-9999999999 as numeric(10)) from t022t1;
-select cast (9999999999 as numeric(10)) from t022t1;
-select cast (-999999999999999999 as numeric(18)) from t022t1;
-select cast (999999999999999999 as numeric(18)) from t022t1;
-select cast (-9223372036854775808 as largeint) from t022t1;
-select cast (9223372036854775807 as largeint) from t022t1;
+select cast (-9999999999 as numeric(10)) from dual;
+select cast (9999999999 as numeric(10)) from dual;
+select cast (-999999999999999999 as numeric(18)) from dual;
+select cast (999999999999999999 as numeric(18)) from dual;
+select cast (-9223372036854775808 as largeint) from dual;
+select cast (9223372036854775807 as largeint) from dual;
 
-select cast (-9 as decimal(1)) from t022t1;
-select cast (9 as decimal(1)) from t022t1;
-select cast (-999999999999999999 as decimal(18)) from t022t1;
-select cast (999999999999999999 as decimal(18)) from t022t1;
+select cast (-9 as decimal(1)) from dual;
+select cast (9 as decimal(1)) from dual;
+select cast (-999999999999999999 as decimal(18)) from dual;
+select cast (999999999999999999 as decimal(18)) from dual;
 
-select cast (0 as decimal(1) unsigned) from t022t1;
-select cast (9 as decimal(1) unsigned) from t022t1;
-select cast (0 as decimal(9) unsigned) from t022t1;
-select cast (999999999 as decimal(9) unsigned) from t022t1;
+select cast (0 as decimal(1) unsigned) from dual;
+select cast (9 as decimal(1) unsigned) from dual;
+select cast (0 as decimal(9) unsigned) from dual;
+select cast (999999999 as decimal(9) unsigned) from dual;
 
-select cast (10 as tinyint) from t022t1;
-select cast (-10 as tinyint) from t022t1;
-select cast (127 as tinyint) from t022t1;
-select cast (-128 as tinyint) from t022t1;
-select cast (10 as tinyint unsigned) from t022t1;
-select cast (0 as tinyint unsigned) from t022t1;
-select cast (255 as tinyint unsigned) from t022t1;
+select cast (10 as tinyint) from dual;
+select cast (-10 as tinyint) from dual;
+select cast (127 as tinyint) from dual;
+select cast (-128 as tinyint) from dual;
+select cast (10 as tinyint unsigned) from dual;
+select cast (0 as tinyint unsigned) from dual;
+select cast (255 as tinyint unsigned) from dual;
 
-select cast (date'12/31/9999' as timestamp(3)) from t022t1;
-select cast (timestamp'12/31/9999 11:59:59.999999 pm' as date) from t022t1;
-select cast (timestamp'12/31/9999 11:59:59.999999 pm' as time(3)) from t022t1;
+select cast (date'12/31/9999' as timestamp(3)) from dual;
+select cast (timestamp'12/31/9999 11:59:59.999999 pm' as date) from dual;
+select cast (timestamp'12/31/9999 11:59:59.999999 pm' as time(3)) from dual;
 
-select interval'0.1'second + timestamp'12/31/9998 11:59:59.9 pm' from t022t1;
-select timestamp'12/31/9998 11:59:59.9 pm' + interval'0.1'second from t022t1;
-select timestamp'01/01/9999 00:00:00.0' + interval-'0.1'second from t022t1;
-select timestamp'01/01/9999 00:00:00.0' - interval'0.1'second from t022t1;
-select (date'12/31/9999' - date'12/31/9998') day(3) from t022t1;
-select (date'12/31/9998' - date'12/31/9999') day(3) from t022t1;
+select interval'0.1'second + timestamp'12/31/9998 11:59:59.9 pm' from dual;
+select timestamp'12/31/9998 11:59:59.9 pm' + interval'0.1'second from dual;
+select timestamp'01/01/9999 00:00:00.0' + interval-'0.1'second from dual;
+select timestamp'01/01/9999 00:00:00.0' - interval'0.1'second from dual;
+select (date'12/31/9999' - date'12/31/9998') day(3) from dual;
+select (date'12/31/9998' - date'12/31/9999') day(3) from dual;
 
-select interval'1'month + timestamp'12/31/9998 11:59:59.999 pm' from t022t1;
-select timestamp'12/31/9998 11:59:59.999 pm' + interval'1'month from t022t1;
-select timestamp'01/31/9999 11:59:59.999 pm' + interval-'1'month from t022t1;
-select timestamp'01/31/9999 11:59:59.999 pm' - interval'1'month from t022t1;
-select (date'12/31/9999' - date'12/31/9998') month from t022t1;
-select (date'12/31/9998' - date'12/31/9999') month from t022t1;
-select (date'12/31/9999' - date'12/31/9998') year to month from t022t1;
-select (date'12/31/9998' - date'12/31/9999') year to month from t022t1;
+select interval'1'month + timestamp'12/31/9998 11:59:59.999 pm' from dual;
+select timestamp'12/31/9998 11:59:59.999 pm' + interval'1'month from dual;
+select timestamp'01/31/9999 11:59:59.999 pm' + interval-'1'month from dual;
+select timestamp'01/31/9999 11:59:59.999 pm' - interval'1'month from dual;
+select (date'12/31/9999' - date'12/31/9998') month from dual;
+select (date'12/31/9998' - date'12/31/9999') month from dual;
+select (date'12/31/9999' - date'12/31/9998') year to month from dual;
+select (date'12/31/9998' - date'12/31/9999') year to month from dual;
 
-select interval'1'second + time'11:59:59 pm' from t022t1;
-select time'11:59:59 pm' + interval'1'second from t022t1;
-select time'12:00:00 am' + interval-'1'second from t022t1;
-select time'12:00:00 am' - interval'1'second from t022t1;
+select interval'1'second + time'11:59:59 pm' from dual;
+select time'11:59:59 pm' + interval'1'second from dual;
+select time'12:00:00 am' + interval-'1'second from dual;
+select time'12:00:00 am' - interval'1'second from dual;
 
-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 timestamp '2015-05-31T10:11:12' from dual;
+select timestamp '2015-05-31T10:11:12Z' from dual;
+select timestamp '2015-05-31T10:11:12-05:00' from dual;
+select timestamp '2015-05-31T10:11:12+05:00' from dual;
+select timestamp '2015-05-31T10:11:12.123-05:00' from dual;
+select timestamp '2015-05-31T10:11:12.123+05:00' from dual;
 
-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 cast('2015-05-31T10:11:12' as timestamp) from dual;
+select cast('2015-05-31T10:11:12Z' as timestamp) from dual;
+select cast('2015-05-31T10:11:12-05:00' as timestamp) from dual;
+select cast('2015-05-31T10:11:12+05:00' as timestamp) from dual;
+select cast('2015-05-31T10:11:12.123-05:00' as timestamp) from dual;
+select cast('2015-05-31T10:11:12.123+05:00' as timestamp) from dual;
 
-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 time '10:11:12' from dual;
+select time '10:11:12Z' from dual;
+select time '10:11:12-05:00' from dual;
+select time '10:11:12+05:00' from dual;
+select time '10:11:12.123-05:00' from dual;
+select time '10:11:12.123+05:00' from dual;
 
-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 cast('10:11:12' as time) from dual;
+select cast('10:11:12Z' as time) from dual;
+select cast('10:11:12-05:00' as time) from dual;
+select cast('10:11:12+05:00' as time) from dual;
+select cast('10:11:12.123-05:00' as time) from dual;
+select cast('10:11:12.123+05:00' as time) from dual;
 
-select time '23:11:06.123' from t022t1;
-select cast ('23:11:06.123' as time(2)) from t022t1;
+select time '23:11:06.123' from dual;
+select cast ('23:11:06.123' as time(2)) from dual;
 
-select cast('2010-01-01' as timestamp(3)) from t022t1;
-select cast('2010-01-01 10' as timestamp) from t022t1;
+select cast('2010-01-01' as timestamp(3)) from dual;
+select cast('2010-01-01 10' as timestamp) from dual;
 
 create table if not exists t022dtime(a date not null, b time, c timestamp);
 prepare s from upsert into t022dtime values (?, ?, ?);
@@ -238,330 +213,330 @@
 select * from t022dtime;
 
 -- 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;
-select cast ('23:11:06' as timestamp) from t022t1;
-select cast('2010-01-01' as time) from t022t1;
-select timestamp'2010-01-01 10' from t022t1;
+select cast('2016-01-29Z' as date) from dual;
+select cast('2016-01-29+05:00' as date) from dual;
+select cast('10:11:12-05:000' as time) from dual;
+select date '2016-01-29Z' from dual;
+select date '2016-01-29+05:00' from dual;
+select time '25:11:11' from dual;
+select time '23:11:11.1234567890' from dual;
+select cast ('23:11:61' as time) from dual;
+select cast ('23:11:06' as timestamp) from dual;
+select cast('2010-01-01' as time) from dual;
+select timestamp'2010-01-01 10' from dual;
 
 -- Prove these cases work since they're used in the succeeding negative tests.
 
-select cast (cast (-10 as smallint) as numeric(2)) from t022t1;
-select cast (cast (10 as smallint) as numeric(2)) from t022t1;
-select cast (cast (-10 as numeric(2)) as smallint) from t022t1;
-select cast (cast (10 as numeric(2)) as smallint) from t022t1;
-select cast (-1 as smallint) from t022t1;
+select cast (cast (-10 as smallint) as numeric(2)) from dual;
+select cast (cast (10 as smallint) as numeric(2)) from dual;
+select cast (cast (-10 as numeric(2)) as smallint) from dual;
+select cast (cast (10 as numeric(2)) as smallint) from dual;
+select cast (-1 as smallint) from dual;
 
-select cast (32768 as smallint unsigned) from t022t1;
-select cast (10 as smallint unsigned) from t022t1;
+select cast (32768 as smallint unsigned) from dual;
+select cast (10 as smallint unsigned) from dual;
 
-select cast (-32769 as int) from t022t1;
-select cast (32768 as int) from t022t1;
-select cast (-10 as int) from t022t1;
-select cast (10 as int) from t022t1;
-select cast (-1 as int) from t022t1;
-select cast (65536 as int) from t022t1;
-select cast (-100000 as int) from t022t1;
-select cast (100000 as int) from t022t1;
+select cast (-32769 as int) from dual;
+select cast (32768 as int) from dual;
+select cast (-10 as int) from dual;
+select cast (10 as int) from dual;
+select cast (-1 as int) from dual;
+select cast (65536 as int) from dual;
+select cast (-100000 as int) from dual;
+select cast (100000 as int) from dual;
 
-select cast (32768 as int unsigned) from t022t1;
-select cast (10 as int unsigned) from t022t1;
-select cast (65536 as int unsigned) from t022t1;
-select cast (2147483648 as int unsigned) from t022t1;
-select cast (100000 as int unsigned) from t022t1;
+select cast (32768 as int unsigned) from dual;
+select cast (10 as int unsigned) from dual;
+select cast (65536 as int unsigned) from dual;
+select cast (2147483648 as int unsigned) from dual;
+select cast (100000 as int unsigned) from dual;
 
-select cast (-32769 as largeint) from t022t1;
-select cast (32768 as largeint) from t022t1;
-select cast (-10 as largeint) from t022t1;
-select cast (10 as largeint) from t022t1;
-select cast (-1 as largeint) from t022t1;
-select cast (65536 as largeint) from t022t1;
-select cast (-2147483649 as largeint) from t022t1;
-select cast (2147483648 as largeint) from t022t1;
-select cast (-100000 as largeint) from t022t1;
-select cast (100000 as largeint) from t022t1;
-select cast (4294967296 as largeint) from t022t1;
-select cast (-10000000000 as largeint) from t022t1;
-select cast (10000000000 as largeint) from t022t1;
+select cast (-32769 as largeint) from dual;
+select cast (32768 as largeint) from dual;
+select cast (-10 as largeint) from dual;
+select cast (10 as largeint) from dual;
+select cast (-1 as largeint) from dual;
+select cast (65536 as largeint) from dual;
+select cast (-2147483649 as largeint) from dual;
+select cast (2147483648 as largeint) from dual;
+select cast (-100000 as largeint) from dual;
+select cast (100000 as largeint) from dual;
+select cast (4294967296 as largeint) from dual;
+select cast (-10000000000 as largeint) from dual;
+select cast (10000000000 as largeint) from dual;
 
-select cast (-32769 as decimal(5)) from t022t1;
-select cast (32768 as decimal(5)) from t022t1;
-select cast (-10 as decimal(2)) from t022t1;
-select cast (10 as decimal(2)) from t022t1;
-select cast (-1 as decimal(1)) from t022t1;
-select cast (65536 as decimal(5)) from t022t1;
-select cast (-2147483649 as decimal(10)) from t022t1;
-select cast (2147483648 as decimal(10)) from t022t1;
-select cast (-100000 as decimal(6)) from t022t1;
-select cast (100000 as decimal(6)) from t022t1;
-select cast (4294967296 as decimal(10)) from t022t1;
-select cast (-10000000000 as decimal(11)) from t022t1;
-select cast (10000000000 as decimal(11)) from t022t1;
+select cast (-32769 as decimal(5)) from dual;
+select cast (32768 as decimal(5)) from dual;
+select cast (-10 as decimal(2)) from dual;
+select cast (10 as decimal(2)) from dual;
+select cast (-1 as decimal(1)) from dual;
+select cast (65536 as decimal(5)) from dual;
+select cast (-2147483649 as decimal(10)) from dual;
+select cast (2147483648 as decimal(10)) from dual;
+select cast (-100000 as decimal(6)) from dual;
+select cast (100000 as decimal(6)) from dual;
+select cast (4294967296 as decimal(10)) from dual;
+select cast (-10000000000 as decimal(11)) from dual;
+select cast (10000000000 as decimal(11)) from dual;
 
-select cast (32768 as decimal(5) unsigned) from t022t1;
-select cast (10 as decimal(2) unsigned) from t022t1;
-select cast (65536 as decimal(5) unsigned) from t022t1;
-select cast (100000 as decimal(6) unsigned) from t022t1;
+select cast (32768 as decimal(5) unsigned) from dual;
+select cast (10 as decimal(2) unsigned) from dual;
+select cast (65536 as decimal(5) unsigned) from dual;
+select cast (100000 as decimal(6) unsigned) from dual;
 
-select cast (-32769 as real) from t022t1;
-select cast (32768 as real) from t022t1;
-select cast (-10 as real) from t022t1;
-select cast (10 as real) from t022t1;
-select cast (-1 as real) from t022t1;
-select cast (65536 as real) from t022t1;
-select cast (-2147483649 as real) from t022t1;
-select cast (9999999999 as real) from t022t1;
-select cast (-100000 as real) from t022t1;
-select cast (100000 as real) from t022t1;
-select cast (9999999999 as real) from t022t1;
+select cast (-32769 as real) from dual;
+select cast (32768 as real) from dual;
+select cast (-10 as real) from dual;
+select cast (10 as real) from dual;
+select cast (-1 as real) from dual;
+select cast (65536 as real) from dual;
+select cast (-2147483649 as real) from dual;
+select cast (9999999999 as real) from dual;
+select cast (-100000 as real) from dual;
+select cast (100000 as real) from dual;
+select cast (9999999999 as real) from dual;
 
-select cast (-32769 as double precision) from t022t1;
-select cast (32768 as double precision) from t022t1;
-select cast (-10 as double precision) from t022t1;
-select cast (10 as double precision) from t022t1;
-select cast (-1 as double precision) from t022t1;
-select cast (65536 as double precision) from t022t1;
-select cast (-2147483649 as double precision) from t022t1;
-select cast (2147483648 as double precision) from t022t1;
-select cast (-100000 as double precision) from t022t1;
-select cast (100000 as double precision) from t022t1;
-select cast (4294967296 as double precision) from t022t1;
+select cast (-32769 as double precision) from dual;
+select cast (32768 as double precision) from dual;
+select cast (-10 as double precision) from dual;
+select cast (10 as double precision) from dual;
+select cast (-1 as double precision) from dual;
+select cast (65536 as double precision) from dual;
+select cast (-2147483649 as double precision) from dual;
+select cast (2147483648 as double precision) from dual;
+select cast (-100000 as double precision) from dual;
+select cast (100000 as double precision) from dual;
+select cast (4294967296 as double precision) from dual;
 
-select cast ('Hello, world!' as char(13)) from t022t2;
-select cast ('Hello, world!' as varchar(13)) from t022t2;
-select cast (cast ('Hello        ' as char(13)) as char(5)) from t022t2;
-select cast (cast ('Hello        ' as char(13)) as varchar(5)) from t022t2;
-select cast (cast ('Hello, world!' as char(13)) as char(5)) from t022t2;
-select cast (cast ('Hello, world!' as char(13)) as varchar(5)) from t022t2;
-select cast (cast ('Hello        ' as varchar(13)) as char(5)) from t022t2;
-select cast (cast ('Hello        ' as varchar(13)) as varchar(5)) from t022t2;
-select cast (cast ('Hello, world!' as varchar(13)) as char(5)) from t022t2;
-select cast (cast ('Hello, world!' as varchar(13)) as varchar(5)) from t022t2;
-select cast (cast (-2147483649 as double precision) as largeint) from t022t1;
-select cast (cast (2147483648 as double precision) as largeint) from t022t1;
+select cast ('Hello, world!' as char(13)) from dual;
+select cast ('Hello, world!' as varchar(13)) from dual;
+select cast (cast ('Hello        ' as char(13)) as char(5)) from dual;
+select cast (cast ('Hello        ' as char(13)) as varchar(5)) from dual;
+select cast (cast ('Hello, world!' as char(13)) as char(5)) from dual;
+select cast (cast ('Hello, world!' as char(13)) as varchar(5)) from dual;
+select cast (cast ('Hello        ' as varchar(13)) as char(5)) from dual;
+select cast (cast ('Hello        ' as varchar(13)) as varchar(5)) from dual;
+select cast (cast ('Hello, world!' as varchar(13)) as char(5)) from dual;
+select cast (cast ('Hello, world!' as varchar(13)) as varchar(5)) from dual;
+select cast (cast (-2147483649 as double precision) as largeint) from dual;
+select cast (cast (2147483648 as double precision) as largeint) from dual;
 
 -- Positive cases to test division.
 
-select cast (1 as numeric(1)) / cast (1 as numeric(1)) from t022t1;
-select cast (1 as numeric(5)) / cast (1 as numeric(1)) from t022t1;
-select cast (1 as numeric(1)) / cast (1 as numeric(5)) from t022t1;
-select cast (1 as numeric(5)) / cast (1 as numeric(5)) from t022t1;
-select cast (1 as numeric(10)) / cast (1 as numeric(10)) from t022t1;
+select cast (1 as numeric(1)) / cast (1 as numeric(1)) from dual;
+select cast (1 as numeric(5)) / cast (1 as numeric(1)) from dual;
+select cast (1 as numeric(1)) / cast (1 as numeric(5)) from dual;
+select cast (1 as numeric(5)) / cast (1 as numeric(5)) from dual;
+select cast (1 as numeric(10)) / cast (1 as numeric(10)) from dual;
 
 select cast (1 as numeric(1) unsigned) /
-       cast (1 as numeric(1) unsigned) from t022t1;
+       cast (1 as numeric(1) unsigned) from dual;
 select cast (1 as numeric(5) unsigned) /
-       cast (1 as numeric(1) unsigned) from t022t1;
+       cast (1 as numeric(1) unsigned) from dual;
 select cast (1 as numeric(1) unsigned) /
-       cast (1 as numeric(5) unsigned) from t022t1;
+       cast (1 as numeric(5) unsigned) from dual;
 select cast (1 as numeric(5) unsigned) /
-       cast (1 as numeric(5) unsigned) from t022t1;
+       cast (1 as numeric(5) unsigned) from dual;
 select cast (1 as numeric(9) unsigned) /
-       cast (1 as numeric(9) unsigned) from t022t1;
+       cast (1 as numeric(9) unsigned) from dual;
 
-select cast (1 as double precision) / cast (1 as double precision) from t022t1;
+select cast (1 as double precision) / cast (1 as double precision) from dual;
 
 -- Negative tests.
 
-select cast (cast (-10 as smallint) as numeric(1)) from t022t1;
-select cast (cast (10 as smallint) as numeric(1)) from t022t1;
-select cast (cast (-10 as numeric(2)) as numeric(1)) from t022t1;
-select cast (cast (10 as numeric(2)) as numeric(1)) from t022t1;
-select cast (cast (-1 as smallint) as smallint unsigned) from t022t1;
-select cast (cast (10 as smallint) as numeric(1) unsigned) from t022t1;
-select cast (cast (-1 as smallint) as int unsigned) from t022t1;
-select cast (cast (-10 as smallint) as decimal(1)) from t022t1;
-select cast (cast (10 as smallint) as decimal(1)) from t022t1;
-select cast (cast (-1 as smallint) as decimal(1) unsigned) from t022t1;
-select cast (cast (10 as smallint) as decimal(1) unsigned) from t022t1;
+select cast (cast (-10 as smallint) as numeric(1)) from dual;
+select cast (cast (10 as smallint) as numeric(1)) from dual;
+select cast (cast (-10 as numeric(2)) as numeric(1)) from dual;
+select cast (cast (10 as numeric(2)) as numeric(1)) from dual;
+select cast (cast (-1 as smallint) as smallint unsigned) from dual;
+select cast (cast (10 as smallint) as numeric(1) unsigned) from dual;
+select cast (cast (-1 as smallint) as int unsigned) from dual;
+select cast (cast (-10 as smallint) as decimal(1)) from dual;
+select cast (cast (10 as smallint) as decimal(1)) from dual;
+select cast (cast (-1 as smallint) as decimal(1) unsigned) from dual;
+select cast (cast (10 as smallint) as decimal(1) unsigned) from dual;
 
-select cast (cast (32768 as smallint unsigned) as smallint) from t022t1;
-select cast (cast (10 as smallint unsigned) as numeric(1)) from t022t1;
-select cast (cast (10 as smallint unsigned) as numeric(1)unsigned) from t022t1;
-select cast (cast (10 as smallint unsigned) as decimal(1)) from t022t1;
-select cast (cast (10 as smallint unsigned) as decimal(1)unsigned) from t022t1;
+select cast (cast (32768 as smallint unsigned) as smallint) from dual;
+select cast (cast (10 as smallint unsigned) as numeric(1)) from dual;
+select cast (cast (10 as smallint unsigned) as numeric(1)unsigned) from dual;
+select cast (cast (10 as smallint unsigned) as decimal(1)) from dual;
+select cast (cast (10 as smallint unsigned) as decimal(1)unsigned) from dual;
 
-select cast (cast (-32769 as int) as smallint) from t022t1;
-select cast (cast (32768 as int) as smallint) from t022t1;
-select cast (cast (-10 as int) as numeric(1)) from t022t1;
-select cast (cast (10 as int) as numeric(1)) from t022t1;
-select cast (cast (-1 as int) as smallint unsigned) from t022t1;
-select cast (cast (65536 as int) as smallint unsigned) from t022t1;
-select cast (cast (10 as int) as numeric(1) unsigned) from t022t1;
-select cast (cast (-100000 as int) as numeric(5)) from t022t1;
-select cast (cast (100000 as int) as numeric(5)) from t022t1;
-select cast (cast (-1 as int) as int unsigned) from t022t1;
-select cast (cast (100000 as int) as numeric(5) unsigned) from t022t1;
-select cast (cast (-10 as int) as decimal(1)) from t022t1;
-select cast (cast (10 as int) as decimal(1)) from t022t1;
-select cast (cast (-1 as int) as decimal(1) unsigned) from t022t1;
-select cast (cast (10 as int) as decimal(1) unsigned) from t022t1;
+select cast (cast (-32769 as int) as smallint) from dual;
+select cast (cast (32768 as int) as smallint) from dual;
+select cast (cast (-10 as int) as numeric(1)) from dual;
+select cast (cast (10 as int) as numeric(1)) from dual;
+select cast (cast (-1 as int) as smallint unsigned) from dual;
+select cast (cast (65536 as int) as smallint unsigned) from dual;
+select cast (cast (10 as int) as numeric(1) unsigned) from dual;
+select cast (cast (-100000 as int) as numeric(5)) from dual;
+select cast (cast (100000 as int) as numeric(5)) from dual;
+select cast (cast (-1 as int) as int unsigned) from dual;
+select cast (cast (100000 as int) as numeric(5) unsigned) from dual;
+select cast (cast (-10 as int) as decimal(1)) from dual;
+select cast (cast (10 as int) as decimal(1)) from dual;
+select cast (cast (-1 as int) as decimal(1) unsigned) from dual;
+select cast (cast (10 as int) as decimal(1) unsigned) from dual;
 
-select cast (cast (32768 as int unsigned) as smallint) from t022t1;
-select cast (cast (10 as int unsigned) as numeric(1)) from t022t1;
-select cast (cast (65536 as int unsigned) as smallint unsigned) from t022t1;
-select cast (cast (10 as int unsigned) as numeric(1) unsigned) from t022t1;
-select cast (cast (2147483648 as int unsigned) as int) from t022t1;
-select cast (cast (100000 as int unsigned) as numeric(5)) from t022t1;
-select cast (cast (100000 as int unsigned) as numeric(5) unsigned) from t022t1;
-select cast (cast (10 as int unsigned) as decimal(1)) from t022t1;
-select cast (cast (10 as int unsigned) as decimal(1) unsigned) from t022t1;
+select cast (cast (32768 as int unsigned) as smallint) from dual;
+select cast (cast (10 as int unsigned) as numeric(1)) from dual;
+select cast (cast (65536 as int unsigned) as smallint unsigned) from dual;
+select cast (cast (10 as int unsigned) as numeric(1) unsigned) from dual;
+select cast (cast (2147483648 as int unsigned) as int) from dual;
+select cast (cast (100000 as int unsigned) as numeric(5)) from dual;
+select cast (cast (100000 as int unsigned) as numeric(5) unsigned) from dual;
+select cast (cast (10 as int unsigned) as decimal(1)) from dual;
+select cast (cast (10 as int unsigned) as decimal(1) unsigned) from dual;
 
-select cast (cast (-32769 as largeint) as smallint) from t022t1;
-select cast (cast (32768 as largeint) as smallint) from t022t1;
-select cast (cast (-10 as largeint) as numeric(1)) from t022t1;
-select cast (cast (10 as largeint) as numeric(1)) from t022t1;
-select cast (cast (-1 as largeint) as smallint unsigned) from t022t1;
-select cast (cast (65536 as largeint) as smallint unsigned) from t022t1;
-select cast (cast (10 as largeint) as numeric(1) unsigned) from t022t1;
-select cast (cast (-2147483649 as largeint) as int) from t022t1;
-select cast (cast (2147483648 as largeint) as int) from t022t1;
-select cast (cast (-100000 as largeint) as numeric(5)) from t022t1;
-select cast (cast (100000 as largeint) as numeric(5)) from t022t1;
-select cast (cast (-1 as largeint) as int unsigned) from t022t1;
-select cast (cast (4294967296 as largeint) as int unsigned) from t022t1;
-select cast (cast (100000 as largeint) as numeric(5) unsigned) from t022t1;
-select cast (cast (-10000000000 as largeint) as numeric(10)) from t022t1;
-select cast (cast (10000000000 as largeint) as numeric(10)) from t022t1;
-select cast (cast (10 as largeint) as decimal(1)) from t022t1;
-select cast (cast (-1 as largeint) as decimal(1) unsigned) from t022t1;
-select cast (cast (10 as largeint) as decimal(1) unsigned) from t022t1;
+select cast (cast (-32769 as largeint) as smallint) from dual;
+select cast (cast (32768 as largeint) as smallint) from dual;
+select cast (cast (-10 as largeint) as numeric(1)) from dual;
+select cast (cast (10 as largeint) as numeric(1)) from dual;
+select cast (cast (-1 as largeint) as smallint unsigned) from dual;
+select cast (cast (65536 as largeint) as smallint unsigned) from dual;
+select cast (cast (10 as largeint) as numeric(1) unsigned) from dual;
+select cast (cast (-2147483649 as largeint) as int) from dual;
+select cast (cast (2147483648 as largeint) as int) from dual;
+select cast (cast (-100000 as largeint) as numeric(5)) from dual;
+select cast (cast (100000 as largeint) as numeric(5)) from dual;
+select cast (cast (-1 as largeint) as int unsigned) from dual;
+select cast (cast (4294967296 as largeint) as int unsigned) from dual;
+select cast (cast (100000 as largeint) as numeric(5) unsigned) from dual;
+select cast (cast (-10000000000 as largeint) as numeric(10)) from dual;
+select cast (cast (10000000000 as largeint) as numeric(10)) from dual;
+select cast (cast (10 as largeint) as decimal(1)) from dual;
+select cast (cast (-1 as largeint) as decimal(1) unsigned) from dual;
+select cast (cast (10 as largeint) as decimal(1) unsigned) from dual;
 
-select cast (cast (-32769 as decimal(5)) as smallint) from t022t1;
-select cast (cast (32768 as decimal(5)) as smallint) from t022t1;
-select cast (cast (-10 as decimal(2)) as numeric(1)) from t022t1;
-select cast (cast (10 as decimal(2)) as numeric(1)) from t022t1;
-select cast (cast (-1 as decimal(1)) as smallint unsigned) from t022t1;
-select cast (cast (65536 as decimal(5)) as smallint unsigned) from t022t1;
-select cast (cast (10 as decimal(2)) as numeric(1) unsigned) from t022t1;
-select cast (cast (-2147483649 as decimal(10)) as int) from t022t1;
-select cast (cast (2147483648 as decimal(10)) as int) from t022t1;
-select cast (cast (-100000 as decimal(6)) as numeric(5)) from t022t1;
-select cast (cast (100000 as decimal(6)) as numeric(5)) from t022t1;
-select cast (cast (-1 as decimal(1)) as int unsigned) from t022t1;
-select cast (cast (4294967296 as decimal(10)) as int unsigned) from t022t1;
-select cast (cast (100000 as decimal(6)) as numeric(5) unsigned) from t022t1;
-select cast (cast (-10000000000 as decimal(11)) as numeric(10)) from t022t1;
-select cast (cast (10000000000 as decimal(11)) as numeric(10)) from t022t1;
-select cast (cast (10 as decimal(2)) as decimal(1)) from t022t1;
-select cast (cast (-1 as decimal(1)) as decimal(1) unsigned) from t022t1;
-select cast (cast (10 as decimal(2)) as decimal(1) unsigned) from t022t1;
+select cast (cast (-32769 as decimal(5)) as smallint) from dual;
+select cast (cast (32768 as decimal(5)) as smallint) from dual;
+select cast (cast (-10 as decimal(2)) as numeric(1)) from dual;
+select cast (cast (10 as decimal(2)) as numeric(1)) from dual;
+select cast (cast (-1 as decimal(1)) as smallint unsigned) from dual;
+select cast (cast (65536 as decimal(5)) as smallint unsigned) from dual;
+select cast (cast (10 as decimal(2)) as numeric(1) unsigned) from dual;
+select cast (cast (-2147483649 as decimal(10)) as int) from dual;
+select cast (cast (2147483648 as decimal(10)) as int) from dual;
+select cast (cast (-100000 as decimal(6)) as numeric(5)) from dual;
+select cast (cast (100000 as decimal(6)) as numeric(5)) from dual;
+select cast (cast (-1 as decimal(1)) as int unsigned) from dual;
+select cast (cast (4294967296 as decimal(10)) as int unsigned) from dual;
+select cast (cast (100000 as decimal(6)) as numeric(5) unsigned) from dual;
+select cast (cast (-10000000000 as decimal(11)) as numeric(10)) from dual;
+select cast (cast (10000000000 as decimal(11)) as numeric(10)) from dual;
+select cast (cast (10 as decimal(2)) as decimal(1)) from dual;
+select cast (cast (-1 as decimal(1)) as decimal(1) unsigned) from dual;
+select cast (cast (10 as decimal(2)) as decimal(1) unsigned) from dual;
 
-select cast (cast (32768 as decimal(5) unsigned) as smallint) from t022t1;
-select cast (cast (10 as decimal(2) unsigned) as numeric(1)) from t022t1;
-select cast (cast (65536 as decimal(5) unsigned) as smallint unsigned) from t022t1;
-select cast (cast (10 as decimal(2) unsigned) as numeric(1) unsigned) from t022t1;
-select cast (cast (100000 as decimal(6) unsigned) as numeric(5)) from t022t1;
-select cast (cast (100000 as decimal(6) unsigned) as numeric(5) unsigned) from t022t1;
-select cast (cast (10 as decimal(2) unsigned) as decimal(1)) from t022t1;
-select cast (cast (10 as decimal(2) unsigned) as decimal(1) unsigned) from t022t1;
+select cast (cast (32768 as decimal(5) unsigned) as smallint) from dual;
+select cast (cast (10 as decimal(2) unsigned) as numeric(1)) from dual;
+select cast (cast (65536 as decimal(5) unsigned) as smallint unsigned) from dual;
+select cast (cast (10 as decimal(2) unsigned) as numeric(1) unsigned) from dual;
+select cast (cast (100000 as decimal(6) unsigned) as numeric(5)) from dual;
+select cast (cast (100000 as decimal(6) unsigned) as numeric(5) unsigned) from dual;
+select cast (cast (10 as decimal(2) unsigned) as decimal(1)) from dual;
+select cast (cast (10 as decimal(2) unsigned) as decimal(1) unsigned) from dual;
 
-select cast (cast (-32769 as real) as smallint) from t022t1;
-select cast (cast (32768 as real) as smallint) from t022t1;
-select cast (cast (-10 as real) as numeric(1)) from t022t1;
-select cast (cast (10 as real) as numeric(1)) from t022t1;
-select cast (cast (-1 as real) as smallint unsigned) from t022t1;
-select cast (cast (65536 as real) as smallint unsigned) from t022t1;
-select cast (cast (10 as real) as numeric(1) unsigned) from t022t1;
-select cast (cast (-2147484160 as real) as int) from t022t1;
-select cast (cast (9999999999 as real) as int) from t022t1;
-select cast (cast (-100000 as real) as numeric(5)) from t022t1;
-select cast (cast (100000 as real) as numeric(5)) from t022t1;
-select cast (cast (-1 as real) as int unsigned) from t022t1;
-select cast (cast (9999999999 as real) as int unsigned) from t022t1;
-select cast (cast (100000 as real) as numeric(5) unsigned) from t022t1;
-select cast (cast (10 as real) as decimal(1)) from t022t1;
-select cast (cast (-1 as real) as decimal(1) unsigned) from t022t1;
-select cast (cast (10 as real) as decimal(1) unsigned) from t022t1;
+select cast (cast (-32769 as real) as smallint) from dual;
+select cast (cast (32768 as real) as smallint) from dual;
+select cast (cast (-10 as real) as numeric(1)) from dual;
+select cast (cast (10 as real) as numeric(1)) from dual;
+select cast (cast (-1 as real) as smallint unsigned) from dual;
+select cast (cast (65536 as real) as smallint unsigned) from dual;
+select cast (cast (10 as real) as numeric(1) unsigned) from dual;
+select cast (cast (-2147484160 as real) as int) from dual;
+select cast (cast (9999999999 as real) as int) from dual;
+select cast (cast (-100000 as real) as numeric(5)) from dual;
+select cast (cast (100000 as real) as numeric(5)) from dual;
+select cast (cast (-1 as real) as int unsigned) from dual;
+select cast (cast (9999999999 as real) as int unsigned) from dual;
+select cast (cast (100000 as real) as numeric(5) unsigned) from dual;
+select cast (cast (10 as real) as decimal(1)) from dual;
+select cast (cast (-1 as real) as decimal(1) unsigned) from dual;
+select cast (cast (10 as real) as decimal(1) unsigned) from dual;
 
-select cast (cast (-32769 as double precision) as smallint) from t022t1;
-select cast (cast (32768 as double precision) as smallint) from t022t1;
-select cast (cast (-10 as double precision) as numeric(1)) from t022t1;
-select cast (cast (10 as double precision) as numeric(1)) from t022t1;
-select cast (cast (-1 as double precision) as smallint unsigned) from t022t1;
-select cast (cast (65536 as double precision) as smallint unsigned) from t022t1;
-select cast (cast (10 as double precision) as numeric(1) unsigned) from t022t1;
-select cast (cast (-2147483649 as double precision) as int) from t022t1;
-select cast (cast (2147483648 as double precision) as int) from t022t1;
-select cast (cast (-100000 as double precision) as numeric(5)) from t022t1;
-select cast (cast (100000 as double precision) as numeric(5)) from t022t1;
-select cast (cast (-1 as double precision) as int unsigned) from t022t1;
-select cast (cast (4294967296 as double precision) as int unsigned) from t022t1;
-select cast (cast (100000 as double precision) as numeric(5) unsigned) from t022t1;
-select cast (cast (10 as double precision) as decimal(1)) from t022t1;
-select cast (cast (-1 as double precision) as decimal(1) unsigned) from t022t1;
-select cast (cast (10 as double precision) as decimal(1) unsigned) from t022t1;
+select cast (cast (-32769 as double precision) as smallint) from dual;
+select cast (cast (32768 as double precision) as smallint) from dual;
+select cast (cast (-10 as double precision) as numeric(1)) from dual;
+select cast (cast (10 as double precision) as numeric(1)) from dual;
+select cast (cast (-1 as double precision) as smallint unsigned) from dual;
+select cast (cast (65536 as double precision) as smallint unsigned) from dual;
+select cast (cast (10 as double precision) as numeric(1) unsigned) from dual;
+select cast (cast (-2147483649 as double precision) as int) from dual;
+select cast (cast (2147483648 as double precision) as int) from dual;
+select cast (cast (-100000 as double precision) as numeric(5)) from dual;
+select cast (cast (100000 as double precision) as numeric(5)) from dual;
+select cast (cast (-1 as double precision) as int unsigned) from dual;
+select cast (cast (4294967296 as double precision) as int unsigned) from dual;
+select cast (cast (100000 as double precision) as numeric(5) unsigned) from dual;
+select cast (cast (10 as double precision) as decimal(1)) from dual;
+select cast (cast (-1 as double precision) as decimal(1) unsigned) from dual;
+select cast (cast (10 as double precision) as decimal(1) unsigned) from dual;
 
 -- negative tests for tinyint
-select cast(-129 as tinyint) from t022t1;
-select cast(128 as tinyint) from t022t1;
-select cast(256 as tinyint unsigned) from t022t1;
-select cast(-1 as tinyint unsigned) from t022t1;
+select cast(-129 as tinyint) from dual;
+select cast(128 as tinyint) from dual;
+select cast(256 as tinyint unsigned) from dual;
+select cast(-1 as tinyint unsigned) from dual;
 
 -- tests for DATE, TIME, TIMESTAMP
-select cast ('12.07.1961 03.04.55.123456' as timestamp) from t022t2;
-select cast ('12.07.1961 03.04.55.123456' as timestamp(3)) from t022t2;
-select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as DATE) from t022t2;
-select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as char(21)) from t022t2;
-select cast ('12/13/1987' as date) from t022t2;
+select cast ('12.07.1961 03.04.55.123456' as timestamp) from dual;
+select cast ('12.07.1961 03.04.55.123456' as timestamp(3)) from dual;
+select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as DATE) from dual;
+select cast (cast ('12.07.1961 03.04.55.123456' as timestamp) as char(21)) from dual;
+select cast ('12/13/1987' as date) from dual;
 
 -- some negative DATE, TIME, TIMESTAMP
 -- illegal european format
-select cast ('12.13.1987' as date) from t022t2;
+select cast ('12.13.1987' as date) from dual;
 
 -- illegal US format
-select cast ('13/12/1987' as date) from t022t2;
+select cast ('13/12/1987' as date) from dual;
 
 -- string overflow
-select cast (cast ('12.07.1961 03:04:55.123456' as timestamp) as char(18)) from t022t2;
+select cast (cast ('12.07.1961 03:04:55.123456' as timestamp) as char(18)) from dual;
 
 -- Feb. 30th doesn't exist
-select cast('1997-30-02' as DATE) from t022t2;
+select cast('1997-30-02' as DATE) from dual;
 
-select interval'0.1'second + timestamp'12/31/9999 11:59:59.9 pm' from t022t1;
-select timestamp'12/31/9999 11:59:59.9 pm' + interval'0.1'second from t022t1;
-select timestamp'01/01/0001 00:00:00.0' + interval-'0.1'second from t022t1;
-select timestamp'01/01/0001 00:00:00.0' - interval'0.1'second from t022t1;
+select interval'0.1'second + timestamp'12/31/9999 11:59:59.9 pm' from dual;
+select timestamp'12/31/9999 11:59:59.9 pm' + interval'0.1'second from dual;
+select timestamp'01/01/0001 00:00:00.0' + interval-'0.1'second from dual;
+select timestamp'01/01/0001 00:00:00.0' - interval'0.1'second from dual;
 
-select interval'1'month + date'12/31/9999' from t022t1;
-select date'12/31/9999' + interval'1'month from t022t1;
-select date'01/01/0001' + interval-'1'month from t022t1;
-select date'01/01/0001' - interval'1'month from t022t1;
+select interval'1'month + date'12/31/9999' from dual;
+select date'12/31/9999' + interval'1'month from dual;
+select date'01/01/0001' + interval-'1'month from dual;
+select date'01/01/0001' - interval'1'month from dual;
 
-select interval'1'month + date'01/31/9999' from t022t1;
-select date'01/31/9999' + interval'1'month from t022t1;
-select date'03/30/9999' + interval-'1'month from t022t1;
-select date'03/30/9999' - interval'1'month from t022t1;
+select interval'1'month + date'01/31/9999' from dual;
+select date'01/31/9999' + interval'1'month from dual;
+select date'03/30/9999' + interval-'1'month from dual;
+select date'03/30/9999' - interval'1'month from dual;
 
 -- Negative cases to test division by zero.
 
-select cast (1 as numeric(1)) / cast (0 as numeric(1)) from t022t1;
-select cast (1 as numeric(5)) / cast (0 as numeric(1)) from t022t1;
-select cast (1 as numeric(1)) / cast (0 as numeric(5)) from t022t1;
-select cast (1 as numeric(5)) / cast (0 as numeric(5)) from t022t1;
-select cast (1 as numeric(10)) / cast (0 as numeric(10)) from t022t1;
+select cast (1 as numeric(1)) / cast (0 as numeric(1)) from dual;
+select cast (1 as numeric(5)) / cast (0 as numeric(1)) from dual;
+select cast (1 as numeric(1)) / cast (0 as numeric(5)) from dual;
+select cast (1 as numeric(5)) / cast (0 as numeric(5)) from dual;
+select cast (1 as numeric(10)) / cast (0 as numeric(10)) from dual;
 
 select cast (1 as numeric(1) unsigned) /
-       cast (0 as numeric(1) unsigned) from t022t1;
+       cast (0 as numeric(1) unsigned) from dual;
 select cast (1 as numeric(5) unsigned) /
-       cast (0 as numeric(1) unsigned) from t022t1;
+       cast (0 as numeric(1) unsigned) from dual;
 select cast (1 as numeric(1) unsigned) /
-       cast (0 as numeric(5) unsigned) from t022t1;
+       cast (0 as numeric(5) unsigned) from dual;
 select cast (1 as numeric(5) unsigned) /
-       cast (0 as numeric(5) unsigned) from t022t1;
+       cast (0 as numeric(5) unsigned) from dual;
 select cast (1 as numeric(9) unsigned) /
-       cast (0 as numeric(9) unsigned) from t022t1;
+       cast (0 as numeric(9) unsigned) from dual;
 
-select cast (1 as double precision) / cast (0 as double precision) from t022t1;
+select cast (1 as double precision) / cast (0 as double precision) from dual;
 
 -- results:  1 row selected
-select cast('66.2' as float) from t022t1 where cast('66.2' as float) = 66.2;
+select cast('66.2' as float) from dual where cast('66.2' as float) = 66.2;
 
 -- to test comparisons between signed and unsigned numbers.
 
@@ -584,25 +559,10 @@
 
 
 -- negative test cases
--- The next three tests get different results depending on whether they
--- are run using SQL/MX or SQL/MP tables.  Run them separately 
-?ifMP
-create table t022t5 (t022t5_c1 numeric( 9) unsigned,
-                     t022t5_c2 numeric(10) unsigned);
 create table t022t6 (t022t6_c1 decimal( 9) unsigned,
-                     t022t6_c2 decimal(10) unsigned);
-create table t022t7 (t022t7_c1 dec    ( 9) unsigned,
+                     t022t6_c2 decimal(10) unsigned,
+                     t022t7_c1 dec    ( 9) unsigned,
                      t022t7_c2 dec    (10) unsigned);
-?ifMP
-
-?ifMX
-create table t022t5 (t022t5_c1 numeric( 9) unsigned,
-                     t022t5_c2 numeric(10) unsigned);
-create table t022t6 (t022t6_c1 decimal( 9) unsigned,
-                     t022t6_c2 decimal(10) unsigned);
-create table t022t7 (t022t7_c1 dec    ( 9) unsigned,
-                     t022t7_c2 dec    (10) unsigned);
-?ifMX
 
 select cast(1 as numeric(10) unsigned) from (values(0))x;
 select cast(1 as decimal(10) unsigned) from (values(0))x;
@@ -723,16 +683,9 @@
        cast ('123.12' as real),
        cast ('123.E2' as real),
        cast ('123.12E2' as real)from (values(1)) as T;
-?ifNT
+
 obey t022xxx;
 select * from $$TEST_SCHEMA$$.t022a7;
-?ifNT
-?ifNSK
-?ifMX
-sh $mxcidir/import $$TEST_SCHEMA$$.t022a7 -I t022xxx;
-select * from $$TEST_SCHEMA$$.t022a7;
-?ifMX
-?ifNSK
 
 -- negative cases (expect errors)
 select cast('.-2' as int) from t022t8;
@@ -752,20 +705,11 @@
 
 -- Testing solution 10-030707-7648
 -- Catch overflow while manipulating interval internal type (decimal)
-?ifMX
 create table t022t9 (h10s4 interval hour(10) to second(4));
 insert into t022t9 values (-interval '1111111111:12:00.1234'
    hour(10) to second(4));
 insert into t022t9 values (interval '1111111111:12:00.1234'
    hour(10) to second(4));
-?ifMX
-?ifMP
-create table t022t9 (h10s4 interval hour(10) to fraction(4));
-insert into t022t9 values (-interval '1111111111:12:00.1234'
-   hour(10) to fraction(4));
-insert into t022t9 values (interval '1111111111:12:00.1234'
-   hour(10) to fraction(4));
-?ifMP
 
 -- Should not overflow.
 update t022t9 set h10s4 = h10s4 * 1;
@@ -783,7 +727,6 @@
 -- End of testing solution 10-030707-7648
 
 -- Numeric to interval converion overflow checking
-?ifMX
 create table t022ta(a interval second not null primary key);
 insert into t022ta values (interval '12.200' second(2,3));
 insert into t022ta values (interval '12.300' second(2,4));
@@ -842,17 +785,9 @@
 
 select ivsc * 0.02 from t022tc;
 
-?ifMX
-?ifMX
 create table t022td (D_to_F      INTERVAL    DAY TO SECOND(3));
 insert into t022td values (interval '18 15:17:02.123' day to second(3));
 insert into t022td values (interval '27 04:57:58.999' day to second(3));
-?ifMX
-?ifMP
-create table t022td (D_to_F      INTERVAL    DAY TO FRACTION(3));
-insert into t022td values (interval '18 15:17:02.123' day to fraction(3));
-insert into t022td values (interval '27 04:57:58.999' day to fraction(3));
-?ifMP
 select D_to_F / 1  from t022td;
 
 -- End of testing solution 10-040302-3733
@@ -864,14 +799,8 @@
 insert into t022te values (99, 23.123456);
 
 -- should not overflow
-?ifMX
 select CAST (dnum as INTERVAL second) from t022te;
-?ifMX
-?ifMP
-select CAST (dnum as INTERVAL second TO fraction) from t022te;
-?ifMP
 
-?ifMX
 create table t022tf (
     ivyr interval year (4),
     ivmt interval month,
@@ -919,163 +848,155 @@
 
 select * from t022tf;
 
-?ifMX
 -- End of testing Solution 10-040226-3566
 
 -- negative tests on casts between CHAR/NCHAR 
-?ifMX
-select cast (N'Hello, world!' as char(13)) from t022u;
-select cast (N'Hello, world!' as varchar(13)) from t022u;
-select cast ('Hello, world!' as nchar(13)) from t022u;
-select cast ('Hello, world!' as nchar varying(13)) from t022u;
+select cast (N'Hello, world!' as char(13)) from dual;
+select cast (N'Hello, world!' as varchar(13)) from dual;
+select cast ('Hello, world!' as nchar(13)) from dual;
+select cast ('Hello, world!' as nchar varying(13)) from dual;
 
 -- tests on cast VAR/NCHAR to VAR/NCHAR
-select cast (N'Hello, world!' as nchar(13)) from t022u;
-select cast (N'Hello, world!' as nchar varying(13)) from t022u;
-select cast (cast (N'Hello        ' as nchar(13)) as nchar(5)) from t022u;
-select cast (cast (N'Hello        ' as nchar(13)) as nchar varying(5)) from t022u;
-select cast (cast (N'Hello, world!' as nchar(13)) as nchar(5)) from t022u;
-select cast (cast (N'Hello, world!' as nchar(13)) as nchar varying(5)) from t022u;
-select cast (cast (N'Hello        ' as nchar varying(13)) as nchar(5)) from t022u;
-select cast (cast (N'Hello        ' as nchar varying(13)) as nchar varying(5)) from t022u;
-select cast (cast (N'Hello, world!' as nchar varying(13)) as nchar(5)) from t022u;
-select cast (cast (N'Hello, world!' as nchar varying(13)) as nchar varying(5)) from t022u;
+select cast (N'Hello, world!' as nchar(13)) from dual;
+select cast (N'Hello, world!' as nchar varying(13)) from dual;
+select cast (cast (N'Hello        ' as nchar(13)) as nchar(5)) from dual;
+select cast (cast (N'Hello        ' as nchar(13)) as nchar varying(5)) from dual;
+select cast (cast (N'Hello, world!' as nchar(13)) as nchar(5)) from dual;
+select cast (cast (N'Hello, world!' as nchar(13)) as nchar varying(5)) from dual;
+select cast (cast (N'Hello        ' as nchar varying(13)) as nchar(5)) from dual;
+select cast (cast (N'Hello        ' as nchar varying(13)) as nchar varying(5)) from dual;
+select cast (cast (N'Hello, world!' as nchar varying(13)) as nchar(5)) from dual;
+select cast (cast (N'Hello, world!' as nchar varying(13)) as nchar varying(5)) from dual;
 
 -- tests on cast VAR/NCHAR to DATETIME
-select cast (N'12.07.1961 03.04.55.123456' as timestamp) from t022u;
-select cast (N'12.07.1961 03.04.55.123456' as timestamp(3)) from t022u;
+select cast (N'12.07.1961 03.04.55.123456' as timestamp) from dual;
+select cast (N'12.07.1961 03.04.55.123456' as timestamp(3)) from dual;
 select cast (cast (N'12.07.1961 03.04.55.123456' as timestamp) as DATE) 
-from t022u;
-select cast (cast (N'12.07.1961 03.04.55.123456' as timestamp) as char(21)) from
-t022u;
-select cast (N'12/13/1987' as date) from t022u;
+from dual;
+select cast (cast (N'12.07.1961 03.04.55.123456' as timestamp) as char(21)) from dual;
+select cast (N'12/13/1987' as date) from dual;
 
 -- some negative DATE, TIME, TIMESTAMP
 -- illegal european format
-select cast (N'12.13.1987' as date) from t022u;
+select cast (N'12.13.1987' as date) from dual;
 
 -- illegal US format
-select cast (N'13/12/1987' as date) from t022u;
+select cast (N'13/12/1987' as date) from dual;
 
 -- string overflow
-select cast (cast (N'12/07/1961 03:04:55.123456' as timestamp) as char(18)) from
-t022u;
+select cast (cast (N'12/07/1961 03:04:55.123456' as timestamp) as char(18)) from dual;
 
 -- Feb. 32th doesn't exist
-select cast(N'1997-02-32' as DATE) from t022u;
+select cast(N'1997-02-32' as DATE) from dual;
 
 -- test on cast VAR/NCAR to smallint
-select cast(N'2' as SMALLINT) from t022u;
-select cast(N'-32768' as SMALLINT) from t022u;
-select cast(N'32767' as SMALLINT) from t022u;
-select cast(N'0' as SMALLINT UNSIGNED) from t022u;
-select cast(N'65535' as SMALLINT UNSIGNED) from t022u;
+select cast(N'2' as SMALLINT) from dual;
+select cast(N'-32768' as SMALLINT) from dual;
+select cast(N'32767' as SMALLINT) from dual;
+select cast(N'0' as SMALLINT UNSIGNED) from dual;
+select cast(N'65535' as SMALLINT UNSIGNED) from dual;
 
 -- negative test on cast VAR/NCAR to smallint
-select cast(N'-1' as SMALLINT UNSIGNED) from t022u;
-select cast(N'-32769' as SMALLINT) from t022u;
-select cast(N'50000' as SMALLINT) from t022u;
-select cast(N'-32769' as SMALLINT UNSIGNED) from t022u;
-select cast(N'70000' as SMALLINT UNSIGNED) from t022u;
-select cast(N'70000' as SMALLINT UNSIGNED) from t022u;
+select cast(N'-1' as SMALLINT UNSIGNED) from dual;
+select cast(N'-32769' as SMALLINT) from dual;
+select cast(N'50000' as SMALLINT) from dual;
+select cast(N'-32769' as SMALLINT UNSIGNED) from dual;
+select cast(N'70000' as SMALLINT UNSIGNED) from dual;
+select cast(N'70000' as SMALLINT UNSIGNED) from dual;
 
 -- test on cast VAR/NCAR to bit precision integer(X) unsigned
-select cast(N'1000' as bit precision integer(15) UNSIGNED) from t022u;
-select cast(N'0' as bit precision integer(15) UNSIGNED) from t022u;
-select cast(N'32767' as bit precision integer(15) UNSIGNED) from t022u;
+select cast(N'1000' as bit precision integer(15) UNSIGNED) from dual;
+select cast(N'0' as bit precision integer(15) UNSIGNED) from dual;
+select cast(N'32767' as bit precision integer(15) UNSIGNED) from dual;
 
 -- negative test on cast VAR/NCAR to bit precision integer(X) unsigned
-select cast(N'32768' as bit precision integer(15) UNSIGNED) from t022u;
-select cast(N'-1' as bit precision integer(15) UNSIGNED) from t022u;
+select cast(N'32768' as bit precision integer(15) UNSIGNED) from dual;
+select cast(N'-1' as bit precision integer(15) UNSIGNED) from dual;
 
 -- test on cast VAR/NCAR to integer
-select cast(N'4294967295' as integer unsigned) from t022u;
-select cast(N'0' as integer unsigned) from t022u;
-select cast(N'2147483647' as integer) from t022u;
-select cast(N'-2147483648' as integer) from t022u;
+select cast(N'4294967295' as integer unsigned) from dual;
+select cast(N'0' as integer unsigned) from dual;
+select cast(N'2147483647' as integer) from dual;
+select cast(N'-2147483648' as integer) from dual;
 
 -- negative test on cast VAR/NCAR to integer
-select cast(N'4294967296' as integer unsigned) from t022u;
-select cast(N'-1' as integer unsigned) from t022u;
-select cast(N'2147483648' as integer) from t022u;
-select cast(N'-2147483649' as integer) from t022u;
+select cast(N'4294967296' as integer unsigned) from dual;
+select cast(N'-1' as integer unsigned) from dual;
+select cast(N'2147483648' as integer) from dual;
+select cast(N'-2147483649' as integer) from dual;
 
 -- test on cast VAR/NCAR to largeint
-select cast(N'42949672960000' as largeint) from t022u;
+select cast(N'42949672960000' as largeint) from dual;
 
 -- test on cast VAR/NCAR to DEC 
-select cast(N'42949672960000' as DEC) from t022u;
-select cast(N'12345.56' as DEC (7,2) unsigned) from t022u;
+select cast(N'42949672960000' as DEC) from dual;
+select cast(N'12345.56' as DEC (7,2) unsigned) from dual;
 
 -- negative test on cast VAR/NCAR to DEC 
-select cast(N'1009a' as  DEC) from t022u;
+select cast(N'1009a' as  DEC) from dual;
 
-?ifMX
-?ifNT
 -- test on cast VAR/NCAR to float/real/double 
-select cast(N'-107' as float) from t022u;
-select cast(N'1.2E-001' as real) from t022u;
-select cast(N'12E-001' as double precision) from t022u;
+select cast(N'-107' as float) from dual;
+select cast(N'1.2E-001' as real) from dual;
+select cast(N'12E-001' as double precision) from dual;
 
 -- negative test on cast VAR/NCAR to float/real/double 
-select cast(N'this is not a number.' as float) from t022u;
-select cast(N'1023u' as real) from t022u;
-select cast(N'''\2' as double precision) from t022u;
-?ifNT
-?ifMX
+select cast(N'this is not a number.' as float) from dual;
+select cast(N'1023u' as real) from dual;
+select cast(N'''\2' as double precision) from dual;
 
 -- test on cast VAR/NCAR to interval 
-select cast(N'-07' as interval year) from t022u;
-select cast(N'5' as interval year) from t022u;
+select cast(N'-07' as interval year) from dual;
+select cast(N'5' as interval year) from dual;
 
 -- test on cast smallint to VAR/NCAR 
-select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(10)) from t022u;
-select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR(10)) from t022u;
-select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(10)) from t022u;
-select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR VARYING(10)) from t022u;
-select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR VARYING(10)) from t022u;
+select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(10)) from dual;
+select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR(10)) from dual;
+select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(10)) from dual;
+select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR VARYING(10)) from dual;
+select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR VARYING(10)) from dual;
 
 -- negative test on cast smallint to VAR/NCAR 
-select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(1)) from t022u;
-select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR VARYING(1)) from t022u;
+select cast(cast(N'65535' as SMALLINT UNSIGNED) as NCHAR(1)) from dual;
+select cast(cast(N'-5535' as SMALLINT SIGNED) as NCHAR VARYING(1)) from dual;
 
 -- test on cast integer to VAR/NCAR 
-select cast(cast(N'4294967295' as integer unsigned) as NCHAR VARYING(10)) from t022u;
-select cast(cast(N'0' as integer unsigned) as NCHAR(2)) from t022u;
-select cast(cast(N'2147483647' as integer) as NCHAR(12)) from t022u;
-select cast(cast(N'-2147483648' as integer) as NCHAR(12)) from t022u;
+select cast(cast(N'4294967295' as integer unsigned) as NCHAR VARYING(10)) from dual;
+select cast(cast(N'0' as integer unsigned) as NCHAR(2)) from dual;
+select cast(cast(N'2147483647' as integer) as NCHAR(12)) from dual;
+select cast(cast(N'-2147483648' as integer) as NCHAR(12)) from dual;
 
 -- negative test on cast integer to VAR/NCAR
-select cast(cast(N'4294967296' as integer unsigned) as nchar(1)) from t022u;
-select cast(cast(N'-10' as integer) as nchar(1)) from t022u;
-select cast(cast(N'2147483648' as integer) as nchar varying(1)) from t022u;
-select cast(cast(N'-2147483649' as integer) as nchar(1)) from t022u;
+select cast(cast(N'4294967296' as integer unsigned) as nchar(1)) from dual;
+select cast(cast(N'-10' as integer) as nchar(1)) from dual;
+select cast(cast(N'2147483648' as integer) as nchar varying(1)) from dual;
+select cast(cast(N'-2147483649' as integer) as nchar(1)) from dual;
 
 -- test on cast DEC to VAR/NCAR 
-select cast(cast(N'42949672960000' as DEC) as nchar(10)) from t022u;
-select cast(cast(N'12345.56' as DEC (7,2) unsigned) as nchar(20)) from t022u;
+select cast(cast(N'42949672960000' as DEC) as nchar(10)) from dual;
+select cast(cast(N'12345.56' as DEC (7,2) unsigned) as nchar(20)) from dual;
 
 -- "timestamp - timestamp" should return result in seconds
 select timestamp '2018-10-10 10:10:10' - timestamp '2017-10-10 10:10:10' from dual;
 
 -- negative test on cast DEC to VAR/NCAR 
-select cast(cast(N'12345.56' as DEC (7,2) unsigned) as nchar(2)) from t022u;
+select cast(cast(N'12345.56' as DEC (7,2) unsigned) as nchar(2)) from dual;
 
 -- test on cast date, time and timestamp to VAR/NCAR 
-select cast(date '1998-03-02' as nchar varying(11)) from t022u;
-select cast(date '1998-03-02' as nchar(11)) from t022u;
-select cast(time '08:03:02' as nchar(11)) from t022u;
-select cast(time '08:03:02 pm' as nchar(11)) from t022u;
+select cast(date '1998-03-02' as nchar varying(11)) from dual;
+select cast(date '1998-03-02' as nchar(11)) from dual;
+select cast(time '08:03:02' as nchar(11)) from dual;
+select cast(time '08:03:02 pm' as nchar(11)) from dual;
 select cast(timestamp 
-'1998-06-03 08:03:02.000000' as nchar varying(21)) from t022u;
-select cast(timestamp '1998-06-03 08:03:02.000000' as nchar(21)) from t022u;
+'1998-06-03 08:03:02.000000' as nchar varying(21)) from dual;
+select cast(timestamp '1998-06-03 08:03:02.000000' as nchar(21)) from dual;
 -- Genesis case-10-050208-6275
 -- Test on ascii to time
 
 select cast('10:13:14' as time(4)),cast('10:13:14' as time(4)) from (values(1)) as x;
 select cast('10:13:14' as time(4)),cast('10:13:14' as time(4)),current_timestamp from (values(1)) as x;
 --test on precision of time
-select cast('10:13:14' as time(7)),cast('10:13:14' as time(4));
+select cast('10:13:14' as time(10)),cast('10:13:14' as time(4)) from dual;
 --
 -- testing translate.  1998 6/12
 --
@@ -1119,9 +1040,7 @@
 select translate(time '08:03:02 pm' using iso88591ToUcs) from t022u2; -- not a char 
 select translate(timestamp '1998-06-03 08:03:02.000000' using iso88591ToUcs2) 
 from t022u2; -- not a char 
-?ifMX
 
-?ifMX
 -- New PCode comparison instructions for float32 and float64
 create table t022fltcmp(c0 char(23), c1 real not null, c2 float not null);
 -- Insert some rows
@@ -1175,8 +1094,6 @@
 select f2 from vt022bug where f2 > 8.2399999E-1 and f2 < 9.1234567E01
        group by vc1, f2 having vc1 in ('~', '~!#$%^\&');
 
-?ifMX
-
 --to test comparison between shorter signed and longer unsigned
 --comparisons that involve implicit typecast of both operands
 --to signed int.
@@ -1231,4 +1148,41 @@
 update t022u2 set a = 'lkjihgfedcba';
 select * from t022u2;
 
+-- tests for nanosecond precision for datetime and interval
+create table t022nanos(a timestamp(9), b time(9), c interval hour to second(9));
+invoke t022nanos;
+insert into t022nanos values (timestamp '2018-01-01 10:10:10.123456789',
+                              time '10:10:10.123456789',
+                              interval '10:10:10.123456789' hour to second(9));
+prepare s from insert into t022nanos values (?, ?, ?);
+execute s using '2019-02-02 11:11:11.987654321', '01:01:01.112233445',
+                 '02:02:02.111111111';
+select * from t022nanos;
+select a - a, b - b, c-c, c+c, a+c, a-c from t022nanos;
+select cast(a as char(30)), cast(b as char(20)), cast(c as char(20)) from t022nanos;
+select * from t022nanos where a = timestamp '2018-01-01 10:10:10.123456789';
+select * from t022nanos where a = timestamp '2018-01-01 10:10:10.123456788';
+
+drop table if exists hive.hive.thivets;
+create table hive.hive.thivets (a timestamp);
+insert into hive.hive.thivets values (timestamp '2018-01-01 10:10:10.123456789');
+select * from hive.hive.thivets;
+select * from hive.hive.thivets where a = timestamp '2018-01-01 10:10:10.123456788' + interval '0.000000001' second (1,9);
+
+select extract(second from a), extract(second from b), extract(second from c)
+  from t022nanos;
+
+
+-- ERROR CASES
+
+-- total precision exceeds Int64 max.
+create table t022interr(a interval second(12, 9));
+
+select timestamp '9999-01-01 10:10:10.123456789' - timestamp '2018-01-01 10:10:10.123456' from dual;
+select timestamp '2100-01-01 10:10:10.123456789' - timestamp '2018-01-01 10:10:10.123456' from dual;
+
+-- invalid timestamp, time, interval values
+execute s using '2019-02-02 11:11:11.98765432115', '01:01:01.1122334455',
+                 '02:02:02.1111111115';
+
 -- done
diff --git a/core/sql/regress/hive/DIFF008.KNOWN b/core/sql/regress/hive/DIFF008.KNOWN
index fc40bdd..2d99f1c 100644
--- a/core/sql/regress/hive/DIFF008.KNOWN
+++ b/core/sql/regress/hive/DIFF008.KNOWN
@@ -1,4 +1,4 @@
-283c283,286
+327c327,330
 < --- SQL command prepared.
 ---
 > *** ERROR[4002] Column T00804.A is not found. Table T00804 not exposed. Tables in scope: HIVE.HIVE.T00804. Default schema: HIVE.SCH008.
diff --git a/core/sql/regress/hive/DIFF009.KNOWN b/core/sql/regress/hive/DIFF009.KNOWN
index 1d1cb73..6bcba59 100644
--- a/core/sql/regress/hive/DIFF009.KNOWN
+++ b/core/sql/regress/hive/DIFF009.KNOWN
@@ -1,3 +1,3 @@
-1071a1072,1073
+1074a1075,1076
 > *** WARNING[6008] Statistics for column (D_DATE) from table HIVE.HIVE.DATE_DIM were not available. As a result, the access path chosen might not be the best possible.
 > 
diff --git a/core/sql/regress/hive/EXPECTED001 b/core/sql/regress/hive/EXPECTED001
index 7c2ca04..9ec460e 100644
--- a/core/sql/regress/hive/EXPECTED001
+++ b/core/sql/regress/hive/EXPECTED001
@@ -1158,21 +1158,21 @@
 >>
 >>select * from store ;
 
-S_STORE_SK   S_STORE_ID            S_REC_START_DATE            S_REC_END_DATE              S_CLOSED_DATE_SK  S_STORE_NAME          S_NUMBER_EMPLOYEES  S_FLOOR_SPACE  S_HOURS               S_MANAGER             S_MARKET_ID  S_GEOGRAPHY_CLASS     S_MARKET_DESC         S_MARKET_MANAGER      S_DIVISION_ID  S_DIVISION_NAME       S_COMPANY_ID  S_COMPANY_NAME        S_STREET_NUMBER       S_STREET_NAME         S_STREET_TYPE         S_SUITE_NUMBER        S_CITY                S_COUNTY              S_STATE               S_ZIP                 S_COUNTRY             S_GMT_OFFSET     S_TAX_PRECENTAGE
------------  --------------------  --------------------------  --------------------------  ----------------  --------------------  ------------------  -------------  --------------------  --------------------  -----------  --------------------  --------------------  --------------------  -------------  --------------------  ------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  ---------------  ----------------
+S_STORE_SK   S_STORE_ID            S_REC_START_DATE               S_REC_END_DATE                 S_CLOSED_DATE_SK  S_STORE_NAME          S_NUMBER_EMPLOYEES  S_FLOOR_SPACE  S_HOURS               S_MANAGER             S_MARKET_ID  S_GEOGRAPHY_CLASS     S_MARKET_DESC         S_MARKET_MANAGER      S_DIVISION_ID  S_DIVISION_NAME       S_COMPANY_ID  S_COMPANY_NAME        S_STREET_NUMBER       S_STREET_NAME         S_STREET_TYPE         S_SUITE_NUMBER        S_CITY                S_COUNTY              S_STATE               S_ZIP                 S_COUNTRY             S_GMT_OFFSET     S_TAX_PRECENTAGE
+-----------  --------------------  -----------------------------  -----------------------------  ----------------  --------------------  ------------------  -------------  --------------------  --------------------  -----------  --------------------  --------------------  --------------------  -------------  --------------------  ------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  --------------------  ---------------  ----------------
 
-          1  AAAAAAAABAAAAAAA      1997-03-13 00:00:00.000000  ?                                    2451189  ought                                245        5250760  8AM-4PM               William Ward                    2  Unknown               Enough high areas st  Charles Bartley                   1  Unknown                          1  Unknown               767                   Spring                Wy                    Suite 250             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
-          2  AAAAAAAACAAAAAAA      1997-03-13 00:00:00.000000  2000-03-12 00:00:00.000000                 ?  able                                 236        5285950  8AM-4PM               Scott Smith                     8  Unknown               Parliamentary candid  David Lamontagne                  1  Unknown                          1  Unknown               255                   Sycamore              Dr.                   Suite 410             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
-          3  AAAAAAAACAAAAAAA      2000-03-13 00:00:00.000000  ?                                          ?  able                                 236        7557959  8AM-4PM               Scott Smith                     7  Unknown               Impossible, true arm  David Lamontagne                  1  Unknown                          1  Unknown               877                   Park Laurel           Road                  Suite T               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
-          4  AAAAAAAAEAAAAAAA      1997-03-13 00:00:00.000000  1999-03-13 00:00:00.000000           2451044  ese                                  218        9341467  8AM-4PM               Edwin Adams                     4  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               27                    Lake                  Ln                    Suite 260             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
-          5  AAAAAAAAEAAAAAAA      1999-03-14 00:00:00.000000  2001-03-12 00:00:00.000000           2450910  anti                                 288        9078805  8AM-4PM               Edwin Adams                     8  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               27                    Lee 6th               Court                 Suite 80              Fairview              Williamson County     TN                    35709                 United States         -5.0000000E+000    2.9999999E-002
-          6  AAAAAAAAEAAAAAAA      2001-03-13 00:00:00.000000  ?                                          ?  cally                                229        9026222  8AM-4PM               Edwin Adams                    10  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               220                   6th                   Lane                  Suite 140             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
-          7  AAAAAAAAHAAAAAAA      1997-03-13 00:00:00.000000  ?                                          ?  ation                                297        8954883  8AM-4PM               David Thomas                    9  Unknown               Architects coul       Thomas Benton                     1  Unknown                          1  Unknown               811                   Lee                   Circle                Suite T               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    9.9999997E-003
-          8  AAAAAAAAIAAAAAAA      1997-03-13 00:00:00.000000  2000-03-12 00:00:00.000000                 ?  eing                                 278        6995995  8AM-4PM               Brett Yates                     2  Unknown               Various bars make mo  Dean Morrison                     1  Unknown                          1  Unknown               226                   12th                  Lane                  Suite D               Fairview              Williamson County     TN                    35709                 United States         -5.0000000E+000    7.9999998E-002
-          9  AAAAAAAAIAAAAAAA      2000-03-13 00:00:00.000000  ?                                          ?  eing                                 271        6995995  8AM-4PM               Brett Yates                     2  Unknown               Formal, psychologica  Dean Morrison                     1  Unknown                          1  Unknown               226                   Hill                  Boulevard             Suite 190             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    7.9999998E-002
-         10  AAAAAAAAKAAAAAAA      1997-03-13 00:00:00.000000  1999-03-13 00:00:00.000000                 ?  bar                                  294        9294113  8AM-4PM               Raymond Jacobs                  8  Unknown               Little expectations   Michael Wilson                    1  Unknown                          1  Unknown               175                   4th                   Court                 Suite C               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    5.9999998E-002
-         11  AAAAAAAAKAAAAAAA      1999-03-14 00:00:00.000000  2001-03-12 00:00:00.000000                 ?  ought                                294        9294113  8AM-4PM               Raymond Jacobs                  6  Unknown               Mysterious employe    Michael Wilson                    1  Unknown                          1  Unknown               175                   Park Green            Court                 Suite 160             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    1.0999999E-002
-         12  AAAAAAAAKAAAAAAA      2001-03-13 00:00:00.000000  ?                                          ?  ought                                294        5219562  8AM-12AM              Robert Thompson                 6  Unknown               Events develop i      Dustin Kelly                      1  Unknown                          1  Unknown               337                   College               Boulevard             Suite 100             Fairview              Williamson County     TN                    31904                 United States         -5.0000000E+000    9.9999997E-003
+          1  AAAAAAAABAAAAAAA      1997-03-13 00:00:00.000000000  ?                                       2451189  ought                                245        5250760  8AM-4PM               William Ward                    2  Unknown               Enough high areas st  Charles Bartley                   1  Unknown                          1  Unknown               767                   Spring                Wy                    Suite 250             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
+          2  AAAAAAAACAAAAAAA      1997-03-13 00:00:00.000000000  2000-03-12 00:00:00.000000000                 ?  able                                 236        5285950  8AM-4PM               Scott Smith                     8  Unknown               Parliamentary candid  David Lamontagne                  1  Unknown                          1  Unknown               255                   Sycamore              Dr.                   Suite 410             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
+          3  AAAAAAAACAAAAAAA      2000-03-13 00:00:00.000000000  ?                                             ?  able                                 236        7557959  8AM-4PM               Scott Smith                     7  Unknown               Impossible, true arm  David Lamontagne                  1  Unknown                          1  Unknown               877                   Park Laurel           Road                  Suite T               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
+          4  AAAAAAAAEAAAAAAA      1997-03-13 00:00:00.000000000  1999-03-13 00:00:00.000000000           2451044  ese                                  218        9341467  8AM-4PM               Edwin Adams                     4  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               27                    Lake                  Ln                    Suite 260             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
+          5  AAAAAAAAEAAAAAAA      1999-03-14 00:00:00.000000000  2001-03-12 00:00:00.000000000           2450910  anti                                 288        9078805  8AM-4PM               Edwin Adams                     8  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               27                    Lee 6th               Court                 Suite 80              Fairview              Williamson County     TN                    35709                 United States         -5.0000000E+000    2.9999999E-002
+          6  AAAAAAAAEAAAAAAA      2001-03-13 00:00:00.000000000  ?                                             ?  cally                                229        9026222  8AM-4PM               Edwin Adams                    10  Unknown               Events would achieve  Thomas Pollack                    1  Unknown                          1  Unknown               220                   6th                   Lane                  Suite 140             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    2.9999999E-002
+          7  AAAAAAAAHAAAAAAA      1997-03-13 00:00:00.000000000  ?                                             ?  ation                                297        8954883  8AM-4PM               David Thomas                    9  Unknown               Architects coul       Thomas Benton                     1  Unknown                          1  Unknown               811                   Lee                   Circle                Suite T               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    9.9999997E-003
+          8  AAAAAAAAIAAAAAAA      1997-03-13 00:00:00.000000000  2000-03-12 00:00:00.000000000                 ?  eing                                 278        6995995  8AM-4PM               Brett Yates                     2  Unknown               Various bars make mo  Dean Morrison                     1  Unknown                          1  Unknown               226                   12th                  Lane                  Suite D               Fairview              Williamson County     TN                    35709                 United States         -5.0000000E+000    7.9999998E-002
+          9  AAAAAAAAIAAAAAAA      2000-03-13 00:00:00.000000000  ?                                             ?  eing                                 271        6995995  8AM-4PM               Brett Yates                     2  Unknown               Formal, psychologica  Dean Morrison                     1  Unknown                          1  Unknown               226                   Hill                  Boulevard             Suite 190             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    7.9999998E-002
+         10  AAAAAAAAKAAAAAAA      1997-03-13 00:00:00.000000000  1999-03-13 00:00:00.000000000                 ?  bar                                  294        9294113  8AM-4PM               Raymond Jacobs                  8  Unknown               Little expectations   Michael Wilson                    1  Unknown                          1  Unknown               175                   4th                   Court                 Suite C               Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    5.9999998E-002
+         11  AAAAAAAAKAAAAAAA      1999-03-14 00:00:00.000000000  2001-03-12 00:00:00.000000000                 ?  ought                                294        9294113  8AM-4PM               Raymond Jacobs                  6  Unknown               Mysterious employe    Michael Wilson                    1  Unknown                          1  Unknown               175                   Park Green            Court                 Suite 160             Midway                Williamson County     TN                    31904                 United States         -5.0000000E+000    1.0999999E-002
+         12  AAAAAAAAKAAAAAAA      2001-03-13 00:00:00.000000000  ?                                             ?  ought                                294        5219562  8AM-12AM              Robert Thompson                 6  Unknown               Events develop i      Dustin Kelly                      1  Unknown                          1  Unknown               337                   College               Boulevard             Suite 100             Fairview              Williamson County     TN                    31904                 United States         -5.0000000E+000    9.9999997E-003
 
 --- 12 row(s) selected.
 >>
@@ -1180,374 +1180,374 @@
 
 *** WARNING[6008] Statistics for column (D_DATE) from table HIVE.HIVE.DATE_DIM were not available. As a result, the access path chosen might not be the best possible.
 
-D_DATE                    
---------------------------
+D_DATE                       
+-----------------------------
 
-2099-01-02 00:00:00.000000
-2099-01-03 00:00:00.000000
-2099-01-04 00:00:00.000000
-2099-01-05 00:00:00.000000
-2099-01-06 00:00:00.000000
-2099-01-07 00:00:00.000000
-2099-01-08 00:00:00.000000
-2099-01-09 00:00:00.000000
-2099-01-10 00:00:00.000000
-2099-01-11 00:00:00.000000
-2099-01-12 00:00:00.000000
-2099-01-13 00:00:00.000000
-2099-01-14 00:00:00.000000
-2099-01-15 00:00:00.000000
-2099-01-16 00:00:00.000000
-2099-01-17 00:00:00.000000
-2099-01-18 00:00:00.000000
-2099-01-19 00:00:00.000000
-2099-01-20 00:00:00.000000
-2099-01-21 00:00:00.000000
-2099-01-22 00:00:00.000000
-2099-01-23 00:00:00.000000
-2099-01-24 00:00:00.000000
-2099-01-25 00:00:00.000000
-2099-01-26 00:00:00.000000
-2099-01-27 00:00:00.000000
-2099-01-28 00:00:00.000000
-2099-01-29 00:00:00.000000
-2099-01-30 00:00:00.000000
-2099-01-31 00:00:00.000000
-2099-02-01 00:00:00.000000
-2099-02-02 00:00:00.000000
-2099-02-03 00:00:00.000000
-2099-02-04 00:00:00.000000
-2099-02-05 00:00:00.000000
-2099-02-06 00:00:00.000000
-2099-02-07 00:00:00.000000
-2099-02-08 00:00:00.000000
-2099-02-09 00:00:00.000000
-2099-02-10 00:00:00.000000
-2099-02-11 00:00:00.000000
-2099-02-12 00:00:00.000000
-2099-02-13 00:00:00.000000
-2099-02-14 00:00:00.000000
-2099-02-15 00:00:00.000000
-2099-02-16 00:00:00.000000
-2099-02-17 00:00:00.000000
-2099-02-18 00:00:00.000000
-2099-02-19 00:00:00.000000
-2099-02-20 00:00:00.000000
-2099-02-21 00:00:00.000000
-2099-02-22 00:00:00.000000
-2099-02-23 00:00:00.000000
-2099-02-24 00:00:00.000000
-2099-02-25 00:00:00.000000
-2099-02-26 00:00:00.000000
-2099-02-27 00:00:00.000000
-2099-02-28 00:00:00.000000
-2099-03-01 00:00:00.000000
-2099-03-02 00:00:00.000000
-2099-03-03 00:00:00.000000
-2099-03-04 00:00:00.000000
-2099-03-05 00:00:00.000000
-2099-03-06 00:00:00.000000
-2099-03-07 00:00:00.000000
-2099-03-08 00:00:00.000000
-2099-03-09 00:00:00.000000
-2099-03-10 00:00:00.000000
-2099-03-11 00:00:00.000000
-2099-03-12 00:00:00.000000
-2099-03-13 00:00:00.000000
-2099-03-14 00:00:00.000000
-2099-03-15 00:00:00.000000
-2099-03-16 00:00:00.000000
-2099-03-17 00:00:00.000000
-2099-03-18 00:00:00.000000
-2099-03-19 00:00:00.000000
-2099-03-20 00:00:00.000000
-2099-03-21 00:00:00.000000
-2099-03-22 00:00:00.000000
-2099-03-23 00:00:00.000000
-2099-03-24 00:00:00.000000
-2099-03-25 00:00:00.000000
-2099-03-26 00:00:00.000000
-2099-03-27 00:00:00.000000
-2099-03-28 00:00:00.000000
-2099-03-29 00:00:00.000000
-2099-03-30 00:00:00.000000
-2099-03-31 00:00:00.000000
-2099-04-01 00:00:00.000000
-2099-04-02 00:00:00.000000
-2099-04-03 00:00:00.000000
-2099-04-04 00:00:00.000000
-2099-04-05 00:00:00.000000
-2099-04-06 00:00:00.000000
-2099-04-07 00:00:00.000000
-2099-04-08 00:00:00.000000
-2099-04-09 00:00:00.000000
-2099-04-10 00:00:00.000000
-2099-04-11 00:00:00.000000
-2099-04-12 00:00:00.000000
-2099-04-13 00:00:00.000000
-2099-04-14 00:00:00.000000
-2099-04-15 00:00:00.000000
-2099-04-16 00:00:00.000000
-2099-04-17 00:00:00.000000
-2099-04-18 00:00:00.000000
-2099-04-19 00:00:00.000000
-2099-04-20 00:00:00.000000
-2099-04-21 00:00:00.000000
-2099-04-22 00:00:00.000000
-2099-04-23 00:00:00.000000
-2099-04-24 00:00:00.000000
-2099-04-25 00:00:00.000000
-2099-04-26 00:00:00.000000
-2099-04-27 00:00:00.000000
-2099-04-28 00:00:00.000000
-2099-04-29 00:00:00.000000
-2099-04-30 00:00:00.000000
-2099-05-01 00:00:00.000000
-2099-05-02 00:00:00.000000
-2099-05-03 00:00:00.000000
-2099-05-04 00:00:00.000000
-2099-05-05 00:00:00.000000
-2099-05-06 00:00:00.000000
-2099-05-07 00:00:00.000000
-2099-05-08 00:00:00.000000
-2099-05-09 00:00:00.000000
-2099-05-10 00:00:00.000000
-2099-05-11 00:00:00.000000
-2099-05-12 00:00:00.000000
-2099-05-13 00:00:00.000000
-2099-05-14 00:00:00.000000
-2099-05-15 00:00:00.000000
-2099-05-16 00:00:00.000000
-2099-05-17 00:00:00.000000
-2099-05-18 00:00:00.000000
-2099-05-19 00:00:00.000000
-2099-05-20 00:00:00.000000
-2099-05-21 00:00:00.000000
-2099-05-22 00:00:00.000000
-2099-05-23 00:00:00.000000
-2099-05-24 00:00:00.000000
-2099-05-25 00:00:00.000000
-2099-05-26 00:00:00.000000
-2099-05-27 00:00:00.000000
-2099-05-28 00:00:00.000000
-2099-05-29 00:00:00.000000
-2099-05-30 00:00:00.000000
-2099-05-31 00:00:00.000000
-2099-06-01 00:00:00.000000
-2099-06-02 00:00:00.000000
-2099-06-03 00:00:00.000000
-2099-06-04 00:00:00.000000
-2099-06-05 00:00:00.000000
-2099-06-06 00:00:00.000000
-2099-06-07 00:00:00.000000
-2099-06-08 00:00:00.000000
-2099-06-09 00:00:00.000000
-2099-06-10 00:00:00.000000
-2099-06-11 00:00:00.000000
-2099-06-12 00:00:00.000000
-2099-06-13 00:00:00.000000
-2099-06-14 00:00:00.000000
-2099-06-15 00:00:00.000000
-2099-06-16 00:00:00.000000
-2099-06-17 00:00:00.000000
-2099-06-18 00:00:00.000000
-2099-06-19 00:00:00.000000
-2099-06-20 00:00:00.000000
-2099-06-21 00:00:00.000000
-2099-06-22 00:00:00.000000
-2099-06-23 00:00:00.000000
-2099-06-24 00:00:00.000000
-2099-06-25 00:00:00.000000
-2099-06-26 00:00:00.000000
-2099-06-27 00:00:00.000000
-2099-06-28 00:00:00.000000
-2099-06-29 00:00:00.000000
-2099-06-30 00:00:00.000000
-2099-07-01 00:00:00.000000
-2099-07-02 00:00:00.000000
-2099-07-03 00:00:00.000000
-2099-07-04 00:00:00.000000
-2099-07-05 00:00:00.000000
-2099-07-06 00:00:00.000000
-2099-07-07 00:00:00.000000
-2099-07-08 00:00:00.000000
-2099-07-09 00:00:00.000000
-2099-07-10 00:00:00.000000
-2099-07-11 00:00:00.000000
-2099-07-12 00:00:00.000000
-2099-07-13 00:00:00.000000
-2099-07-14 00:00:00.000000
-2099-07-15 00:00:00.000000
-2099-07-16 00:00:00.000000
-2099-07-17 00:00:00.000000
-2099-07-18 00:00:00.000000
-2099-07-19 00:00:00.000000
-2099-07-20 00:00:00.000000
-2099-07-21 00:00:00.000000
-2099-07-22 00:00:00.000000
-2099-07-23 00:00:00.000000
-2099-07-24 00:00:00.000000
-2099-07-25 00:00:00.000000
-2099-07-26 00:00:00.000000
-2099-07-27 00:00:00.000000
-2099-07-28 00:00:00.000000
-2099-07-29 00:00:00.000000
-2099-07-30 00:00:00.000000
-2099-07-31 00:00:00.000000
-2099-08-01 00:00:00.000000
-2099-08-02 00:00:00.000000
-2099-08-03 00:00:00.000000
-2099-08-04 00:00:00.000000
-2099-08-05 00:00:00.000000
-2099-08-06 00:00:00.000000
-2099-08-07 00:00:00.000000
-2099-08-08 00:00:00.000000
-2099-08-09 00:00:00.000000
-2099-08-10 00:00:00.000000
-2099-08-11 00:00:00.000000
-2099-08-12 00:00:00.000000
-2099-08-13 00:00:00.000000
-2099-08-14 00:00:00.000000
-2099-08-15 00:00:00.000000
-2099-08-16 00:00:00.000000
-2099-08-17 00:00:00.000000
-2099-08-18 00:00:00.000000
-2099-08-19 00:00:00.000000
-2099-08-20 00:00:00.000000
-2099-08-21 00:00:00.000000
-2099-08-22 00:00:00.000000
-2099-08-23 00:00:00.000000
-2099-08-24 00:00:00.000000
-2099-08-25 00:00:00.000000
-2099-08-26 00:00:00.000000
-2099-08-27 00:00:00.000000
-2099-08-28 00:00:00.000000
-2099-08-29 00:00:00.000000
-2099-08-30 00:00:00.000000
-2099-08-31 00:00:00.000000
-2099-09-01 00:00:00.000000
-2099-09-02 00:00:00.000000
-2099-09-03 00:00:00.000000
-2099-09-04 00:00:00.000000
-2099-09-05 00:00:00.000000
-2099-09-06 00:00:00.000000
-2099-09-07 00:00:00.000000
-2099-09-08 00:00:00.000000
-2099-09-09 00:00:00.000000
-2099-09-10 00:00:00.000000
-2099-09-11 00:00:00.000000
-2099-09-12 00:00:00.000000
-2099-09-13 00:00:00.000000
-2099-09-14 00:00:00.000000
-2099-09-15 00:00:00.000000
-2099-09-16 00:00:00.000000
-2099-09-17 00:00:00.000000
-2099-09-18 00:00:00.000000
-2099-09-19 00:00:00.000000
-2099-09-20 00:00:00.000000
-2099-09-21 00:00:00.000000
-2099-09-22 00:00:00.000000
-2099-09-23 00:00:00.000000
-2099-09-24 00:00:00.000000
-2099-09-25 00:00:00.000000
-2099-09-26 00:00:00.000000
-2099-09-27 00:00:00.000000
-2099-09-28 00:00:00.000000
-2099-09-29 00:00:00.000000
-2099-09-30 00:00:00.000000
-2099-10-01 00:00:00.000000
-2099-10-02 00:00:00.000000
-2099-10-03 00:00:00.000000
-2099-10-04 00:00:00.000000
-2099-10-05 00:00:00.000000
-2099-10-06 00:00:00.000000
-2099-10-07 00:00:00.000000
-2099-10-08 00:00:00.000000
-2099-10-09 00:00:00.000000
-2099-10-10 00:00:00.000000
-2099-10-11 00:00:00.000000
-2099-10-12 00:00:00.000000
-2099-10-13 00:00:00.000000
-2099-10-14 00:00:00.000000
-2099-10-15 00:00:00.000000
-2099-10-16 00:00:00.000000
-2099-10-17 00:00:00.000000
-2099-10-18 00:00:00.000000
-2099-10-19 00:00:00.000000
-2099-10-20 00:00:00.000000
-2099-10-21 00:00:00.000000
-2099-10-22 00:00:00.000000
-2099-10-23 00:00:00.000000
-2099-10-24 00:00:00.000000
-2099-10-25 00:00:00.000000
-2099-10-26 00:00:00.000000
-2099-10-27 00:00:00.000000
-2099-10-28 00:00:00.000000
-2099-10-29 00:00:00.000000
-2099-10-30 00:00:00.000000
-2099-10-31 00:00:00.000000
-2099-11-01 00:00:00.000000
-2099-11-02 00:00:00.000000
-2099-11-03 00:00:00.000000
-2099-11-04 00:00:00.000000
-2099-11-05 00:00:00.000000
-2099-11-06 00:00:00.000000
-2099-11-07 00:00:00.000000
-2099-11-08 00:00:00.000000
-2099-11-09 00:00:00.000000
-2099-11-10 00:00:00.000000
-2099-11-11 00:00:00.000000
-2099-11-12 00:00:00.000000
-2099-11-13 00:00:00.000000
-2099-11-14 00:00:00.000000
-2099-11-15 00:00:00.000000
-2099-11-16 00:00:00.000000
-2099-11-17 00:00:00.000000
-2099-11-18 00:00:00.000000
-2099-11-19 00:00:00.000000
-2099-11-20 00:00:00.000000
-2099-11-21 00:00:00.000000
-2099-11-22 00:00:00.000000
-2099-11-23 00:00:00.000000
-2099-11-24 00:00:00.000000
-2099-11-25 00:00:00.000000
-2099-11-26 00:00:00.000000
-2099-11-27 00:00:00.000000
-2099-11-28 00:00:00.000000
-2099-11-29 00:00:00.000000
-2099-11-30 00:00:00.000000
-2099-12-01 00:00:00.000000
-2099-12-02 00:00:00.000000
-2099-12-03 00:00:00.000000
-2099-12-04 00:00:00.000000
-2099-12-05 00:00:00.000000
-2099-12-06 00:00:00.000000
-2099-12-07 00:00:00.000000
-2099-12-08 00:00:00.000000
-2099-12-09 00:00:00.000000
-2099-12-10 00:00:00.000000
-2099-12-11 00:00:00.000000
-2099-12-12 00:00:00.000000
-2099-12-13 00:00:00.000000
-2099-12-14 00:00:00.000000
-2099-12-15 00:00:00.000000
-2099-12-16 00:00:00.000000
-2099-12-17 00:00:00.000000
-2099-12-18 00:00:00.000000
-2099-12-19 00:00:00.000000
-2099-12-20 00:00:00.000000
-2099-12-21 00:00:00.000000
-2099-12-22 00:00:00.000000
-2099-12-23 00:00:00.000000
-2099-12-24 00:00:00.000000
-2099-12-25 00:00:00.000000
-2099-12-26 00:00:00.000000
-2099-12-27 00:00:00.000000
-2099-12-28 00:00:00.000000
-2099-12-29 00:00:00.000000
-2099-12-30 00:00:00.000000
-2099-12-31 00:00:00.000000
-2100-01-01 00:00:00.000000
+2099-01-02 00:00:00.000000000
+2099-01-03 00:00:00.000000000
+2099-01-04 00:00:00.000000000
+2099-01-05 00:00:00.000000000
+2099-01-06 00:00:00.000000000
+2099-01-07 00:00:00.000000000
+2099-01-08 00:00:00.000000000
+2099-01-09 00:00:00.000000000
+2099-01-10 00:00:00.000000000
+2099-01-11 00:00:00.000000000
+2099-01-12 00:00:00.000000000
+2099-01-13 00:00:00.000000000
+2099-01-14 00:00:00.000000000
+2099-01-15 00:00:00.000000000
+2099-01-16 00:00:00.000000000
+2099-01-17 00:00:00.000000000
+2099-01-18 00:00:00.000000000
+2099-01-19 00:00:00.000000000
+2099-01-20 00:00:00.000000000
+2099-01-21 00:00:00.000000000
+2099-01-22 00:00:00.000000000
+2099-01-23 00:00:00.000000000
+2099-01-24 00:00:00.000000000
+2099-01-25 00:00:00.000000000
+2099-01-26 00:00:00.000000000
+2099-01-27 00:00:00.000000000
+2099-01-28 00:00:00.000000000
+2099-01-29 00:00:00.000000000
+2099-01-30 00:00:00.000000000
+2099-01-31 00:00:00.000000000
+2099-02-01 00:00:00.000000000
+2099-02-02 00:00:00.000000000
+2099-02-03 00:00:00.000000000
+2099-02-04 00:00:00.000000000
+2099-02-05 00:00:00.000000000
+2099-02-06 00:00:00.000000000
+2099-02-07 00:00:00.000000000
+2099-02-08 00:00:00.000000000
+2099-02-09 00:00:00.000000000
+2099-02-10 00:00:00.000000000
+2099-02-11 00:00:00.000000000
+2099-02-12 00:00:00.000000000
+2099-02-13 00:00:00.000000000
+2099-02-14 00:00:00.000000000
+2099-02-15 00:00:00.000000000
+2099-02-16 00:00:00.000000000
+2099-02-17 00:00:00.000000000
+2099-02-18 00:00:00.000000000
+2099-02-19 00:00:00.000000000
+2099-02-20 00:00:00.000000000
+2099-02-21 00:00:00.000000000
+2099-02-22 00:00:00.000000000
+2099-02-23 00:00:00.000000000
+2099-02-24 00:00:00.000000000
+2099-02-25 00:00:00.000000000
+2099-02-26 00:00:00.000000000
+2099-02-27 00:00:00.000000000
+2099-02-28 00:00:00.000000000
+2099-03-01 00:00:00.000000000
+2099-03-02 00:00:00.000000000
+2099-03-03 00:00:00.000000000
+2099-03-04 00:00:00.000000000
+2099-03-05 00:00:00.000000000
+2099-03-06 00:00:00.000000000
+2099-03-07 00:00:00.000000000
+2099-03-08 00:00:00.000000000
+2099-03-09 00:00:00.000000000
+2099-03-10 00:00:00.000000000
+2099-03-11 00:00:00.000000000
+2099-03-12 00:00:00.000000000
+2099-03-13 00:00:00.000000000
+2099-03-14 00:00:00.000000000
+2099-03-15 00:00:00.000000000
+2099-03-16 00:00:00.000000000
+2099-03-17 00:00:00.000000000
+2099-03-18 00:00:00.000000000
+2099-03-19 00:00:00.000000000
+2099-03-20 00:00:00.000000000
+2099-03-21 00:00:00.000000000
+2099-03-22 00:00:00.000000000
+2099-03-23 00:00:00.000000000
+2099-03-24 00:00:00.000000000
+2099-03-25 00:00:00.000000000
+2099-03-26 00:00:00.000000000
+2099-03-27 00:00:00.000000000
+2099-03-28 00:00:00.000000000
+2099-03-29 00:00:00.000000000
+2099-03-30 00:00:00.000000000
+2099-03-31 00:00:00.000000000
+2099-04-01 00:00:00.000000000
+2099-04-02 00:00:00.000000000
+2099-04-03 00:00:00.000000000
+2099-04-04 00:00:00.000000000
+2099-04-05 00:00:00.000000000
+2099-04-06 00:00:00.000000000
+2099-04-07 00:00:00.000000000
+2099-04-08 00:00:00.000000000
+2099-04-09 00:00:00.000000000
+2099-04-10 00:00:00.000000000
+2099-04-11 00:00:00.000000000
+2099-04-12 00:00:00.000000000
+2099-04-13 00:00:00.000000000
+2099-04-14 00:00:00.000000000
+2099-04-15 00:00:00.000000000
+2099-04-16 00:00:00.000000000
+2099-04-17 00:00:00.000000000
+2099-04-18 00:00:00.000000000
+2099-04-19 00:00:00.000000000
+2099-04-20 00:00:00.000000000
+2099-04-21 00:00:00.000000000
+2099-04-22 00:00:00.000000000
+2099-04-23 00:00:00.000000000
+2099-04-24 00:00:00.000000000
+2099-04-25 00:00:00.000000000
+2099-04-26 00:00:00.000000000
+2099-04-27 00:00:00.000000000
+2099-04-28 00:00:00.000000000
+2099-04-29 00:00:00.000000000
+2099-04-30 00:00:00.000000000
+2099-05-01 00:00:00.000000000
+2099-05-02 00:00:00.000000000
+2099-05-03 00:00:00.000000000
+2099-05-04 00:00:00.000000000
+2099-05-05 00:00:00.000000000
+2099-05-06 00:00:00.000000000
+2099-05-07 00:00:00.000000000
+2099-05-08 00:00:00.000000000
+2099-05-09 00:00:00.000000000
+2099-05-10 00:00:00.000000000
+2099-05-11 00:00:00.000000000
+2099-05-12 00:00:00.000000000
+2099-05-13 00:00:00.000000000
+2099-05-14 00:00:00.000000000
+2099-05-15 00:00:00.000000000
+2099-05-16 00:00:00.000000000
+2099-05-17 00:00:00.000000000
+2099-05-18 00:00:00.000000000
+2099-05-19 00:00:00.000000000
+2099-05-20 00:00:00.000000000
+2099-05-21 00:00:00.000000000
+2099-05-22 00:00:00.000000000
+2099-05-23 00:00:00.000000000
+2099-05-24 00:00:00.000000000
+2099-05-25 00:00:00.000000000
+2099-05-26 00:00:00.000000000
+2099-05-27 00:00:00.000000000
+2099-05-28 00:00:00.000000000
+2099-05-29 00:00:00.000000000
+2099-05-30 00:00:00.000000000
+2099-05-31 00:00:00.000000000
+2099-06-01 00:00:00.000000000
+2099-06-02 00:00:00.000000000
+2099-06-03 00:00:00.000000000
+2099-06-04 00:00:00.000000000
+2099-06-05 00:00:00.000000000
+2099-06-06 00:00:00.000000000
+2099-06-07 00:00:00.000000000
+2099-06-08 00:00:00.000000000
+2099-06-09 00:00:00.000000000
+2099-06-10 00:00:00.000000000
+2099-06-11 00:00:00.000000000
+2099-06-12 00:00:00.000000000
+2099-06-13 00:00:00.000000000
+2099-06-14 00:00:00.000000000
+2099-06-15 00:00:00.000000000
+2099-06-16 00:00:00.000000000
+2099-06-17 00:00:00.000000000
+2099-06-18 00:00:00.000000000
+2099-06-19 00:00:00.000000000
+2099-06-20 00:00:00.000000000
+2099-06-21 00:00:00.000000000
+2099-06-22 00:00:00.000000000
+2099-06-23 00:00:00.000000000
+2099-06-24 00:00:00.000000000
+2099-06-25 00:00:00.000000000
+2099-06-26 00:00:00.000000000
+2099-06-27 00:00:00.000000000
+2099-06-28 00:00:00.000000000
+2099-06-29 00:00:00.000000000
+2099-06-30 00:00:00.000000000
+2099-07-01 00:00:00.000000000
+2099-07-02 00:00:00.000000000
+2099-07-03 00:00:00.000000000
+2099-07-04 00:00:00.000000000
+2099-07-05 00:00:00.000000000
+2099-07-06 00:00:00.000000000
+2099-07-07 00:00:00.000000000
+2099-07-08 00:00:00.000000000
+2099-07-09 00:00:00.000000000
+2099-07-10 00:00:00.000000000
+2099-07-11 00:00:00.000000000
+2099-07-12 00:00:00.000000000
+2099-07-13 00:00:00.000000000
+2099-07-14 00:00:00.000000000
+2099-07-15 00:00:00.000000000
+2099-07-16 00:00:00.000000000
+2099-07-17 00:00:00.000000000
+2099-07-18 00:00:00.000000000
+2099-07-19 00:00:00.000000000
+2099-07-20 00:00:00.000000000
+2099-07-21 00:00:00.000000000
+2099-07-22 00:00:00.000000000
+2099-07-23 00:00:00.000000000
+2099-07-24 00:00:00.000000000
+2099-07-25 00:00:00.000000000
+2099-07-26 00:00:00.000000000
+2099-07-27 00:00:00.000000000
+2099-07-28 00:00:00.000000000
+2099-07-29 00:00:00.000000000
+2099-07-30 00:00:00.000000000
+2099-07-31 00:00:00.000000000
+2099-08-01 00:00:00.000000000
+2099-08-02 00:00:00.000000000
+2099-08-03 00:00:00.000000000
+2099-08-04 00:00:00.000000000
+2099-08-05 00:00:00.000000000
+2099-08-06 00:00:00.000000000
+2099-08-07 00:00:00.000000000
+2099-08-08 00:00:00.000000000
+2099-08-09 00:00:00.000000000
+2099-08-10 00:00:00.000000000
+2099-08-11 00:00:00.000000000
+2099-08-12 00:00:00.000000000
+2099-08-13 00:00:00.000000000
+2099-08-14 00:00:00.000000000
+2099-08-15 00:00:00.000000000
+2099-08-16 00:00:00.000000000
+2099-08-17 00:00:00.000000000
+2099-08-18 00:00:00.000000000
+2099-08-19 00:00:00.000000000
+2099-08-20 00:00:00.000000000
+2099-08-21 00:00:00.000000000
+2099-08-22 00:00:00.000000000
+2099-08-23 00:00:00.000000000
+2099-08-24 00:00:00.000000000
+2099-08-25 00:00:00.000000000
+2099-08-26 00:00:00.000000000
+2099-08-27 00:00:00.000000000
+2099-08-28 00:00:00.000000000
+2099-08-29 00:00:00.000000000
+2099-08-30 00:00:00.000000000
+2099-08-31 00:00:00.000000000
+2099-09-01 00:00:00.000000000
+2099-09-02 00:00:00.000000000
+2099-09-03 00:00:00.000000000
+2099-09-04 00:00:00.000000000
+2099-09-05 00:00:00.000000000
+2099-09-06 00:00:00.000000000
+2099-09-07 00:00:00.000000000
+2099-09-08 00:00:00.000000000
+2099-09-09 00:00:00.000000000
+2099-09-10 00:00:00.000000000
+2099-09-11 00:00:00.000000000
+2099-09-12 00:00:00.000000000
+2099-09-13 00:00:00.000000000
+2099-09-14 00:00:00.000000000
+2099-09-15 00:00:00.000000000
+2099-09-16 00:00:00.000000000
+2099-09-17 00:00:00.000000000
+2099-09-18 00:00:00.000000000
+2099-09-19 00:00:00.000000000
+2099-09-20 00:00:00.000000000
+2099-09-21 00:00:00.000000000
+2099-09-22 00:00:00.000000000
+2099-09-23 00:00:00.000000000
+2099-09-24 00:00:00.000000000
+2099-09-25 00:00:00.000000000
+2099-09-26 00:00:00.000000000
+2099-09-27 00:00:00.000000000
+2099-09-28 00:00:00.000000000
+2099-09-29 00:00:00.000000000
+2099-09-30 00:00:00.000000000
+2099-10-01 00:00:00.000000000
+2099-10-02 00:00:00.000000000
+2099-10-03 00:00:00.000000000
+2099-10-04 00:00:00.000000000
+2099-10-05 00:00:00.000000000
+2099-10-06 00:00:00.000000000
+2099-10-07 00:00:00.000000000
+2099-10-08 00:00:00.000000000
+2099-10-09 00:00:00.000000000
+2099-10-10 00:00:00.000000000
+2099-10-11 00:00:00.000000000
+2099-10-12 00:00:00.000000000
+2099-10-13 00:00:00.000000000
+2099-10-14 00:00:00.000000000
+2099-10-15 00:00:00.000000000
+2099-10-16 00:00:00.000000000
+2099-10-17 00:00:00.000000000
+2099-10-18 00:00:00.000000000
+2099-10-19 00:00:00.000000000
+2099-10-20 00:00:00.000000000
+2099-10-21 00:00:00.000000000
+2099-10-22 00:00:00.000000000
+2099-10-23 00:00:00.000000000
+2099-10-24 00:00:00.000000000
+2099-10-25 00:00:00.000000000
+2099-10-26 00:00:00.000000000
+2099-10-27 00:00:00.000000000
+2099-10-28 00:00:00.000000000
+2099-10-29 00:00:00.000000000
+2099-10-30 00:00:00.000000000
+2099-10-31 00:00:00.000000000
+2099-11-01 00:00:00.000000000
+2099-11-02 00:00:00.000000000
+2099-11-03 00:00:00.000000000
+2099-11-04 00:00:00.000000000
+2099-11-05 00:00:00.000000000
+2099-11-06 00:00:00.000000000
+2099-11-07 00:00:00.000000000
+2099-11-08 00:00:00.000000000
+2099-11-09 00:00:00.000000000
+2099-11-10 00:00:00.000000000
+2099-11-11 00:00:00.000000000
+2099-11-12 00:00:00.000000000
+2099-11-13 00:00:00.000000000
+2099-11-14 00:00:00.000000000
+2099-11-15 00:00:00.000000000
+2099-11-16 00:00:00.000000000
+2099-11-17 00:00:00.000000000
+2099-11-18 00:00:00.000000000
+2099-11-19 00:00:00.000000000
+2099-11-20 00:00:00.000000000
+2099-11-21 00:00:00.000000000
+2099-11-22 00:00:00.000000000
+2099-11-23 00:00:00.000000000
+2099-11-24 00:00:00.000000000
+2099-11-25 00:00:00.000000000
+2099-11-26 00:00:00.000000000
+2099-11-27 00:00:00.000000000
+2099-11-28 00:00:00.000000000
+2099-11-29 00:00:00.000000000
+2099-11-30 00:00:00.000000000
+2099-12-01 00:00:00.000000000
+2099-12-02 00:00:00.000000000
+2099-12-03 00:00:00.000000000
+2099-12-04 00:00:00.000000000
+2099-12-05 00:00:00.000000000
+2099-12-06 00:00:00.000000000
+2099-12-07 00:00:00.000000000
+2099-12-08 00:00:00.000000000
+2099-12-09 00:00:00.000000000
+2099-12-10 00:00:00.000000000
+2099-12-11 00:00:00.000000000
+2099-12-12 00:00:00.000000000
+2099-12-13 00:00:00.000000000
+2099-12-14 00:00:00.000000000
+2099-12-15 00:00:00.000000000
+2099-12-16 00:00:00.000000000
+2099-12-17 00:00:00.000000000
+2099-12-18 00:00:00.000000000
+2099-12-19 00:00:00.000000000
+2099-12-20 00:00:00.000000000
+2099-12-21 00:00:00.000000000
+2099-12-22 00:00:00.000000000
+2099-12-23 00:00:00.000000000
+2099-12-24 00:00:00.000000000
+2099-12-25 00:00:00.000000000
+2099-12-26 00:00:00.000000000
+2099-12-27 00:00:00.000000000
+2099-12-28 00:00:00.000000000
+2099-12-29 00:00:00.000000000
+2099-12-30 00:00:00.000000000
+2099-12-31 00:00:00.000000000
+2100-01-01 00:00:00.000000000
 
 --- 365 row(s) selected.
 >>
diff --git a/core/sql/regress/hive/EXPECTED004 b/core/sql/regress/hive/EXPECTED004
index 5458c3b..99174ee 100644
--- a/core/sql/regress/hive/EXPECTED004
+++ b/core/sql/regress/hive/EXPECTED004
@@ -546,21 +546,21 @@
 --- 100 row(s) selected.
 >>select * from hive.ins_store order by S_STORE_SK;
 
-S_STORE_SK   S_STORE_ID                 S_REC_START_DATE            S_REC_END_DATE              S_CLOSED_DATE_SK  S_STORE_NAME               S_NUMBER_EMPLOYEES  S_FLOOR_SPACE  S_HOURS                    S_MANAGER                  S_MARKET_ID  S_GEOGRAPHY_CLASS          S_MARKET_DESC              S_MARKET_MANAGER           S_DIVISION_ID  S_DIVISION_NAME            S_COMPANY_ID  S_COMPANY_NAME             S_STREET_NUMBER            S_STREET_NAME              S_STREET_TYPE              S_SUITE_NUMBER             S_CITY                     S_COUNTY                   S_STATE                    S_ZIP                      S_COUNTRY                  S_GMT_OFFSET     S_TAX_PRECENTAGE
------------  -------------------------  --------------------------  --------------------------  ----------------  -------------------------  ------------------  -------------  -------------------------  -------------------------  -----------  -------------------------  -------------------------  -------------------------  -------------  -------------------------  ------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  ---------------  ----------------
+S_STORE_SK   S_STORE_ID                 S_REC_START_DATE               S_REC_END_DATE                 S_CLOSED_DATE_SK  S_STORE_NAME               S_NUMBER_EMPLOYEES  S_FLOOR_SPACE  S_HOURS                    S_MANAGER                  S_MARKET_ID  S_GEOGRAPHY_CLASS          S_MARKET_DESC              S_MARKET_MANAGER           S_DIVISION_ID  S_DIVISION_NAME            S_COMPANY_ID  S_COMPANY_NAME             S_STREET_NUMBER            S_STREET_NAME              S_STREET_TYPE              S_SUITE_NUMBER             S_CITY                     S_COUNTY                   S_STATE                    S_ZIP                      S_COUNTRY                  S_GMT_OFFSET     S_TAX_PRECENTAGE
+-----------  -------------------------  -----------------------------  -----------------------------  ----------------  -------------------------  ------------------  -------------  -------------------------  -------------------------  -----------  -------------------------  -------------------------  -------------------------  -------------  -------------------------  ------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  -------------------------  ---------------  ----------------
 
-          1  AAAAAAAABAAAAAAA           1997-03-13 00:00:00.000000  ?                                    2451189  ought                                     245        5250760  8AM-4PM                    William Ward                         2  Unknown                    Enough high areas stop ex  Charles Bartley                        1  Unknown                               1  Unknown                    767                        Spring                     Wy                         Suite 250                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    2.9999999E-002
-          2  AAAAAAAACAAAAAAA           1997-03-13 00:00:00.000000  2000-03-12 00:00:00.000000                 ?  able                                      236        5285950  8AM-4PM                    Scott Smith                          8  Unknown                    Parliamentary candidates   David Lamontagne                       1  Unknown                               1  Unknown                    255                        Sycamore                   Dr.                        Suite 410                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    2.9999999E-002
-          3  AAAAAAAACAAAAAAA           2000-03-13 00:00:00.000000  ?                                          ?  able                                      236        7557959  8AM-4PM                    Scott Smith                          7  Unknown                    Impossible, true arms can  David Lamontagne                       1  Unknown                               1  Unknown                    877                        Park Laurel                Road                       Suite T                    Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    2.9999999E-002
-          4  AAAAAAAAEAAAAAAA           1997-03-13 00:00:00.000000  1999-03-13 00:00:00.000000           2451044  ese                                       218        9341467  8AM-4PM                    Edwin Adams                          4  Unknown                    Events would achieve othe  Thomas Pollack                         1  Unknown                               1  Unknown                    27                         Lake                       Ln                         Suite 260                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    2.9999999E-002
-          5  AAAAAAAAEAAAAAAA           1999-03-14 00:00:00.000000  2001-03-12 00:00:00.000000           2450910  anti                                      288        9078805  8AM-4PM                    Edwin Adams                          8  Unknown                    Events would achieve othe  Thomas Pollack                         1  Unknown                               1  Unknown                    27                         Lee 6th                    Court                      Suite 80                   Fairview                   Williamson County          TN                         35709                      United States              -5.0000000E+000    2.9999999E-002
-          6  AAAAAAAAEAAAAAAA           2001-03-13 00:00:00.000000  ?                                          ?  cally                                     229        9026222  8AM-4PM                    Edwin Adams                         10  Unknown                    Events would achieve othe  Thomas Pollack                         1  Unknown                               1  Unknown                    220                        6th                        Lane                       Suite 140                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    2.9999999E-002
-          7  AAAAAAAAHAAAAAAA           1997-03-13 00:00:00.000000  ?                                          ?  ation                                     297        8954883  8AM-4PM                    David Thomas                         9  Unknown                    Architects coul            Thomas Benton                          1  Unknown                               1  Unknown                    811                        Lee                        Circle                     Suite T                    Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    9.9999997E-003
-          8  AAAAAAAAIAAAAAAA           1997-03-13 00:00:00.000000  2000-03-12 00:00:00.000000                 ?  eing                                      278        6995995  8AM-4PM                    Brett Yates                          2  Unknown                    Various bars make most. D  Dean Morrison                          1  Unknown                               1  Unknown                    226                        12th                       Lane                       Suite D                    Fairview                   Williamson County          TN                         35709                      United States              -5.0000000E+000    7.9999998E-002
-          9  AAAAAAAAIAAAAAAA           2000-03-13 00:00:00.000000  ?                                          ?  eing                                      271        6995995  8AM-4PM                    Brett Yates                          2  Unknown                    Formal, psychological pou  Dean Morrison                          1  Unknown                               1  Unknown                    226                        Hill                       Boulevard                  Suite 190                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    7.9999998E-002
-         10  AAAAAAAAKAAAAAAA           1997-03-13 00:00:00.000000  1999-03-13 00:00:00.000000                 ?  bar                                       294        9294113  8AM-4PM                    Raymond Jacobs                       8  Unknown                    Little expectations inclu  Michael Wilson                         1  Unknown                               1  Unknown                    175                        4th                        Court                      Suite C                    Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    5.9999998E-002
-         11  AAAAAAAAKAAAAAAA           1999-03-14 00:00:00.000000  2001-03-12 00:00:00.000000                 ?  ought                                     294        9294113  8AM-4PM                    Raymond Jacobs                       6  Unknown                    Mysterious employe         Michael Wilson                         1  Unknown                               1  Unknown                    175                        Park Green                 Court                      Suite 160                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    1.0999999E-002
-         12  AAAAAAAAKAAAAAAA           2001-03-13 00:00:00.000000  ?                                          ?  ought                                     294        5219562  8AM-12AM                   Robert Thompson                      6  Unknown                    Events develop i           Dustin Kelly                           1  Unknown                               1  Unknown                    337                        College                    Boulevard                  Suite 100                  Fairview                   Williamson County          TN                         31904                      United States              -5.0000000E+000    9.9999997E-003
+          1  AAAAAAAABAAAAAAA           1997-03-13 00:00:00.000000000  ?                                       2451189  ought                                     245        5250760  8AM-4PM                    William Ward                         2  Unknown                    Enough high areas stop ex  Charles Bartley                        1  Unknown                               1  Unknown                    767                        Spring                     Wy                         Suite 250                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    2.9999999E-002
+          2  AAAAAAAACAAAAAAA           1997-03-13 00:00:00.000000000  2000-03-12 00:00:00.000000000                 ?  able                                      236        5285950  8AM-4PM                    Scott Smith                          8  Unknown                    Parliamentary candidates   David Lamontagne                       1  Unknown                               1  Unknown                    255                        Sycamore                   Dr.                        Suite 410                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    2.9999999E-002
+          3  AAAAAAAACAAAAAAA           2000-03-13 00:00:00.000000000  ?                                             ?  able                                      236        7557959  8AM-4PM                    Scott Smith                          7  Unknown                    Impossible, true arms can  David Lamontagne                       1  Unknown                               1  Unknown                    877                        Park Laurel                Road                       Suite T                    Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    2.9999999E-002
+          4  AAAAAAAAEAAAAAAA           1997-03-13 00:00:00.000000000  1999-03-13 00:00:00.000000000           2451044  ese                                       218        9341467  8AM-4PM                    Edwin Adams                          4  Unknown                    Events would achieve othe  Thomas Pollack                         1  Unknown                               1  Unknown                    27                         Lake                       Ln                         Suite 260                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    2.9999999E-002
+          5  AAAAAAAAEAAAAAAA           1999-03-14 00:00:00.000000000  2001-03-12 00:00:00.000000000           2450910  anti                                      288        9078805  8AM-4PM                    Edwin Adams                          8  Unknown                    Events would achieve othe  Thomas Pollack                         1  Unknown                               1  Unknown                    27                         Lee 6th                    Court                      Suite 80                   Fairview                   Williamson County          TN                         35709                      United States              -5.0000000E+000    2.9999999E-002
+          6  AAAAAAAAEAAAAAAA           2001-03-13 00:00:00.000000000  ?                                             ?  cally                                     229        9026222  8AM-4PM                    Edwin Adams                         10  Unknown                    Events would achieve othe  Thomas Pollack                         1  Unknown                               1  Unknown                    220                        6th                        Lane                       Suite 140                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    2.9999999E-002
+          7  AAAAAAAAHAAAAAAA           1997-03-13 00:00:00.000000000  ?                                             ?  ation                                     297        8954883  8AM-4PM                    David Thomas                         9  Unknown                    Architects coul            Thomas Benton                          1  Unknown                               1  Unknown                    811                        Lee                        Circle                     Suite T                    Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    9.9999997E-003
+          8  AAAAAAAAIAAAAAAA           1997-03-13 00:00:00.000000000  2000-03-12 00:00:00.000000000                 ?  eing                                      278        6995995  8AM-4PM                    Brett Yates                          2  Unknown                    Various bars make most. D  Dean Morrison                          1  Unknown                               1  Unknown                    226                        12th                       Lane                       Suite D                    Fairview                   Williamson County          TN                         35709                      United States              -5.0000000E+000    7.9999998E-002
+          9  AAAAAAAAIAAAAAAA           2000-03-13 00:00:00.000000000  ?                                             ?  eing                                      271        6995995  8AM-4PM                    Brett Yates                          2  Unknown                    Formal, psychological pou  Dean Morrison                          1  Unknown                               1  Unknown                    226                        Hill                       Boulevard                  Suite 190                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    7.9999998E-002
+         10  AAAAAAAAKAAAAAAA           1997-03-13 00:00:00.000000000  1999-03-13 00:00:00.000000000                 ?  bar                                       294        9294113  8AM-4PM                    Raymond Jacobs                       8  Unknown                    Little expectations inclu  Michael Wilson                         1  Unknown                               1  Unknown                    175                        4th                        Court                      Suite C                    Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    5.9999998E-002
+         11  AAAAAAAAKAAAAAAA           1999-03-14 00:00:00.000000000  2001-03-12 00:00:00.000000000                 ?  ought                                     294        9294113  8AM-4PM                    Raymond Jacobs                       6  Unknown                    Mysterious employe         Michael Wilson                         1  Unknown                               1  Unknown                    175                        Park Green                 Court                      Suite 160                  Midway                     Williamson County          TN                         31904                      United States              -5.0000000E+000    1.0999999E-002
+         12  AAAAAAAAKAAAAAAA           2001-03-13 00:00:00.000000000  ?                                             ?  ought                                     294        5219562  8AM-12AM                   Robert Thompson                      6  Unknown                    Events develop i           Dustin Kelly                           1  Unknown                               1  Unknown                    337                        College                    Boulevard                  Suite 100                  Fairview                   Williamson County          TN                         31904                      United States              -5.0000000E+000    9.9999997E-003
 
 --- 12 row(s) selected.
 >>log;
diff --git a/core/sql/regress/hive/EXPECTED005 b/core/sql/regress/hive/EXPECTED005
index 298547b..08cac8d 100644
--- a/core/sql/regress/hive/EXPECTED005
+++ b/core/sql/regress/hive/EXPECTED005
@@ -72,7 +72,7 @@
 
 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
 
-*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1528150079000, failedModTS = 1528150239571, failedLoc = hdfs://localhost:36000/user/trafodion/hive/exttables/customer_ddl
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149450876, failedModTS = 1529149578260, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl
 
 C_PREFERRED_CUST_FLAG      (EXPR)              
 -------------------------  --------------------
@@ -108,7 +108,7 @@
 
 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
 
-*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1528150079000, failedModTS = 1528150239571, failedLoc = hdfs://localhost:36000/user/trafodion/hive/exttables/customer_ddl
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149450876, failedModTS = 1529149578260, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl
 
 C_PREFERRED_CUST_FLAG      (EXPR)              
 -------------------------  --------------------
@@ -177,7 +177,7 @@
 
 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
 
-*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1528150242355, failedModTS = 1528150250981, failedLoc = hdfs://localhost:36000/user/hive/warehouse/newtable
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149581595, failedModTS = 1529149591176, failedLoc = hdfs://localhost:24200/user/hive/warehouse/newtable
 
 A                        
 -------------------------
@@ -227,7 +227,7 @@
 
 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
 
-*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1528150239571, failedModTS = 1528150270615, failedLoc = hdfs://localhost:36000/user/trafodion/hive/exttables/customer_ddl
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149578260, failedModTS = 1529149609405, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl
 
 C_PREFERRED_CUST_FLAG      (EXPR)              
 -------------------------  --------------------
@@ -242,7 +242,7 @@
 
 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
 
-*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1528150239571, failedModTS = 1528150270615, failedLoc = hdfs://localhost:36000/user/trafodion/hive/exttables/customer_ddl
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149578260, failedModTS = 1529149609405, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl
 
 C_PREFERRED_CUST_FLAG      (EXPR)              
 -------------------------  --------------------
@@ -298,7 +298,7 @@
 
 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
 
-*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1528150267991, failedModTS = 1528150279764, failedLoc = hdfs://localhost:36000/user/hive/warehouse/newtable
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149606436, failedModTS = 1529149616936, failedLoc = hdfs://localhost:24200/user/hive/warehouse/newtable
 
 A            B                        
 -----------  -------------------------
@@ -456,10 +456,10 @@
 >>
 >>select * from tbl_type;
 
-TINT  SM      I            BIG                   STR                        F                D                          T                           DT          VC                                        D10                   D18           D181                  D30
-----  ------  -----------  --------------------  -------------------------  ---------------  -------------------------  --------------------------  ----------  ----------------------------------------  --------------------  ------------  --------------------  -------------------------------
+TINT  SM      I            BIG                   STR                        F                D                          T                              DT          VC                                        D10                   D18           D181                  D30
+----  ------  -----------  --------------------  -------------------------  ---------------  -------------------------  -----------------------------  ----------  ----------------------------------------  --------------------  ------------  --------------------  -------------------------------
 
- 101     202          203                   204  two hundred                 2.0000000E+002   2.00000000000000000E+002  2022-02-02 22:22:22.222222  2022-02-02  varchar                                             1234567890     123456.11                 12345    11111111111111111111111111111
+ 101     202          203                   204  two hundred                 2.0000000E+002   2.00000000000000000E+002  2022-02-02 22:22:22.222222000  2022-02-02  varchar                                             1234567890     123456.11                 12345    11111111111111111111111111111
 
 --- 1 row(s) selected.
 >>insert into tbl_type_temp select * from tbl_type;
@@ -467,10 +467,10 @@
 --- 1 row(s) inserted.
 >>select * from tbl_type_temp;
 
-TINT  SM      I            BIG                   STR                        F                D                          T                           DT          VC                                        D10                   D18           D181                  D30
-----  ------  -----------  --------------------  -------------------------  ---------------  -------------------------  --------------------------  ----------  ----------------------------------------  --------------------  ------------  --------------------  -------------------------------
+TINT  SM      I            BIG                   STR                        F                D                          T                              DT          VC                                        D10                   D18           D181                  D30
+----  ------  -----------  --------------------  -------------------------  ---------------  -------------------------  -----------------------------  ----------  ----------------------------------------  --------------------  ------------  --------------------  -------------------------------
 
- 101     202          203                   204  two hundred                 2.0000000E+002   2.00000000000000000E+002  2022-02-02 22:22:22.222222  2022-02-02  varchar                                             1234567890     123456.11                 12345    11111111111111111111111111111
+ 101     202          203                   204  two hundred                 2.0000000E+002   2.00000000000000000E+002  2022-02-02 22:22:22.222222000  2022-02-02  varchar                                             1234567890     123456.11                 12345    11111111111111111111111111111
 
 --- 1 row(s) selected.
 >>
@@ -571,17 +571,17 @@
 --- SQL operation complete.
 >>select * from tbl_bad;
 
-C1           C2                    C3                         C4               C5      C6                          C7                         C8
------------  --------------------  -------------------------  ---------------  ------  --------------------------  -------------------------  ----
+C1           C2                    C3                         C4               C5      C6                             C7                         C8
+-----------  --------------------  -------------------------  ---------------  ------  -----------------------------  -------------------------  ----
 
-          ?                     ?  c                                        ?       ?  ?                                                   ?     ?
-          ?                     ?  c                                        ?       ?  2017-01-01 10:10:10.000000   1.01000000000000000E+000     1
-          ?                     ?                                           ?       ?  ?                                                   ?     ?
-          1                     1  averylongstring            -1.0000000E+000       0  2017-01-01 10:10:10.000000   1.00010000000000000E+002     1
-          2                     2  good                        1.1000000E+000       2  2017-01-01 10:10:10.000000   2.00000000000000000E+002   100
-          3                     3  good                        1.0000000E+000       2  2017-01-01 10:10:10.000000   2.10000000000000000E+002    10
-          ?            4294967295  good                        3.3999999E+038       ?  2017-01-01 10:10:10.000000   1.69999999999999968E+308    10
-          0            9999999999  bad                                      ?       ?  ?                                                   ?     ?
+          ?                     ?  c                                        ?       ?  ?                                                      ?     ?
+          ?                     ?  c                                        ?       ?  2017-01-01 10:10:10.000000000   1.01000000000000000E+000     1
+          ?                     ?                                           ?       ?  ?                                                      ?     ?
+          1                     1  averylongstring            -1.0000000E+000       0  2017-01-01 10:10:10.000000000   1.00010000000000000E+002     1
+          2                     2  good                        1.1000000E+000       2  2017-01-01 10:10:10.000000000   2.00000000000000000E+002   100
+          3                     3  good                        1.0000000E+000       2  2017-01-01 10:10:10.000000000   2.10000000000000000E+002    10
+          ?            4294967295  good                        3.3999999E+038       ?  2017-01-01 10:10:10.000000000   1.69999999999999968E+308    10
+          0            9999999999  bad                                      ?       ?  ?                                                      ?     ?
 
 --- 8 row(s) selected.
 >>cqd HIVE_SCAN_SPECIAL_MODE reset;
@@ -617,18 +617,18 @@
 --- 1 row(s) selected.
 >>load with continue on error into trafodion.seabase.traf_tbl_bad select * from tbl_bad;
 Task:  LOAD            Status: Started    Object: TRAFODION.SEABASE.TRAF_TBL_BAD
-Task:  CLEANUP         Status: Started    Time: 2018-06-04 22:12:37.338586
-Task:  CLEANUP         Status: Ended      Time: 2018-06-04 22:12:37.349263
-Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.011
-Task:  LOADING DATA    Status: Started    Time: 2018-06-04 22:12:37.349352
+Task:  CLEANUP         Status: Started    Time: 2018-06-16 11:47:50.919693
+Task:  CLEANUP         Status: Ended      Time: 2018-06-16 11:47:50.927679
+Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.008
+Task:  LOADING DATA    Status: Started    Time: 2018-06-16 11:47:50.927713
        Rows Processed: 8 
        Error Rows:     5 
-Task:  LOADING DATA    Status: Ended      Time: 2018-06-04 22:12:37.525012
-Task:  LOADING DATA    Status: Ended      Elapsed Time:    00:00:00.176
-Task:  COMPLETION      Status: Started    Time: 2018-06-04 22:12:37.525050
+Task:  LOADING DATA    Status: Ended      Time: 2018-06-16 11:47:51.85803
+Task:  LOADING DATA    Status: Ended      Elapsed Time:    00:00:00.158
+Task:  COMPLETION      Status: Started    Time: 2018-06-16 11:47:51.85854
        Rows Loaded:    3 
-Task:  COMPLETION      Status: Ended      Time: 2018-06-04 22:12:37.888170
-Task:  COMPLETION      Status: Ended      Elapsed Time:    00:00:00.363
+Task:  COMPLETION      Status: Ended      Time: 2018-06-16 11:47:52.476978
+Task:  COMPLETION      Status: Ended      Elapsed Time:    00:00:01.391
 
 --- 3 row(s) loaded.
 >>select count(*) from trafodion.seabase.traf_tbl_bad;
@@ -644,19 +644,19 @@
 --- 3 row(s) deleted.
 >>load with log error rows into trafodion.seabase.traf_tbl_bad select * from tbl_bad;
 Task:  LOAD            Status: Started    Object: TRAFODION.SEABASE.TRAF_TBL_BAD
-Task:  CLEANUP         Status: Started    Time: 2018-06-04 22:12:38.932654
-Task:  CLEANUP         Status: Ended      Time: 2018-06-04 22:12:38.947277
-Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.015
-       Logging Location: /user/trafodion/bulkload/logs/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20180604_221238
-Task:  LOADING DATA    Status: Started    Time: 2018-06-04 22:12:38.947419
+Task:  CLEANUP         Status: Started    Time: 2018-06-16 11:47:53.526469
+Task:  CLEANUP         Status: Ended      Time: 2018-06-16 11:47:53.536440
+Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.010
+       Logging Location: /user/trafodion/bulkload/logs/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20180616_114753
+Task:  LOADING DATA    Status: Started    Time: 2018-06-16 11:47:53.536510
        Rows Processed: 8 
        Error Rows:     5 
-Task:  LOADING DATA    Status: Ended      Time: 2018-06-04 22:12:39.164857
-Task:  LOADING DATA    Status: Ended      Elapsed Time:    00:00:00.217
-Task:  COMPLETION      Status: Started    Time: 2018-06-04 22:12:39.164924
+Task:  LOADING DATA    Status: Ended      Time: 2018-06-16 11:47:53.760748
+Task:  LOADING DATA    Status: Ended      Elapsed Time:    00:00:00.224
+Task:  COMPLETION      Status: Started    Time: 2018-06-16 11:47:53.760793
        Rows Loaded:    3 
-Task:  COMPLETION      Status: Ended      Time: 2018-06-04 22:12:39.538579
-Task:  COMPLETION      Status: Ended      Elapsed Time:    00:00:00.374
+Task:  COMPLETION      Status: Ended      Time: 2018-06-16 11:47:56.167112
+Task:  COMPLETION      Status: Ended      Elapsed Time:    00:00:02.406
 
 --- 3 row(s) loaded.
 >>select count(*) from trafodion.seabase.traf_tbl_bad;
@@ -669,19 +669,19 @@
 --- 1 row(s) selected.
 >>load with log error rows to '/user/trafodion/bulkload/logs/TEST005' into trafodion.seabase.traf_tbl_bad select * from tbl_bad;
 Task:  LOAD            Status: Started    Object: TRAFODION.SEABASE.TRAF_TBL_BAD
-Task:  CLEANUP         Status: Started    Time: 2018-06-04 22:12:40.528226
-Task:  CLEANUP         Status: Ended      Time: 2018-06-04 22:12:40.541034
-Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.013
-       Logging Location: /user/trafodion/bulkload/logs/TEST005/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20180604_221240
-Task:  LOADING DATA    Status: Started    Time: 2018-06-04 22:12:40.541082
+Task:  CLEANUP         Status: Started    Time: 2018-06-16 11:47:57.157930
+Task:  CLEANUP         Status: Ended      Time: 2018-06-16 11:47:57.165444
+Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.008
+       Logging Location: /user/trafodion/bulkload/logs/TEST005/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20180616_114757
+Task:  LOADING DATA    Status: Started    Time: 2018-06-16 11:47:57.165499
        Rows Processed: 8 
        Error Rows:     5 
-Task:  LOADING DATA    Status: Ended      Time: 2018-06-04 22:12:40.732369
-Task:  LOADING DATA    Status: Ended      Elapsed Time:    00:00:00.191
-Task:  COMPLETION      Status: Started    Time: 2018-06-04 22:12:40.732402
+Task:  LOADING DATA    Status: Ended      Time: 2018-06-16 11:47:57.352294
+Task:  LOADING DATA    Status: Ended      Elapsed Time:    00:00:00.187
+Task:  COMPLETION      Status: Started    Time: 2018-06-16 11:47:57.352327
        Rows Loaded:    3 
-Task:  COMPLETION      Status: Ended      Time: 2018-06-04 22:12:41.125846
-Task:  COMPLETION      Status: Ended      Elapsed Time:    00:00:00.393
+Task:  COMPLETION      Status: Ended      Time: 2018-06-16 11:47:57.916072
+Task:  COMPLETION      Status: Ended      Elapsed Time:    00:00:00.564
 
 --- 3 row(s) loaded.
 >>select count(*) from trafodion.seabase.traf_tbl_bad;
@@ -697,10 +697,10 @@
 --- 6 row(s) deleted.
 >>load with stop after 3 error rows into trafodion.seabase.traf_tbl_bad select * from tbl_bad;
 Task:  LOAD            Status: Started    Object: TRAFODION.SEABASE.TRAF_TBL_BAD
-Task:  CLEANUP         Status: Started    Time: 2018-06-04 22:12:42.147737
-Task:  CLEANUP         Status: Ended      Time: 2018-06-04 22:12:42.157127
+Task:  CLEANUP         Status: Started    Time: 2018-06-16 11:47:58.929152
+Task:  CLEANUP         Status: Ended      Time: 2018-06-16 11:47:58.937786
 Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.009
-Task:  LOADING DATA    Status: Started    Time: 2018-06-04 22:12:42.157174
+Task:  LOADING DATA    Status: Started    Time: 2018-06-16 11:47:58.937815
 
 *** ERROR[8113] The maximum number of error rows is exceeded.
 
@@ -715,11 +715,11 @@
 --- 1 row(s) selected.
 >>load with log error rows, stop after 3 error rows into trafodion.seabase.traf_tbl_bad select * from tbl_bad;
 Task:  LOAD            Status: Started    Object: TRAFODION.SEABASE.TRAF_TBL_BAD
-Task:  CLEANUP         Status: Started    Time: 2018-06-04 22:12:43.279600
-Task:  CLEANUP         Status: Ended      Time: 2018-06-04 22:12:43.289771
-Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.010
-       Logging Location: /user/trafodion/bulkload/logs/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20180604_221243
-Task:  LOADING DATA    Status: Started    Time: 2018-06-04 22:12:43.289816
+Task:  CLEANUP         Status: Started    Time: 2018-06-16 11:48:00.37617
+Task:  CLEANUP         Status: Ended      Time: 2018-06-16 11:48:00.45699
+Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.008
+       Logging Location: /user/trafodion/bulkload/logs/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20180616_114800
+Task:  LOADING DATA    Status: Started    Time: 2018-06-16 11:48:00.45732
 
 *** ERROR[8113] The maximum number of error rows is exceeded.
 
@@ -809,7 +809,7 @@
 
 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
 
-*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1528150390948, failedModTS = 1528150393514, failedLoc = hdfs://localhost:36000/user/hive/warehouse/thive
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149699813, failedModTS = 1529149706160, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive
 
 A          
 -----------
@@ -866,16 +866,16 @@
 --- SQL operation complete.
 >>select * from hive.hive.thive;
 
+*** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
+
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149722198, failedModTS = 1529149723553, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive
+
 --- 0 row(s) selected.
 >>insert into hive.hive.thive values (10, 20);
 
 --- 1 row(s) inserted.
 >>select * from hive.hive.thive;
 
-*** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
-
-*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1528150404696, failedModTS = 1528150406756, failedLoc = hdfs://localhost:36000/user/hive/warehouse/thive
-
 A            B          
 -----------  -----------
 
@@ -890,6 +890,10 @@
 --- SQL operation complete.
 >>select * from hive.hive.thive;
 
+*** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
+
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149724776, failedModTS = 1529149727335, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive
+
 --- 0 row(s) selected.
 >>
 >>-- truncate of partitioned hive table
@@ -962,7 +966,7 @@
 >>-- should return error
 >>truncate table hive.hive.t005part partition (b=10,c=13);
 
-*** ERROR[1214] Error encountered when executing HiveQL statement "truncate table `default`.T005PART partition (b=10,c=13)". Details: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException [Error 10006]: Partition not found {b=10, c=13}
+*** ERROR[1214] Error encountered when executing HiveQL statement "TRUNCATE TABLE `default`.T005PART partition (b=10,c=13)". Details: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException [Error 10006]: Partition not found {b=10, c=13}
 
 --- SQL operation failed with errors.
 >>
@@ -971,14 +975,13 @@
 
 *** ERROR[3242] This statement is not supported. Reason: Purgedata is not allowed for Hive tables. Use 'Truncate Table' command.
 
-*** ERROR[8822] The statement was not prepared.
-
+--- SQL operation failed with errors.
 >>
 >>-- tests for hive insert error modes
 >>invoke hive.hive.thive_insert_smallint;
 
 -- Definition of hive table HIVE.HIVE.THIVE_INSERT_SMALLINT
--- Definition current  Mon Jun  4 22:16:40 2018
+-- Definition current  Sat Jun 16 11:51:20 2018
 
   (
     A                                SMALLINT
@@ -999,7 +1002,7 @@
 /* Trafodion DDL */
 
 REGISTER /*INTERNAL*/ HIVE TABLE HIVE.HIVE.THIVE_INSERT_SMALLINT;
-/* ObjectUID = 7976600667680320368 */
+/* ObjectUID = 7436169711789392123 */
 
 --- SQL operation complete.
 >>
@@ -1012,6 +1015,10 @@
 >>insert into hive.hive.thive_insert_smallint select * from 
 +> (values (10), (11111111), (21), (22222222));
 
+*** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
+
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149537134, failedModTS = 1529149881411, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive_insert_smallint
+
 --- 4 row(s) inserted.
 >>select * from hive.hive.thive_insert_smallint;
 
@@ -1049,6 +1056,10 @@
 >>insert into hive.hive.thive_insert_smallint select * from 
 +> (values (10), (11111111), (21), (22222222));
 
+*** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
+
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149883896, failedModTS = 1529149886157, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive_insert_smallint
+
 --- 2 row(s) inserted.
 >>select * from hive.hive.thive_insert_smallint;
 
@@ -1088,7 +1099,7 @@
 >>invoke hive.hive.thive_insert_varchar;
 
 -- Definition of hive table HIVE.HIVE.THIVE_INSERT_VARCHAR
--- Definition current  Mon Jun  4 22:17:04 2018
+-- Definition current  Sat Jun 16 11:51:32 2018
 
   (
     A                                VARCHAR(1 CHAR) CHARACTER SET UTF8 COLLATE
@@ -1113,7 +1124,7 @@
 /* Trafodion DDL */
 
 REGISTER /*INTERNAL*/ HIVE TABLE HIVE.HIVE.THIVE_INSERT_VARCHAR;
-/* ObjectUID = 7976600667680321080 */
+/* ObjectUID = 7436169711789392374 */
 
 --- SQL operation complete.
 >>cqd hive_insert_error_mode '1';
@@ -1124,6 +1135,10 @@
 --- SQL operation complete.
 >>insert into hive.hive.thive_insert_varchar values ('abcddcba','efghijkl');
 
+*** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. 
+
+*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1529149539689, failedModTS = 1529149893202, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive_insert_varchar
+
 --- 1 row(s) inserted.
 >>
 >>cqd hive_max_string_length_in_bytes '20';
diff --git a/core/sql/regress/hive/EXPECTED007 b/core/sql/regress/hive/EXPECTED007
index 4674f01..600d1b8 100644
--- a/core/sql/regress/hive/EXPECTED007
+++ b/core/sql/regress/hive/EXPECTED007
@@ -198,6 +198,9 @@
 
 HIVE.HIVE.THIVE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get tables in view trafodion.sch007.vhive11;
 
@@ -206,6 +209,9 @@
 
 HIVE.HIVE.THIVE2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get all tables in view trafodion.sch007.vhive3;
@@ -216,6 +222,9 @@
 HIVE.HIVE.THIVE1
 HIVE.HIVE.THIVE2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get views in view trafodion.sch007.vhive3;
 
@@ -224,6 +233,9 @@
 
 TRAFODION.SCH007.VHIVE2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get views on table hive.hive.thive1;
 
@@ -233,6 +245,9 @@
 TRAFODION.SCH007.VHIVE1
 TRAFODION.SCH007.VHIVE2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get all views on table hive.hive.thive2;
 
@@ -244,6 +259,9 @@
 TRAFODION.SCH007.VHIVE3
 TRAFODION.SCH007.VHIVEHBASE
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>
 >>drop external table thive2 for hive.hive.thive2 cascade;
@@ -283,6 +301,9 @@
 TRAFODION.SCH007.VHIVE3
 TRAFODION.SCH007.VHIVEHBASE
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>
 >>obey TEST007(error_tests_traf);
@@ -647,6 +668,9 @@
 
 HIVE.HIVESCH007.VHIVE11
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get views on view hive.hivesch007.vhive11;
 
@@ -655,6 +679,9 @@
 
 TRAFODION.SCH007.VTRAFONHIVE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>unregister hive view hive.hivesch007.vhive11 cascade;
@@ -694,6 +721,9 @@
 
 HIVE.HIVESCH007.VHIVE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get views on table hive.hivesch007.thive1;
 
@@ -702,6 +732,9 @@
 
 HIVE.HIVESCH007.VHIVE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get views on view hive.hivesch007.vhive1;
 
@@ -710,6 +743,9 @@
 
 HIVE.HIVESCH007.VHIVE11
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- tests for recursive hive view/table register/unregister operations
@@ -759,6 +795,9 @@
 
 HIVE.HIVESCH0071.H1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get views in view vh11;
 
@@ -767,6 +806,9 @@
 
 HIVE.HIVESCH0071.VH1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get all objects in view vh11;
 
@@ -776,6 +818,9 @@
 HIVE.HIVESCH0071.H1
 HIVE.HIVESCH0071.VH1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get hive registered tables in catalog trafodion, match '%hivesch0071%';
@@ -785,6 +830,9 @@
 
 hive.hivesch0071.h1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get hive registered views in catalog trafodion, match '%hivesch0071%';
 
@@ -794,6 +842,9 @@
 hive.hivesch0071.vh1
 hive.hivesch0071.vh11
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get hive registered objects in catalog trafodion, match '%hivesch0071%';
 
@@ -804,6 +855,9 @@
 hive.hivesch0071.vh1
 hive.hivesch0071.vh11
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>select object_name from trafodion."_MD_".objects where schema_name = 'HIVESCH0071';
@@ -884,6 +938,9 @@
 
 hive.hivesch0078
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>unregister hive schema hive.hivesch0078;
 
@@ -1017,6 +1074,9 @@
 
 S------    HIVE.HIVESCH007.THIVE9
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>insert into hive.hivesch007.thive9 values (1), (2), (3), (4), (5), (6);
 
diff --git a/core/sql/regress/hive/EXPECTED008 b/core/sql/regress/hive/EXPECTED008
index 32e9b0f..a792f4b 100644
--- a/core/sql/regress/hive/EXPECTED008
+++ b/core/sql/regress/hive/EXPECTED008
@@ -2,6 +2,12 @@
 
 --- SQL operation complete.
 >>
+>>set schema hive.sch008;
+
+*** ERROR[1003] Schema HIVE.SCH008 does not exist.
+
+--- SQL operation failed with errors.
+>>
 >>showddl schema hive.sch008;
 
 *** ERROR[1003] Schema HIVE.SCH008 does not exist.
@@ -97,7 +103,13 @@
 >>-- Use regrhive until that issue is fixed.
 >>sh echo "create table sch008.t00803 as select * from sch008.t00802;" > TEST008_junk;
 >>sh regrhive.ksh -f TEST008_junk;
->>--create table t00803 as select * from sch008.t00802;
+>>cqd hive_ctas_in_native_mode 'ON';
+
+--- SQL operation complete.
+>>-- create table t00803 as select * from sch008.t00802;
+>>cqd hive_ctas_in_native_mode reset;
+
+--- SQL operation complete.
 >>invoke t00803;
 
 -- Definition of hive table HIVE.SCH008.T00803
@@ -119,6 +131,35 @@
 
 --- 1 row(s) selected.
 >>
+>>-- ctas create executed in Hive and insert executed in sql
+>>drop table if exists t008032;
+
+--- SQL operation complete.
+>>explain options 'f' create table t008032 no load as select * from t00802;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                                                  1.00E+000
+.    .    1    create_table_as                                       1.00E+000
+
+--- SQL operation complete.
+>>create table t008032 no load as select * from sch008.t00802;
+
+--- 0 row(s) inserted.
+>>invoke t008032;
+
+-- Definition of hive table HIVE.SCH008.T008032
+-- Definition current  Fri Jun 15 05:38:24 2018
+
+  (
+    A                                INT
+  , B                                INT
+  )
+  /* stored as textfile */
+
+--- SQL operation complete.
+>>
 >>-- describe will show datatype 132 for b
 >>prepare s from insert into t00802 values (?, ?);
 
@@ -278,6 +319,9 @@
 /* ObjectUID = 1402470925633636550 */
 
 --- SQL operation complete.
+>>-- next one should not return an error but it currently does.
+>>-- Tables in schemas different than views schema is not being handled.
+>>-- Track it as a known diff.
 >>prepare s from select * from v00803;
 
 --- SQL command prepared.
@@ -289,6 +333,7 @@
 
 t00802
 t00803
+t008032
 v00802
 v00803
 
@@ -311,6 +356,7 @@
 
 t00802
 t00803
+t008032
 v00803
 
 --- SQL operation complete.
@@ -401,18 +447,101 @@
 
 --- SQL operation complete.
 >>
->>-- create external hive table LIKE a traf table
+>>-- create external hive table like a traf table
 >>drop table if exists hive.sch008.columns;
 
 --- SQL operation complete.
->>create external hive table hive.sch008.columns like trafodion."_MD_".columns 
-+>      with hive options 'stored as sequencefile';
+>>explain create external table hive.sch008.columns no load 
++>    hive options 'stored as sequencefile' 
++>    as select * from trafodion."_MD_".columns;
+
+------------------------------------------------------------------ PLAN SUMMARY
+MODULE_NAME .............. DYNAMICALLY COMPILED
+STATEMENT_NAME ........... NOT NAMED
+PLAN_ID .................. 212395845354479165
+ROWS_OUT ................. 1
+EST_TOTAL_COST ........... 0
+STATEMENT ................ create external table hive.sch008.columns no load
+                             hive options 'stored as sequencefile'      as
+                             select * from trafodion."_MD_".columns;
+
+
+------------------------------------------------------------------ NODE LISTING
+ROOT ======================================  SEQ_NO 2        ONLY CHILD 1
+REQUESTS_IN .............. 1
+ROWS_OUT ................. 1
+EST_OPER_COST ............ 0
+EST_TOTAL_COST ........... 0
+DESCRIPTION
+  est_memory_per_node .... 10240.00(Limit), 0.00(BMOs), 0.00(nBMOs) MB
+  max_card_est ........... 1
+  fragment_id ............ 0
+  parent_frag ............ (none)
+  fragment_type .......... master
+  affinity_value ......... 0
+  max_max_cardinality .... 1
+  xn_access_mode ......... read_only
+  xn_autoabort_interval    0
+  auto_query_retry ....... enabled for privilege checks
+  plan_version ....... 2,600
+  embedded_arkcmp ........ used
+  IS_SQLCI ............... ON
+  LDAP_USERNAME
+  MODE_SEABASE ........... ON
+  SEABASE_VOLATILE_TABLES  ON
+  HBASE_ASYNC_DROP_TABLE   OFF
+  HBASE_SERIALIZATION .... ON
+  HBASE_SMALL_SCANNER .... SYSTEM
+  HBASE_FILTER_PREDS ..... 2
+  TRAF_ALIGNED_ROW_FORMAT  ON
+  TRAF_INDEX_CREATE_OPT    ON
+  TRAF_DDL_ON_HIVE_OBJECT  ON
+  SCHEMA ................. HIVE.SCH008
+  GENERATE_EXPLAIN ....... ON
+
+
+CREATE_TABLE_AS ===========================  SEQ_NO 1        NO CHILDREN
+REQUESTS_IN .............. 1
+ROWS_OUT ................. 1
+EST_OPER_COST ............ 0
+EST_TOTAL_COST ........... 0
+DESCRIPTION
+  max_card_est ........... -1
+  fragment_id ............ 0
+  parent_frag ............ (none)
+  fragment_type .......... master
+  CreateQuery ............ CREATE EXTERNAL TABLE HIVE.SCH008.COLUMNS (
+                             OBJECT_UID bigint, COLUMN_NAME varchar(256),
+                             COLUMN_NUMBER int, COLUMN_CLASS char(2),
+                             FS_DATA_TYPE int, SQL_DATA_TYPE char(32),
+                             COLUMN_SIZE int, COLUMN_PRECISION int,
+                             COLUMN_SCALE int, DATETIME_START_FIELD int,
+                             DATETIME_END_FIELD int, IS_UPSHIFTED char(2),
+                             COLUMN_FLAGS int, NULLABLE int,
+                             CHARACTER_SET char(40), DEFAULT_CLASS int,
+                             DEFAULT_VALUE varchar(1024),
+                             COLUMN_HEADING varchar(256),
+                             HBASE_COL_FAMILY varchar(40),
+                             HBASE_COL_QUALIFIER varchar(40),
+                             DIRECTION char(2), IS_OPTIONAL char(2),
+                             FLAGS bigint  )  stored as sequencefile
+  InsertQuery ............ insert into HIVE.SCH008.COLUMNS  select * from
+                             trafodion."_MD_".columns;
+  UpsertLoadQuery ........ NULL
+  UpdStatsQuery .......... UPDATE STATISTICS FOR TABLE HIVE.SCH008.COLUMNS ON
+                             EVERY COLUMN SAMPLE SET ROWCOUNT %Ld;
 
 --- SQL operation complete.
->>create external hive table if not exists hive.sch008.columns like trafodion."_MD_".columns 
-+>      with hive options 'stored as sequencefile';
+>>create external table hive.sch008.columns no load 
++>    hive options 'stored as sequencefile' 
++>    as select * from trafodion."_MD_".columns;
 
---- SQL operation complete.
+--- 0 row(s) inserted.
+>>create external table if not exists hive.sch008.columns no load 
++>    hive options 'stored as sequencefile' 
++>    as select * from trafodion."_MD_".columns;
+
+--- 0 row(s) inserted.
 >>showddl hive.sch008.columns;
 
 /* Hive DDL */
@@ -451,14 +580,16 @@
 /* ObjectUID = 1402470925633639085 */
 
 --- SQL operation complete.
+>>
 >>-- create managed hive table LIKE traf table
 >>drop table if exists hive.sch008.columns;
 
 --- SQL operation complete.
->>create hive table hive.sch008.columns like trafodion."_MD_".columns 
-+>      with hive options 'stored as sequencefile';
+>>create table hive.sch008.columns no load 
++>    hive options 'stored as sequencefile' 
++>    as select * from trafodion."_MD_".columns;
 
---- SQL operation complete.
+--- 0 row(s) inserted.
 >>showddl hive.sch008.columns;
 
 /* Hive DDL */
@@ -498,6 +629,51 @@
 
 --- SQL operation complete.
 >>
+>>-- ctas stmt is passed to Hive layer. 
+>>drop table if exists hive.hive.tempsrc;
+
+--- SQL operation complete.
+>>drop table if exists hive.hive.temptgt;
+
+--- SQL operation complete.
+>>create table hive.hive.tempsrc(a int);
+
+--- SQL operation complete.
+>>cqd hive_ctas_in_native_mode 'ON';
+
+--- SQL operation complete.
+>>explain options 'f' create external table hive.hive.temptgt as select * from tempsrc;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                                                  1.00E+000
+.    .    1    hive_ddl                                              1.00E+000
+
+--- SQL operation complete.
+>>-- cannot create external table thru CTAS in Hive
+>>create external table hive.hive.temptgt as select * from tempsrc;
+
+*** ERROR[1214] Error encountered when executing HiveQL statement "create external table `default`.TEMPTGT as select * from tempsrc". Details: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException [Error 10070]: CREATE-TABLE-AS-SELECT cannot create external table
+
+--- SQL operation failed with errors.
+>>
+>>-- hive execution of CTAS returns an error due to a security issue on some
+>>-- platforms. Do not execute it until the issue is fixed.
+>>prepare s from create table hive.hive.temptgt as select * from tempsrc;
+
+--- SQL command prepared.
+>>--execute s;
+>>invoke hive.hive.temptgt;
+
+*** ERROR[1388] Object HIVE.HIVE.TEMPTGT does not exist in Hive Metadata.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>cqd hive_ctas_in_native_mode reset;
+
+--- SQL operation complete.
+>>
 >>-- create and drop hive table and external table
 >>drop table if exists t00806;
 
@@ -705,9 +881,10 @@
 >>-- next truncate should return error
 >>truncate table t00807;
 
-*** ERROR[1388] Table sch008.t00807 does not exist in Hive Metadata.
+*** ERROR[1388] Object HIVE.SCH008.T00807 does not exist in Hive Metadata.
 
---- SQL operation failed with errors.
+*** ERROR[8822] The statement was not prepared.
+
 >>truncate table if exists t00807;
 
 --- SQL operation complete.
@@ -792,10 +969,131 @@
 >>sh regrhive.ksh -f TEST008_junk | tee -a LOG008;
 t00807.a	t00807.b
 >>
->>drop table t00807;
+>>explain options 'f' create table hive.sch008.t008072 as select * from hive.sch008.t00807;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                                                  1.00E+000
+.    .    1    create_table_as                                       1.00E+000
+
+--- SQL operation complete.
+>>create table hive.sch008.t008072 as select * from hive.sch008.t00807;
+
+--- 0 row(s) inserted.
+>>
+>>drop table t008072;
 
 --- SQL operation complete.
 >>
+>>drop table if exists trafodion.sch.t00807;
+
+--- SQL operation complete.
+>>create table trafodion.sch.t00807 (a int);
+
+--- SQL operation complete.
+>>explain options 'f' create table hive.sch008.t008072 as select * from trafodion.sch.t00807;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                                                  1.00E+000
+.    .    1    create_table_as                                       1.00E+000
+
+--- SQL operation complete.
+>>create table hive.sch008.t008072 as select * from trafodion.sch.t00807;
+
+--- 0 row(s) inserted.
+>>invoke hive.sch008.t008072;
+
+-- Definition of hive table HIVE.SCH008.T008072
+-- Definition current  Fri Jun 15 05:43:02 2018
+
+  (
+    A                                INT
+  )
+  /* stored as textfile */
+
+--- SQL operation complete.
+>>
+>>drop table t00807;
+
+--- SQL operation complete.
+>>drop table t008072;
+
+--- SQL operation complete.
+>>
+>>-- alter rename. Should unregister the source table.
+>>create table t00807 (a int);
+
+--- SQL operation complete.
+>>alter table t00807 rename to `default`.t00807ren;
+
+--- SQL operation complete.
+>>select * from trafodion."_MD_".objects where schema_name = 'HIVE' and object_name = 'T00807';
+
+--- 0 row(s) selected.
+>>-- should show
+>>showddl hive.t00807ren;
+
+/* Hive DDL */
+CREATE TABLE HIVE.HIVE.T00807REN
+  (
+    A                                int
+  )
+  stored as textfile
+;
+
+/* Trafodion DDL */
+
+--- SQL operation complete.
+>>-- should not show
+>>showddl t00807ren;
+
+*** ERROR[1388] Object HIVE.SCH008.T00807REN does not exist in Hive Metadata.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>drop table hive.t00807ren;
+
+--- SQL operation complete.
+>>
+>>-- alter rename to the hive schema set in session (hive.sch008)
+>>create table t00807 (a int);
+
+--- SQL operation complete.
+>>alter table t00807 rename to t00807ren;
+
+--- SQL operation complete.
+>>-- should show
+>>showddl t00807ren;
+
+/* Hive DDL */
+CREATE TABLE HIVE.SCH008.T00807REN
+  (
+    A                                int
+  )
+  stored as textfile
+;
+
+/* Trafodion DDL */
+
+--- SQL operation complete.
+>>-- should not show
+>>showddl hive.t00807ren;
+
+*** ERROR[1388] Object HIVE.HIVE.T00807REN does not exist in Hive Metadata.
+
+*** ERROR[8822] The statement was not prepared.
+
+>>
+>>-- msck (meta store check) command support
+>>msck repair table t00807ren;
+
+--- SQL operation complete.
+>>alter table t00807ren recover partitions;
+
+--- SQL operation complete.
 >>
 >>-- explain on hive DDL
 >>explain options 'f' drop table hive.hive.tnone;
@@ -851,7 +1149,7 @@
 
 --- SQL operation complete.
 >>
->>-- should not return unquthorized error.
+>>-- should not return unauthorized error.
 >>log;
 >>process hive ddl 'drop table tnotexists';
 
@@ -1030,50 +1328,10 @@
 
 --- SQL operation failed with errors.
 >>
->>-- return error: ctas on hive cannot use traf in the SELECT query
+>>-- return error: table temp does not exist
 >>create table hive.hive.temptab2 as select * from trafodion.sch.temp;
 
-*** ERROR[1214] Error encountered when executing HiveQL statement "create table `default`.TEMPTAB2 as select * from trafodion.sch.temp". Details: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 1:62 cannot recognize input near '.' 'temp' '<EOF>' in table source
-
---- SQL operation failed with errors.
->>
->>-- cannot use 'with hive options' with non-hive tables
->>create table trafodion.seabase.temp like trafodion."_MD_".objects
-+>   with hive options 'abc';
-
-*** ERROR[3242] This statement is not supported. Reason: Hive options cannot be specified for this table.
-
---- SQL operation failed with errors.
->>
->>-- target table must be a hive table
->>create external hive table trafodion.seabase.temp like trafodion."_MD_".objects;
-
-*** ERROR[3242] This statement is not supported. Reason: LIKE target table must be a hive table.
-
-*** ERROR[8822] The statement was not prepared.
-
->>
->>-- source table must be a trafodion table
->>create external hive table hive.hive.temp like hive.hive.temp2
-+>   with hive options 'abc';
-
-*** ERROR[3242] This statement is not supported. Reason: LIKE source table must be a trafodion table.
-
-*** ERROR[8822] The statement was not prepared.
-
->>
->>-- ctas tgt cannot be an external hive table
->>create external hive table hive.hive.temp as select * from trafodion."_MD_".objects;
-
-*** ERROR[3242] This statement is not supported. Reason: 'create hive table ... as ...' construct is not allowed.
-
-*** ERROR[8822] The statement was not prepared.
-
->>
->>-- like option must be specified
->>create external hive table hive.hive.temp (a int);
-
-*** ERROR[3242] This statement is not supported. Reason: LIKE clause must be specified to create this Hive table.
+*** ERROR[4082] Object TRAFODION.SCH.TEMP does not exist or is inaccessible.
 
 *** ERROR[8822] The statement was not prepared.
 
diff --git a/core/sql/regress/hive/EXPECTED009 b/core/sql/regress/hive/EXPECTED009
index fad737c..d819195 100644
--- a/core/sql/regress/hive/EXPECTED009
+++ b/core/sql/regress/hive/EXPECTED009
@@ -430,6 +430,9 @@
 T009T1
 T009T2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>invoke hive.sch_t009.t009t1;
 
diff --git a/core/sql/regress/hive/FILTER008 b/core/sql/regress/hive/FILTER008
index 1dcb5b9..9dcb6c4 100755
--- a/core/sql/regress/hive/FILTER008
+++ b/core/sql/regress/hive/FILTER008
@@ -32,4 +32,5 @@
 
 sed " 
 s/\/\* ObjectUID = *[0-9]*/ObjectUID = <UID removed>/g
+s/est_memory_per_node[ ]*[\.]* .*/est_memory_per_node... removed/g
 " $fil
diff --git a/core/sql/regress/hive/TEST008 b/core/sql/regress/hive/TEST008
index 61dfd60..6ff6c3f 100644
--- a/core/sql/regress/hive/TEST008
+++ b/core/sql/regress/hive/TEST008
@@ -27,6 +27,8 @@
 log LOG008 clear;
 cqd traf_ddl_on_hive_objects 'ON';
 
+set schema hive.sch008;
+
 showddl schema hive.sch008;
 create database hive.sch008;
 create schema if not exists hive.sch008;
@@ -50,10 +52,18 @@
 -- Use regrhive until that issue is fixed.
 sh echo "create table sch008.t00803 as select * from sch008.t00802;" > TEST008_junk;
 sh regrhive.ksh -f TEST008_junk;
---create table t00803 as select * from sch008.t00802;
+cqd hive_ctas_in_native_mode 'ON';
+-- create table t00803 as select * from sch008.t00802;
+cqd hive_ctas_in_native_mode reset;
 invoke t00803;
 select * from t00803;
 
+-- ctas create executed in Hive and insert executed in sql
+drop table if exists t008032;
+explain options 'f' create table t008032 no load as select * from t00802;
+create table t008032 no load as select * from sch008.t00802;
+invoke t008032;
+
 -- describe will show datatype 132 for b
 prepare s from insert into t00802 values (?, ?);
 describe s;
@@ -85,6 +95,9 @@
 -- view in a different schema than table
 create view hive.sch008.v00803 as select * from `default`.t00804;
 showddl hive.sch008.v00803;
+-- next one should not return an error but it currently does.
+-- Tables in schemas different than views schema is not being handled.
+-- Track it as a known diff.
 prepare s from select * from v00803;
 
 get objects in schema hive.sch008;
@@ -108,19 +121,42 @@
 create table hive."sch008"."t00805" (`a` int);
 showddl hive.sch008.t00805;
 
--- create external hive table LIKE a traf table
+-- create external hive table like a traf table
 drop table if exists hive.sch008.columns;
-create external hive table hive.sch008.columns like trafodion."_MD_".columns 
-      with hive options 'stored as sequencefile';
-create external hive table if not exists hive.sch008.columns like trafodion."_MD_".columns 
-      with hive options 'stored as sequencefile';
+explain create external table hive.sch008.columns no load 
+    hive options 'stored as sequencefile' 
+    as select * from trafodion."_MD_".columns;
+create external table hive.sch008.columns no load 
+    hive options 'stored as sequencefile' 
+    as select * from trafodion."_MD_".columns;
+create external table if not exists hive.sch008.columns no load 
+    hive options 'stored as sequencefile' 
+    as select * from trafodion."_MD_".columns;
 showddl hive.sch008.columns;
+
 -- create managed hive table LIKE traf table
 drop table if exists hive.sch008.columns;
-create hive table hive.sch008.columns like trafodion."_MD_".columns 
-      with hive options 'stored as sequencefile';
+create table hive.sch008.columns no load 
+    hive options 'stored as sequencefile' 
+    as select * from trafodion."_MD_".columns;
 showddl hive.sch008.columns;
 
+-- ctas stmt is passed to Hive layer. 
+drop table if exists hive.hive.tempsrc;
+drop table if exists hive.hive.temptgt;
+create table hive.hive.tempsrc(a int);
+cqd hive_ctas_in_native_mode 'ON';
+explain options 'f' create external table hive.hive.temptgt as select * from tempsrc;
+-- cannot create external table thru CTAS in Hive
+create external table hive.hive.temptgt as select * from tempsrc;
+
+-- hive execution of CTAS returns an error due to a security issue on some
+-- platforms. Do not execute it until the issue is fixed.
+prepare s from create table hive.hive.temptgt as select * from tempsrc;
+--execute s;
+invoke hive.hive.temptgt;
+cqd hive_ctas_in_native_mode reset;
+
 -- create and drop hive table and external table
 drop table if exists t00806;
 create table t00806 (a int, b string);
@@ -194,8 +230,41 @@
 sh echo "select * from sch008.t00807;" > TEST008_junk;
 sh regrhive.ksh -f TEST008_junk | tee -a LOG008;
 
-drop table t00807;
+explain options 'f' create table hive.sch008.t008072 as select * from hive.sch008.t00807;
+create table hive.sch008.t008072 as select * from hive.sch008.t00807;
 
+drop table t008072;
+
+drop table if exists trafodion.sch.t00807;
+create table trafodion.sch.t00807 (a int);
+explain options 'f' create table hive.sch008.t008072 as select * from trafodion.sch.t00807;
+create table hive.sch008.t008072 as select * from trafodion.sch.t00807;
+invoke hive.sch008.t008072;
+
+drop table t00807;
+drop table t008072;
+
+-- alter rename. Should unregister the source table.
+create table t00807 (a int);
+alter table t00807 rename to `default`.t00807ren;
+select * from trafodion."_MD_".objects where schema_name = 'HIVE' and object_name = 'T00807';
+-- should show
+showddl hive.t00807ren;
+-- should not show
+showddl t00807ren;
+drop table hive.t00807ren;
+
+-- alter rename to the hive schema set in session (hive.sch008)
+create table t00807 (a int);
+alter table t00807 rename to t00807ren;
+-- should show
+showddl t00807ren;
+-- should not show
+showddl hive.t00807ren;
+
+-- msck (meta store check) command support
+msck repair table t00807ren;
+alter table t00807ren recover partitions;
 
 -- explain on hive DDL
 explain options 'f' drop table hive.hive.tnone;
@@ -212,7 +281,7 @@
 grant role DB__HIVEROLE to SQL_USER4;
 showddl role DB__HIVEROLE;
 
--- should not return unquthorized error.
+-- should not return unauthorized error.
 log;
 sh sqlci -i"TEST008(hive_ddl_as_user4)" -u"SQL_User4";
 log LOG008;
@@ -270,26 +339,9 @@
 -- return error: unsupported operation from 'process hive ddl' stmt
 process hive ddl 'grnt abc';
 
--- return error: ctas on hive cannot use traf in the SELECT query
+-- return error: table temp does not exist
 create table hive.hive.temptab2 as select * from trafodion.sch.temp;
 
--- cannot use 'with hive options' with non-hive tables
-create table trafodion.seabase.temp like trafodion."_MD_".objects
-   with hive options 'abc';
-
--- target table must be a hive table
-create external hive table trafodion.seabase.temp like trafodion."_MD_".objects;
-
--- source table must be a trafodion table
-create external hive table hive.hive.temp like hive.hive.temp2
-   with hive options 'abc';
-
--- ctas tgt cannot be an external hive table
-create external hive table hive.hive.temp as select * from trafodion."_MD_".objects;
-
--- like option must be specified
-create external hive table hive.hive.temp (a int);
-
 drop database hive.sch008 cascade;
 drop schema if exists hive.sch008 cascade;
 showddl schema hive.sch008;
diff --git a/core/sql/regress/privs1/EXPECTED123 b/core/sql/regress/privs1/EXPECTED123
index 45d5db9..dd8211b 100644
--- a/core/sql/regress/privs1/EXPECTED123
+++ b/core/sql/regress/privs1/EXPECTED123
@@ -17,6 +17,9 @@
 SQL_USER8
 SQL_USER9
 
+=======================
+ 11 row(s) returned
+
 --- SQL operation complete.
 >>get roles;
 
@@ -29,6 +32,9 @@
 DB__ROOTROLE
 PUBLIC
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get privileges on component sql_operations for "PUBLIC";
@@ -39,6 +45,9 @@
 CREATE_SCHEMA
 SHOW
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>create role t123_adminrole;
@@ -195,6 +204,9 @@
 SQL_USER8
 SQL_USER9
 
+=======================
+ 11 row(s) returned
+
 --- SQL operation complete.
 >>get roles;
 
@@ -211,6 +223,9 @@
 T123_OWNERROLE
 T123_PLANNERROLE
 
+=======================
+ 9 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user1;
 
@@ -221,6 +236,9 @@
 T123_ADMINROLE
 T123_PLANNERROLE
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user2;
 
@@ -230,6 +248,9 @@
 PUBLIC
 T123_PLANNERROLE
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user3;
 
@@ -238,6 +259,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user4;
 
@@ -246,6 +270,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user5;
 
@@ -255,6 +282,9 @@
 PUBLIC
 T123_OWNERROLE
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get users for role t123_adminrole;
@@ -264,6 +294,9 @@
 
 SQL_USER1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get users for role t123_plannerrole;
 
@@ -273,6 +306,9 @@
 SQL_USER1
 SQL_USER2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get users for role t123_dummyrole;
 
@@ -284,6 +320,9 @@
 
 SQL_USER5
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get privileges for user sql_user1;
@@ -305,6 +344,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 13 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user2;
 
@@ -322,6 +364,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 10 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user3;
 
@@ -336,6 +381,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user4;
 
@@ -352,6 +400,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 9 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user5;
 
@@ -376,6 +427,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 17 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get privileges for role t123_adminrole;
@@ -386,6 +440,9 @@
 --DU---    TRAFODION.T123SCH.GAMES
 --DU---    TRAFODION.T123SCH.TEAMS
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for role t123_plannerrole;
 
@@ -396,6 +453,9 @@
 ----G--    TRAFODION.T123SCH.PLAYERS_SEQUENCE
 -I-----    TRAFODION.T123SCH.TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for role t123_dummyrole;
 
@@ -416,6 +476,9 @@
 SIDU-R-    TRAFODION.T123SCH.SB_PERSISTENT_SAMPLES
 SIDU-R-    TRAFODION.T123SCH.TEAMS
 
+=======================
+ 10 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for role "PUBLIC";
 
@@ -430,6 +493,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get tables for user sql_user1;
@@ -441,6 +507,9 @@
 TRAFODION."T123SCH".PLAYERS
 TRAFODION."T123SCH".TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get tables for user sql_user2;
 
@@ -451,6 +520,9 @@
 TRAFODION."T123SCH".PLAYERS
 TRAFODION."T123SCH".TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get tables for user sql_user3;
 
@@ -460,6 +532,9 @@
 TRAFODION."T123SCH".PLAYERS
 TRAFODION."T123SCH".TEAMS
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get tables for user sql_user4;
 
@@ -470,6 +545,9 @@
 TRAFODION."T123SCH".PLAYERS
 TRAFODION."T123SCH".TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get tables for user sql_user5;
 
@@ -483,6 +561,9 @@
 TRAFODION."T123SCH".SB_PERSISTENT_SAMPLES
 TRAFODION."T123SCH".TEAMS
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get indexes for user sql_user1;
@@ -492,6 +573,9 @@
 
 TRAFODION."T123SCH".GAMES_VISITOR
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get indexes for user sql_user2;
 
@@ -500,6 +584,9 @@
 
 TRAFODION."T123SCH".GAMES_VISITOR
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get indexes for user sql_user3;
 
@@ -511,6 +598,9 @@
 
 TRAFODION."T123SCH".GAMES_VISITOR
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get indexes for user sql_user5;
 
@@ -519,6 +609,9 @@
 
 TRAFODION."T123SCH".GAMES_VISITOR
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get views for user sql_user1;
@@ -542,6 +635,9 @@
 TRAFODION."T123SCH".HOME_TEAMS_GAMES
 TRAFODION."T123SCH".PLAYERS_ON_TEAM
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get libraries for user sql_user1;
@@ -552,6 +648,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get libraries for user sql_user2;
 
@@ -561,6 +660,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get libraries for user sql_user3;
 
@@ -570,6 +672,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get libraries for user sql_user4;
 
@@ -579,6 +684,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get libraries for user sql_user5;
 
@@ -588,6 +696,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -611,6 +722,9 @@
 
 SQL_USER1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles;
 
@@ -621,6 +735,9 @@
 T123_ADMINROLE
 T123_PLANNERROLE
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user1;
 
@@ -631,6 +748,9 @@
 T123_ADMINROLE
 T123_PLANNERROLE
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user2;
 
@@ -639,6 +759,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user3;
 
@@ -647,6 +770,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user4;
 
@@ -655,6 +781,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user5;
 
@@ -663,6 +792,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get users for role t123_adminrole;
@@ -672,6 +804,9 @@
 
 SQL_USER1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get users for role t123_plannerrole;
 
@@ -680,6 +815,9 @@
 
 SQL_USER1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get users for role t123_dummyrole;
 
@@ -707,6 +845,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 13 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user2;
 
@@ -729,6 +870,9 @@
 --DU---    TRAFODION.T123SCH.GAMES
 --DU---    TRAFODION.T123SCH.TEAMS
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for role t123_plannerrole;
 
@@ -739,6 +883,9 @@
 ----G--    TRAFODION.T123SCH.PLAYERS_SEQUENCE
 -I-----    TRAFODION.T123SCH.TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for role t123_dummyrole;
 
@@ -759,6 +906,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get tables for user sql_user1;
@@ -770,6 +920,9 @@
 TRAFODION."T123SCH".PLAYERS
 TRAFODION."T123SCH".TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get tables for user sql_user2;
 
@@ -799,6 +952,9 @@
 
 TRAFODION."T123SCH".GAMES_VISITOR
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get indexes for user sql_user2;
 
@@ -853,6 +1009,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get libraries for user sql_user2;
 
@@ -900,6 +1059,9 @@
 
 SQL_USER2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles;
 
@@ -909,6 +1071,9 @@
 PUBLIC
 T123_PLANNERROLE
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user1;
 
@@ -917,6 +1082,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user2;
 
@@ -926,6 +1094,9 @@
 PUBLIC
 T123_PLANNERROLE
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user3;
 
@@ -934,6 +1105,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user4;
 
@@ -942,6 +1116,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user5;
 
@@ -950,6 +1127,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get users for role t123_adminrole;
@@ -962,6 +1142,9 @@
 
 SQL_USER2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get users for role t123_dummyrole;
 
@@ -989,6 +1172,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 10 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user3;
 
@@ -1012,6 +1198,9 @@
 ----G--    TRAFODION.T123SCH.PLAYERS_SEQUENCE
 -I-----    TRAFODION.T123SCH.TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for role t123_dummyrole;
 
@@ -1032,6 +1221,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get tables for user sql_user1;
@@ -1048,6 +1240,9 @@
 TRAFODION."T123SCH".PLAYERS
 TRAFODION."T123SCH".TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get tables for user sql_user3;
 
@@ -1077,6 +1272,9 @@
 
 TRAFODION."T123SCH".GAMES_VISITOR
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get indexes for user sql_user3;
 
@@ -1131,6 +1329,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get libraries for user sql_user3;
 
@@ -1173,6 +1374,9 @@
 
 SQL_USER3
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles;
 
@@ -1181,6 +1385,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user1;
 
@@ -1189,6 +1396,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user2;
 
@@ -1197,6 +1407,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user3;
 
@@ -1205,6 +1418,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user4;
 
@@ -1213,6 +1429,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user5;
 
@@ -1221,6 +1440,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get users for role t123_adminrole;
@@ -1255,6 +1477,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user4;
 
@@ -1288,6 +1513,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get tables for user sql_user1;
@@ -1308,6 +1536,9 @@
 TRAFODION."T123SCH".PLAYERS
 TRAFODION."T123SCH".TEAMS
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get tables for user sql_user4;
 
@@ -1386,6 +1617,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get libraries for user sql_user4;
 
@@ -1423,6 +1657,9 @@
 
 SQL_USER4
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles;
 
@@ -1431,6 +1668,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user1;
 
@@ -1439,6 +1679,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user2;
 
@@ -1447,6 +1690,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user3;
 
@@ -1455,6 +1701,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user4;
 
@@ -1463,6 +1712,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user5;
 
@@ -1471,6 +1723,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get users for role t123_adminrole;
@@ -1510,6 +1765,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 9 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user5;
 
@@ -1540,6 +1798,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get tables for user sql_user1;
@@ -1566,6 +1827,9 @@
 TRAFODION."T123SCH".PLAYERS
 TRAFODION."T123SCH".TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get tables for user sql_user5;
 
@@ -1595,6 +1859,9 @@
 
 TRAFODION."T123SCH".GAMES_VISITOR
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get indexes for user sql_user5;
 
@@ -1649,6 +1916,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get libraries for user sql_user5;
 
@@ -1681,6 +1951,9 @@
 
 SQL_USER5
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles;
 
@@ -1690,6 +1963,9 @@
 PUBLIC
 T123_OWNERROLE
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user1;
 
@@ -1698,6 +1974,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user2;
 
@@ -1706,6 +1985,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user3;
 
@@ -1714,6 +1996,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user4;
 
@@ -1722,6 +2007,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get roles for user sql_user5;
 
@@ -1731,6 +2019,9 @@
 PUBLIC
 T123_OWNERROLE
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get users for role t123_adminrole;
@@ -1749,6 +2040,9 @@
 
 SQL_USER5
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get privileges for user sql_user1;
@@ -1786,6 +2080,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 17 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get privileges for role t123_adminrole;
@@ -1813,6 +2110,9 @@
 SIDU-R-    TRAFODION.T123SCH.SB_PERSISTENT_SAMPLES
 SIDU-R-    TRAFODION.T123SCH.TEAMS
 
+=======================
+ 10 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for role "PUBLIC";
 
@@ -1827,6 +2127,9 @@
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NAME
 S------    TRAFODION.T123SCH.TEAMS <Column> TEAM_NUMBER
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get tables for user sql_user1;
@@ -1861,6 +2164,9 @@
 TRAFODION."T123SCH".SB_PERSISTENT_SAMPLES
 TRAFODION."T123SCH".TEAMS
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get indexes for user sql_user1;
@@ -1890,6 +2196,9 @@
 
 TRAFODION."T123SCH".GAMES_VISITOR
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get views for user sql_user1;
@@ -1921,6 +2230,9 @@
 TRAFODION."T123SCH".HOME_TEAMS_GAMES
 TRAFODION."T123SCH".PLAYERS_ON_TEAM
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get libraries for user sql_user1;
@@ -1951,6 +2263,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -1982,6 +2297,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get users for role unknown_role;
 
diff --git a/core/sql/regress/privs1/EXPECTED125 b/core/sql/regress/privs1/EXPECTED125
index d464042..47a5921 100644
--- a/core/sql/regress/privs1/EXPECTED125
+++ b/core/sql/regress/privs1/EXPECTED125
@@ -497,6 +497,9 @@
 ----G--    TRAFODION.T125SCH3.T125_L1
 ------E    TRAFODION.T125SCH3.TRANSLATEBITMAP
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user1;
 
@@ -511,6 +514,9 @@
 S------    TRAFODION.T125SCH3.GAMES_BY_PLAYER
 S------    TRAFODION.T125SCH3.GAMES_BY_PLAYER <Column> PLAYER_NAME
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user2;
 
@@ -533,6 +539,9 @@
 ----G--    TRAFODION.T125SCH3.T125_L1
 ------E    TRAFODION.T125SCH3.TRANSLATEBITMAP
 
+=======================
+ 15 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user7;
 
@@ -549,6 +558,9 @@
 ----G--    TRAFODION.T125SCH3.T125_L1
 ------E    TRAFODION.T125SCH3.TRANSLATEBITMAP
 
+=======================
+ 9 row(s) returned
+
 --- SQL operation complete.
 >>get privileges for user sql_user8;
 
@@ -574,6 +586,9 @@
 ------E    TRAFODION.T125SCH3.TESTHIVE
 ------E    TRAFODION.T125SCH3.TRANSLATEBITMAP
 
+=======================
+ 18 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t125sch1;
@@ -588,6 +603,9 @@
 SIDU-R-    DB__ROOT
 SIDU-R-    SQL_USER2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for sql_user1;
 
@@ -599,6 +617,9 @@
 
 SIDU-R-    SQL_USER2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for sql_user7;
 
@@ -620,6 +641,9 @@
 S----R-    DB__ROOT
 S------    SQL_USER2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for sql_user1;
 
@@ -631,6 +655,9 @@
 
 S------    SQL_USER2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for sql_user7;
 
@@ -652,6 +679,9 @@
 ---UG--    DB__ROOT
 ----G--    T125_ROLE1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for sql_user1;
 
@@ -663,6 +693,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for sql_user7;
 
@@ -671,6 +704,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for sql_user8;
 
@@ -682,6 +718,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for t125_adminrole;
 
@@ -693,6 +732,9 @@
 
 ----G--    DB__ROOT
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence for sql_user1;
 
@@ -726,6 +768,9 @@
 SIDU-R-    SQL_USER2
 S------    T125_ROLE1
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for sql_user1;
 
@@ -738,6 +783,9 @@
 SIDU-R-    SQL_USER2
 S------    T125_ROLE1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for sql_user7;
 
@@ -746,6 +794,9 @@
 
 S------    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for sql_user8;
 
@@ -757,6 +808,9 @@
 
 S------    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for t125_adminrole;
 
@@ -769,6 +823,9 @@
 S----R-    DB__ROOT
 S------    SQL_USER2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for sql_user1;
 
@@ -780,6 +837,9 @@
 
 S------    SQL_USER2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for sql_user7;
 
@@ -801,6 +861,9 @@
 ---UG--    DB__ROOT
 ----G--    T125_ROLE1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for sql_user1;
 
@@ -812,6 +875,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for sql_user7;
 
@@ -820,6 +886,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for sql_user8;
 
@@ -831,6 +900,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for t125_adminrole;
 
@@ -843,6 +915,9 @@
 ----G--    DB__ROOT
 ----G--    SQL_USER1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence for sql_user1;
 
@@ -851,6 +926,9 @@
 
 ----G--    SQL_USER1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence for sql_user2;
 
@@ -881,6 +959,9 @@
 SIDU-R-    SQL_USER2
 SIDU-R-    T125_ADMINROLE
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for sql_user1;
 
@@ -889,6 +970,9 @@
 
 -I-----    SQL_USER1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for sql_user2;
 
@@ -897,6 +981,9 @@
 
 SIDU-R-    SQL_USER2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for sql_user7;
 
@@ -908,6 +995,9 @@
 
 SIDU-R-    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for t125_role1;
 
@@ -919,6 +1009,9 @@
 
 SIDU-R-    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player;
 
@@ -929,6 +1022,9 @@
 S------    SQL_USER2
 S----R-    T125_ADMINROLE
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for sql_user1;
 
@@ -937,6 +1033,9 @@
 
 S------    SQL_USER1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for sql_user2;
 
@@ -945,6 +1044,9 @@
 
 S------    SQL_USER2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for sql_user7;
 
@@ -956,6 +1058,9 @@
 
 S----R-    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for t125_role1;
 
@@ -967,6 +1072,9 @@
 
 S----R-    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1;
 
@@ -976,6 +1084,9 @@
 ---UG--    T125_ADMINROLE
 ----G--    T125_ROLE1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for sql_user1;
 
@@ -987,6 +1098,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for sql_user7;
 
@@ -995,6 +1109,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for sql_user8;
 
@@ -1003,6 +1120,9 @@
 
 ---UG--    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for t125_role1;
 
@@ -1011,6 +1131,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for t125_adminrole;
 
@@ -1019,6 +1142,9 @@
 
 ---UG--    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence;
 
@@ -1027,6 +1153,9 @@
 
 ----G--    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence for sql_user1;
 
@@ -1044,6 +1173,9 @@
 
 ----G--    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence for t125_role1;
 
@@ -1055,6 +1187,9 @@
 
 ----G--    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -1081,6 +1216,9 @@
 T125SCH2
 T125SCH3
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t125sch1;
@@ -1098,6 +1236,9 @@
 SB_PERSISTENT_SAMPLES
 TEAMS
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>get views;
 
@@ -1108,6 +1249,9 @@
 HOME_TEAMS_GAMES
 PLAYERS_ON_TEAM
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get indexes;
 
@@ -1116,6 +1260,9 @@
 
 PLAYERS_TEAMS
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get sequences, match 'T125SCH%';
 
@@ -1126,6 +1273,9 @@
 T125SCH2.PLAYERS_SEQUENCE
 T125SCH3.PLAYERS_SEQUENCE
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get libraries, match 'T125%';
 
@@ -1135,6 +1285,9 @@
 T125_L1
 T125_L2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get functions;
 
@@ -1143,6 +1296,9 @@
 
 TRANSLATEBITMAP
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get procedures;
 
@@ -1151,6 +1307,9 @@
 
 TESTHIVE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get indexes on table players;
@@ -1160,6 +1319,9 @@
 
 PLAYERS_TEAMS
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get views on table players;
 
@@ -1168,6 +1330,9 @@
 
 TRAFODION.T125SCH1.PLAYERS_ON_TEAM
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get views on view players_on_team;
 
@@ -1176,6 +1341,9 @@
 
 TRAFODION.T125SCH1.GAMES_BY_PLAYER
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get tables in view games_by_player;
@@ -1186,6 +1354,9 @@
 TRAFODION.T125SCH1.GAMES
 TRAFODION.T125SCH1.TEAMS
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get views in view games_by_player;
 
@@ -1194,6 +1365,9 @@
 
 TRAFODION.T125SCH1.PLAYERS_ON_TEAM
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get objects in view games_by_player;
 
@@ -1204,6 +1378,9 @@
 TRAFODION.T125SCH1.PLAYERS_ON_TEAM
 TRAFODION.T125SCH1.TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t125sch2;
@@ -1221,6 +1398,9 @@
 SB_PERSISTENT_SAMPLES
 TEAMS
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>get views in schema t125sch2;
 
@@ -1231,6 +1411,9 @@
 HOME_TEAMS_GAMES
 PLAYERS_ON_TEAM
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get indexes in schema t125sch2;
 
@@ -1239,6 +1422,9 @@
 
 PLAYERS_TEAMS
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get sequences in schema t125sch2;
 
@@ -1247,6 +1433,9 @@
 
 PLAYERS_SEQUENCE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get libraries in schema t125sch2;
 
@@ -1256,6 +1445,9 @@
 T125_L1
 T125_L2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get functions in schema t125sch2;
 
@@ -1264,6 +1456,9 @@
 
 TRANSLATEBITMAP
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get procedures in schema t125sch2;
 
@@ -1272,6 +1467,9 @@
 
 TESTHIVE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t125sch3;
@@ -1289,6 +1487,9 @@
 SB_PERSISTENT_SAMPLES
 TEAMS
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games;
 
@@ -1299,6 +1500,9 @@
 SIDU-R-    SQL_USER2
 SIDU-R-    T125_ADMINROLE
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for t125_role1;
 
@@ -1318,6 +1522,9 @@
 T125SCH3.HOME_TEAMS_GAMES
 T125SCH3.PLAYERS_ON_TEAM
 
+=======================
+ 9 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player;
 
@@ -1328,6 +1535,9 @@
 S------    SQL_USER2
 S----R-    T125_ADMINROLE
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for user sql_user8;
 
@@ -1336,6 +1546,9 @@
 
 S----R-    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get indexes in schema t125sch3;
 
@@ -1344,6 +1557,9 @@
 
 PLAYERS_TEAMS
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get sequences in catalog trafodion, match 'T125SCH%';
 
@@ -1354,6 +1570,9 @@
 T125SCH2.PLAYERS_SEQUENCE
 T125SCH3.PLAYERS_SEQUENCE
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence;
 
@@ -1362,6 +1581,9 @@
 
 ----G--    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence for t125_role1;
 
@@ -1374,6 +1596,9 @@
 T125_L1
 T125_L2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1;
 
@@ -1383,6 +1608,9 @@
 ---UG--    T125_ADMINROLE
 ----G--    T125_ROLE1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for user sql_user8;
 
@@ -1391,6 +1619,9 @@
 
 ---UG--    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get functions in schema t125sch3;
 
@@ -1399,6 +1630,9 @@
 
 TRANSLATEBITMAP
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get procedures;
 
@@ -1407,6 +1641,9 @@
 
 TESTHIVE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get functions for library t125_l1;
@@ -1416,6 +1653,9 @@
 
 T125SCH3.TRANSLATEBITMAP
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get procedures for library t125_l2;
 
@@ -1424,6 +1664,9 @@
 
 T125SCH3.TESTHIVE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -1454,6 +1697,9 @@
 T125SCH2
 T125SCH3
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t125sch1;
@@ -1475,6 +1721,9 @@
 
 T125SCH3.PLAYERS_SEQUENCE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get libraries, match 'T125%';
 
@@ -1546,6 +1795,9 @@
 SB_PERSISTENT_SAMPLES
 TEAMS
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games;
 
@@ -1554,6 +1806,9 @@
 
 SIDU-R-    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for t125_role1;
 
@@ -1567,6 +1822,9 @@
 T125SCH3.HOME_TEAMS_GAMES
 T125SCH3.PLAYERS_ON_TEAM
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player;
 
@@ -1575,6 +1833,9 @@
 
 S----R-    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for user sql_user8;
 
@@ -1583,6 +1844,9 @@
 
 S----R-    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get indexes in schema t125sch3;
 
@@ -1594,6 +1858,9 @@
 
 T125SCH3.PLAYERS_SEQUENCE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence;
 
@@ -1602,6 +1869,9 @@
 
 ----G--    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence for t125_role1;
 
@@ -1614,6 +1884,9 @@
 T125_L1
 T125_L2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1;
 
@@ -1622,6 +1895,9 @@
 
 ---UG--    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for user sql_user8;
 
@@ -1630,6 +1906,9 @@
 
 ---UG--    T125_ADMINROLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get functions in schema t125sch3;
 
@@ -1638,6 +1917,9 @@
 
 TRANSLATEBITMAP
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get procedures;
 
@@ -1646,6 +1928,9 @@
 
 TESTHIVE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>get functions for library t125_l1;
@@ -1655,6 +1940,9 @@
 
 T125SCH3.TRANSLATEBITMAP
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get procedures for library t125_l2;
 
@@ -1663,6 +1951,9 @@
 
 T125SCH3.TESTHIVE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -1692,6 +1983,9 @@
 T125SCH2
 T125SCH3
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t125sch1;
@@ -1713,6 +2007,9 @@
 
 T125SCH2.PLAYERS_SEQUENCE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get libraries, match 'T125%';
 
@@ -1763,6 +2060,9 @@
 
 PLAYERS_SEQUENCE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get libraries in schema t125sch2;
 
@@ -1771,6 +2071,9 @@
 
 T125_L2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get functions in schema t125sch2;
 
@@ -1782,6 +2085,9 @@
 
 TESTHIVE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t125sch3;
@@ -1794,6 +2100,9 @@
 
 GAMES
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games;
 
@@ -1802,6 +2111,9 @@
 
 -I-----    SQL_USER1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for t125_role1;
 
@@ -1813,6 +2125,9 @@
 
 T125SCH3.GAMES_BY_PLAYER
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player;
 
@@ -1821,6 +2136,9 @@
 
 S------    SQL_USER1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for user sql_user8;
 
@@ -1835,6 +2153,9 @@
 
 T125SCH2.PLAYERS_SEQUENCE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on sequence players_sequence;
 
@@ -1893,6 +2214,9 @@
 T125SCH2
 T125SCH3
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t125sch1;
@@ -1905,6 +2229,9 @@
 
 GAMES
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get views;
 
@@ -1913,6 +2240,9 @@
 
 GAMES_BY_PLAYER
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get indexes;
 
@@ -1948,6 +2278,9 @@
 TRAFODION.T125SCH1.GAMES
 TRAFODION.T125SCH1.TEAMS
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get views in view games_by_player;
 
@@ -1956,6 +2289,9 @@
 
 TRAFODION.T125SCH1.PLAYERS_ON_TEAM
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get objects in view games_by_player;
 
@@ -1966,6 +2302,9 @@
 TRAFODION.T125SCH1.PLAYERS_ON_TEAM
 TRAFODION.T125SCH1.TEAMS
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t125sch2;
@@ -1979,6 +2318,9 @@
 GAMES
 TEAMS
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get views in schema t125sch2;
 
@@ -1987,6 +2329,9 @@
 
 GAMES_BY_PLAYER
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get indexes in schema t125sch2;
 
@@ -2015,6 +2360,9 @@
 GAMES
 PLAYERS
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games;
 
@@ -2023,6 +2371,9 @@
 
 SIDU-R-    SQL_USER2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games for t125_role1;
 
@@ -2036,6 +2387,9 @@
 T125SCH2.GAMES_BY_PLAYER
 T125SCH3.GAMES_BY_PLAYER
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player;
 
@@ -2044,6 +2398,9 @@
 
 S------    SQL_USER2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on view games_by_player for user sql_user8;
 
@@ -2067,6 +2424,9 @@
 
 T125_L1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1;
 
@@ -2075,6 +2435,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for user sql_user8;
 
@@ -2086,6 +2449,9 @@
 
 TRANSLATEBITMAP
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get procedures;
 
@@ -2098,6 +2464,9 @@
 
 T125SCH3.TRANSLATEBITMAP
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get procedures for library t125_l2;
 
@@ -2132,6 +2501,9 @@
 T125SCH2
 T125SCH3
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t125sch1;
@@ -2190,6 +2562,9 @@
 GAMES
 TEAMS
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get views in schema t125sch2;
 
@@ -2220,6 +2595,9 @@
 
 PLAYERS
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on table games;
 
@@ -2255,6 +2633,9 @@
 
 T125_L1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1;
 
@@ -2263,6 +2644,9 @@
 
 ----G--    T125_ROLE1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on library t125_l1 for user sql_user8;
 
@@ -2274,6 +2658,9 @@
 
 TRANSLATEBITMAP
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get procedures;
 
@@ -2286,6 +2673,9 @@
 
 T125SCH3.TRANSLATEBITMAP
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get procedures for library t125_l2;
 
diff --git a/core/sql/regress/privs1/EXPECTED132 b/core/sql/regress/privs1/EXPECTED132
index 0c9f2fe..7a60061 100644
--- a/core/sql/regress/privs1/EXPECTED132
+++ b/core/sql/regress/privs1/EXPECTED132
@@ -21,6 +21,9 @@
 CREATE_SCHEMA
 SHOW
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- succeed: DB__ROOT can create a library
@@ -42,6 +45,9 @@
 
 T132_L1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>drop library t132_l1;
 
@@ -103,6 +109,9 @@
 
 T132_L1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>drop library t132_l1;
 
@@ -171,6 +180,9 @@
 
 T132_L1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>drop library t132_l1;
 
@@ -199,6 +211,9 @@
 CREATE_SCHEMA
 SHOW
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>obey TEST132(test_popindex);
@@ -249,6 +264,9 @@
 T132T1
 T132T2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>cqd SHOWDDL_DISPLAY_PRIVILEGE_GRANTS 'ON';
 
@@ -649,6 +667,9 @@
 CREATE_SCHEMA
 SHOW
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>revoke component privilege "SHOW" on sql_operations from "PUBLIC";
 
@@ -660,6 +681,9 @@
 
 CREATE_SCHEMA
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- DB__ROOT has all privileges
@@ -1265,6 +1289,9 @@
 
 CREATE_SCHEMA
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>grant component privilege "SHOW" on sql_operations to "PUBLIC";
 
@@ -1277,6 +1304,9 @@
 CREATE_SCHEMA
 SHOW
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>changeuser sql_user1;
 >>obey TEST132(show_objects);
@@ -1494,6 +1524,9 @@
 T132T1
 T132T2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>select count(*) from t132t1;
 
@@ -1636,6 +1669,9 @@
 CREATE_SCHEMA
 SHOW
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>revoke component privilege "SHOW" on sql_operations from "PUBLIC";
 
@@ -1647,6 +1683,9 @@
 
 CREATE_SCHEMA
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- Run with MANAGE_STATISTICS and no SHOW
@@ -1709,6 +1748,9 @@
 
 MANAGE_STATISTICS
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>changeuser sql_user3;
 >>obey TEST132(show_update_stats);
@@ -1889,6 +1931,9 @@
 
 MANAGE_STATISTICS
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>changeuser sql_user3;
 >>obey TEST132(update_stats1);
@@ -1928,6 +1973,9 @@
 CREATE_SCHEMA
 SHOW
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>drop table t132t1;
diff --git a/core/sql/regress/privs1/EXPECTED136 b/core/sql/regress/privs1/EXPECTED136
index ccd9fb2..b34e572 100755
--- a/core/sql/regress/privs1/EXPECTED136
+++ b/core/sql/regress/privs1/EXPECTED136
@@ -249,6 +249,9 @@
 SQL_USER8
 SQL_USER9
 
+=======================
+ 11 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- succeed:  test unreserved words
diff --git a/core/sql/regress/privs1/EXPECTED141 b/core/sql/regress/privs1/EXPECTED141
index 07da30d..598dc8e 100644
--- a/core/sql/regress/privs1/EXPECTED141
+++ b/core/sql/regress/privs1/EXPECTED141
@@ -234,6 +234,9 @@
 U1T3
 U1T4
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t141_user2;
@@ -259,6 +262,9 @@
 U2T1
 U2T2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t141_user3;
@@ -277,6 +283,9 @@
 
 U3T1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -344,6 +353,9 @@
 U2T1
 U2T2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- create a view on user1's table
@@ -538,6 +550,9 @@
 U1T3
 U1T4
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t141_user2;
@@ -563,6 +578,9 @@
 U2T1
 U2T2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>set schema t141_user3;
@@ -581,6 +599,9 @@
 
 U3T1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -676,6 +697,9 @@
 U2T1
 U2T2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- create a view on user1's table
@@ -1011,6 +1035,9 @@
 
 U3T1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get views;
 
@@ -1022,6 +1049,9 @@
 U3V3
 U3V4
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- ============================================================================
diff --git a/core/sql/regress/privs2/EXPECTED135 b/core/sql/regress/privs2/EXPECTED135
index 5bf3c18..744b645 100644
--- a/core/sql/regress/privs2/EXPECTED135
+++ b/core/sql/regress/privs2/EXPECTED135
@@ -26,6 +26,9 @@
 ROLE_USAGE
 SCHEMA_PRIVILEGES
 
+=======================
+ 7 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- Prepare metadata queries
@@ -902,6 +905,9 @@
 PUBLIC
 T135_ROLE1
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>
 >>grant component privilege MANAGE_LIBRARY on sql_operations to t135_role1;
@@ -917,6 +923,9 @@
 
 MANAGE_LIBRARY
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on component sql_operations for "PUBLIC";
 
@@ -927,6 +936,9 @@
 CREATE_SCHEMA
 SHOW
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -1300,6 +1312,9 @@
 CREATE_SCHEMA
 SHOW
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>revoke role t135_role1 from sql_user1;
@@ -1319,6 +1334,9 @@
 DB__ROOTROLE
 PUBLIC
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>
 >>drop schema t135sch_user3 cascade;
diff --git a/core/sql/regress/privs2/EXPECTED138 b/core/sql/regress/privs2/EXPECTED138
index f8dad07..b42fc78 100644
--- a/core/sql/regress/privs2/EXPECTED138
+++ b/core/sql/regress/privs2/EXPECTED138
@@ -21,6 +21,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- Verify sql_user1 does not have CREATE or CREATE_TABLE privilege
@@ -37,6 +40,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>create table user1_t1 (c1 int not null primary key, c2 int);
 
@@ -113,6 +119,9 @@
 
 CREATE_TABLE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>sh sqlci -i "TEST138(create_tbl)" -u sql_user1;
 >>get tables;
@@ -124,6 +133,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>create table user1_t1 (c1 int not null primary key, c2 int);
 
@@ -209,6 +221,9 @@
 USER1_T1
 USER1_T2
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- add columns, constraints, and indexes
@@ -402,6 +417,9 @@
 USER1_T1
 USER1_T2
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>drop table user1_t1 cascade;
 
@@ -424,6 +442,9 @@
 USER1_T1
 USER1_T2
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>
 >>exit;
@@ -442,6 +463,9 @@
 USER1_T1
 USER1_T2
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>
 >>obey TEST138(drop_tbl);
@@ -463,6 +487,9 @@
 USER1_T1
 USER1_T2
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>drop table user1_t1 cascade;
 
@@ -479,6 +506,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -491,6 +521,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>obey TEST138(test_alter);
@@ -513,6 +546,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- Verify sql_user2 does not have ALTER or ALTER_TABLE privilege
@@ -534,6 +570,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>create table user1_t1 (c1 int not null primary key, c2 int);
 
@@ -623,6 +662,9 @@
 USER1_T1
 USER1_T2
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- add columns, constraints, and indexes
@@ -821,6 +863,9 @@
 USER1_T1
 USER1_T2
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- add columns, constraints, and indexes
@@ -1022,6 +1067,9 @@
 ALTER_SEQUENCE
 ALTER_VIEW
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>sh sqlci -i "TEST138(alter_tbl)" -u sql_user2;
 >>get tables;
@@ -1035,6 +1083,9 @@
 USER1_T1
 USER1_T2
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- add columns, constraints, and indexes
@@ -1242,6 +1293,9 @@
 USER1_T1
 USER1_T2
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>drop table user1_t1 cascade;
 
@@ -1258,6 +1312,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -1275,6 +1332,9 @@
 CREATE_SCHEMA
 SHOW
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get privileges on component sql_operations for sql_user1;
 
@@ -1313,6 +1373,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>create table user1_t1 (c1 int not null primary key, c2 int);
 
@@ -1425,6 +1488,9 @@
 
 CREATE_VIEW
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>sh sqlci -i "TEST138(create_view)" -u sql_user1;
 >>get views;
@@ -1445,6 +1511,9 @@
 USER1_V1
 USER1_V2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>exit;
@@ -1462,6 +1531,9 @@
 USER1_V1
 USER1_V2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>drop view user1_v1;
 
@@ -1481,6 +1553,9 @@
 USER1_V1
 USER1_V2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>exit;
@@ -1499,6 +1574,9 @@
 
 DROP_VIEW
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>sh sqlci -i "TEST138(drop_view)" -u sql_user2;
 >>get views;
@@ -1509,6 +1587,9 @@
 USER1_V1
 USER1_V2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>drop view user1_v1;
 
@@ -1557,6 +1638,9 @@
 USER1_T1
 USER1_T2
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>drop table user1_t1 cascade;
 
@@ -1573,6 +1657,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -1630,6 +1717,9 @@
 
 CREATE_SEQUENCE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>sh sqlci -i "TEST138(create_sequence)" -u sql_user1;
 >>get sequences in schema t138sch;
@@ -1649,6 +1739,9 @@
 USER1_SEQ1
 USER1_SEQ2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>exit;
@@ -1666,6 +1759,9 @@
 USER1_SEQ1
 USER1_SEQ2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>drop sequence user1_seq1;
 
@@ -1685,6 +1781,9 @@
 USER1_SEQ1
 USER1_SEQ2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>exit;
@@ -1703,6 +1802,9 @@
 
 DROP_SEQUENCE
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>sh sqlci -i "TEST138(drop_sequence)" -u sql_user2;
 >>get sequences in schema t138sch;
@@ -1713,6 +1815,9 @@
 USER1_SEQ1
 USER1_SEQ2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>drop sequence user1_seq1;
 
diff --git a/core/sql/regress/privs2/EXPECTED140 b/core/sql/regress/privs2/EXPECTED140
index 81c3fbc..fa6eb18 100644
--- a/core/sql/regress/privs2/EXPECTED140
+++ b/core/sql/regress/privs2/EXPECTED140
@@ -209,6 +209,9 @@
 SB_PERSISTENT_SAMPLES
 TEAMS
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
diff --git a/core/sql/regress/privs2/EXPECTED143 b/core/sql/regress/privs2/EXPECTED143
index 35a3a1d..863d74f 100644
--- a/core/sql/regress/privs2/EXPECTED143
+++ b/core/sql/regress/privs2/EXPECTED143
@@ -442,6 +442,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get views;
 
@@ -453,6 +456,9 @@
 U3V3
 U3V4
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>
 >>exit;
@@ -800,6 +806,9 @@
 SB_HISTOGRAM_INTERVALS
 SB_PERSISTENT_SAMPLES
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>get views;
 
@@ -811,6 +820,9 @@
 U3V3
 U3V4
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>
 >>exit;
diff --git a/core/sql/regress/privs2/EXPECTED144 b/core/sql/regress/privs2/EXPECTED144
index d25b4a8..f9e0d8e 100644
--- a/core/sql/regress/privs2/EXPECTED144
+++ b/core/sql/regress/privs2/EXPECTED144
Binary files differ
diff --git a/core/sql/regress/privs2/EXPECTED146 b/core/sql/regress/privs2/EXPECTED146
index 7bf43b0..66c4fd3 100644
--- a/core/sql/regress/privs2/EXPECTED146
+++ b/core/sql/regress/privs2/EXPECTED146
@@ -146,6 +146,9 @@
 "_ROW_".T146T1
 "_ROW_".T146T3
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>
 >>create role t146_role1;
@@ -168,6 +171,9 @@
 
 CREATE_SCHEMA
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>get external hbase objects, match '%T146%';
 
@@ -518,6 +524,9 @@
 "_CELL_".T146T1
 "_ROW_".T146T1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>exit;
 
@@ -668,6 +677,9 @@
 "_CELL_".T146T1
 "_ROW_".T146T1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>exit;
 
@@ -823,6 +835,9 @@
 "_CELL_".T146T1
 "_ROW_".T146T1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>exit;
 
@@ -1094,6 +1109,9 @@
 "_ROW_".T146T1
 "_ROW_".T146T3
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>exit;
 
@@ -1260,6 +1278,9 @@
 "_CELL_".T146T1
 "_ROW_".T146T1
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>exit;
 
@@ -1524,6 +1545,9 @@
 
 "_CELL_".T146T1
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>exit;
 
@@ -1586,6 +1610,9 @@
 SIDU-R-    TRAFODION._HB_MAP_.T146T1
 SIDU-R-    TRAFODION._HB_MAP_.T146T2
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>
 >>drop hbase table t146t2;
@@ -1602,6 +1629,9 @@
 SIDU-R-    HBASE._ROW_.T146T3
 SIDU-R-    TRAFODION._HB_MAP_.T146T1
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
@@ -1722,6 +1752,9 @@
 SIDU-R-    TRAFODION._HB_MAP_.T146T1
 SIDU-R-    TRAFODION._HB_MAP_.T146T2
 
+=======================
+ 6 row(s) returned
+
 --- SQL operation complete.
 >>
 >>drop hbase table t146t2;
@@ -1738,6 +1771,9 @@
 SIDU-R-    HBASE._ROW_.T146T3
 SIDU-R-    TRAFODION._HB_MAP_.T146T1
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>
 >>exit;
diff --git a/core/sql/regress/seabase/EXPECTED002 b/core/sql/regress/seabase/EXPECTED002
index add3de8..2d79c5e 100644
--- a/core/sql/regress/seabase/EXPECTED002
+++ b/core/sql/regress/seabase/EXPECTED002
@@ -65,7 +65,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T2
   NumRegions:              4
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          8
+  TotalNumStores:          4
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -76,10 +76,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -87,10 +87,10 @@
   ReadRequestsCount:  0
   WriteRequestsCount: 0
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          2
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -98,10 +98,10 @@
   ReadRequestsCount:  1
   WriteRequestsCount: 1
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          3
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -109,10 +109,10 @@
   ReadRequestsCount:  0
   WriteRequestsCount: 0
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          4
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -134,7 +134,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T2
   NumRegions:              4
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          8
+  TotalNumStores:          4
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -145,10 +145,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -156,10 +156,10 @@
   ReadRequestsCount:  0
   WriteRequestsCount: 0
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          2
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -167,10 +167,10 @@
   ReadRequestsCount:  0
   WriteRequestsCount: 0
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          3
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -178,10 +178,10 @@
   ReadRequestsCount:  0
   WriteRequestsCount: 0
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          4
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -218,7 +218,7 @@
 >>invoke table(region stats ());
 
 -- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__
--- Definition current  Fri Mar 16 20:35:17 2018
+-- Definition current  Tue Jun  5 00:29:30 2018
 
   (
     CATALOG_NAME                     CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -245,7 +245,7 @@
 >>invoke table(region stats (t002t1));
 
 -- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__
--- Definition current  Fri Mar 16 20:35:18 2018
+-- Definition current  Tue Jun  5 00:29:31 2018
 
   (
     CATALOG_NAME                     CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -280,7 +280,7 @@
 (EXPR)                                                    REGION_NUM            REGION_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       NUM_STORES   NUM_STORE_FILES  STORE_FILE_UNCOMP_SIZE  STORE_FILE_SIZE       MEM_STORE_SIZE        (EXPR)                         (EXPR)
 --------------------------------------------------------  --------------------  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -----------  ---------------  ----------------------  --------------------  --------------------  -----------------------------  ------------------------------
 
-T002SCH.T002T1                                                               1  TRAFODION.T002SCH.T002T1/1521232436741                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1                0                       0                     0                     0  ReadRequestsCount: 2           WriteRequestsCount: 1         
+T002SCH.T002T1                                                               1  TRAFODION.T002SCH.T002T1/1528158469344                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1                0                       0                     0                     0  ReadRequestsCount: 2           WriteRequestsCount: 1         
 
 --- 1 row(s) selected.
 >>
@@ -294,7 +294,7 @@
 (EXPR)                                                    REGION_NUM            REGION_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       NUM_STORES   NUM_STORE_FILES  STORE_FILE_UNCOMP_SIZE  STORE_FILE_SIZE       MEM_STORE_SIZE        (EXPR)                         (EXPR)
 --------------------------------------------------------  --------------------  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -----------  ---------------  ----------------------  --------------------  --------------------  -----------------------------  ------------------------------
 
-T002SCH.T002T1                                                               1  TRAFODION.T002SCH.T002T1I1/1521232441739                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 1         
+T002SCH.T002T1                                                               1  TRAFODION.T002SCH.T002T1I1/1528158479307                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 1         
 
 --- 1 row(s) selected.
 >>
@@ -308,10 +308,10 @@
 (EXPR)                                                    REGION_NUM            REGION_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       NUM_STORES   NUM_STORE_FILES  STORE_FILE_UNCOMP_SIZE  STORE_FILE_SIZE       MEM_STORE_SIZE        (EXPR)                         (EXPR)
 --------------------------------------------------------  --------------------  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -----------  ---------------  ----------------------  --------------------  --------------------  -----------------------------  ------------------------------
 
-T002SCH.T002T2                                                               1  TRAFODION.T002SCH.T002T2/1521232475166                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 0         
-T002SCH.T002T2                                                               2  TRAFODION.T002SCH.T002T2/1521232475166                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1                0                       0                     0                     0  ReadRequestsCount: 1           WriteRequestsCount: 1         
-T002SCH.T002T2                                                               3  TRAFODION.T002SCH.T002T2/1521232475166                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 0         
-T002SCH.T002T2                                                               4  TRAFODION.T002SCH.T002T2/1521232475166                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 0         
+T002SCH.T002T2                                                               1  TRAFODION.T002SCH.T002T2/1528158523869                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 0         
+T002SCH.T002T2                                                               2  TRAFODION.T002SCH.T002T2/1528158523869                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1                0                       0                     0                     0  ReadRequestsCount: 1           WriteRequestsCount: 1         
+T002SCH.T002T2                                                               3  TRAFODION.T002SCH.T002T2/1528158523869                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 0         
+T002SCH.T002T2                                                               4  TRAFODION.T002SCH.T002T2/1528158523869                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 0         
 
 --- 4 row(s) selected.
 >>
@@ -325,7 +325,7 @@
 (EXPR)                                                    REGION_NUM            REGION_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       NUM_STORES   NUM_STORE_FILES  STORE_FILE_UNCOMP_SIZE  STORE_FILE_SIZE       MEM_STORE_SIZE        (EXPR)                         (EXPR)
 --------------------------------------------------------  --------------------  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -----------  ---------------  ----------------------  --------------------  --------------------  -----------------------------  ------------------------------
 
-T002SCH.T002T2                                                               1  TRAFODION.T002SCH.T002T2I1/1521232479869                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1                0                       0                     0                     0  ReadRequestsCount: 1           WriteRequestsCount: 1         
+T002SCH.T002T2                                                               1  TRAFODION.T002SCH.T002T2I1/1528158529016                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1                0                       0                     0                     0  ReadRequestsCount: 1           WriteRequestsCount: 1         
 
 --- 1 row(s) selected.
 >>
@@ -374,7 +374,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T1
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -385,10 +385,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T1/1521232436741
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T1/1528158469344
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -407,7 +407,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T1I1
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -418,10 +418,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T1I1/1521232441739
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T1I1/1528158479307
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -440,7 +440,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T2
   NumRegions:              4
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          8
+  TotalNumStores:          4
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -451,10 +451,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -462,10 +462,10 @@
   ReadRequestsCount:  0
   WriteRequestsCount: 0
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          2
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -473,10 +473,10 @@
   ReadRequestsCount:  1
   WriteRequestsCount: 1
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          3
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -484,10 +484,10 @@
   ReadRequestsCount:  0
   WriteRequestsCount: 0
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          4
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -506,7 +506,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T2I1
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -517,10 +517,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T2I1/1521232479869
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2I1/1528158529016
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -540,7 +540,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T1
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -551,10 +551,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T1/1521232436741
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T1/1528158469344
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -576,7 +576,7 @@
   ObjectName:              TRAFODION.T002SCH.SB_HISTOGRAMS
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -587,10 +587,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.SB_HISTOGRAMS/1521232429374
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.SB_HISTOGRAMS/1528158446488
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -605,7 +605,7 @@
   ObjectName:              TRAFODION.T002SCH.SB_HISTOGRAM_INTERVALS
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -616,10 +616,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.SB_HISTOGRAM_INTERVALS/1521232431811
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.SB_HISTOGRAM_INTERVALS/1528158454615
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -634,7 +634,7 @@
   ObjectName:              TRAFODION.T002SCH.SB_PERSISTENT_SAMPLES
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -645,10 +645,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.SB_PERSISTENT_SAMPLES/1521232434388
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.SB_PERSISTENT_SAMPLES/1528158460979
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -663,7 +663,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T1
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -674,10 +674,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T1/1521232436741
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T1/1528158469344
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -692,7 +692,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T2
   NumRegions:              4
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          8
+  TotalNumStores:          4
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -703,10 +703,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -714,10 +714,10 @@
   ReadRequestsCount:  0
   WriteRequestsCount: 0
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          2
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -725,10 +725,10 @@
   ReadRequestsCount:  1
   WriteRequestsCount: 1
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          3
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -736,10 +736,10 @@
   ReadRequestsCount:  0
   WriteRequestsCount: 0
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          4
-  RegionName:         TRAFODION.T002SCH.T002T2/1521232475166
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T2/1528158523869
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -762,8 +762,8 @@
 (EXPR)                                                    REGION_NUM            REGION_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       NUM_STORES   NUM_STORE_FILES  STORE_FILE_UNCOMP_SIZE  STORE_FILE_SIZE       MEM_STORE_SIZE        (EXPR)                         (EXPR)
 --------------------------------------------------------  --------------------  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -----------  ---------------  ----------------------  --------------------  --------------------  -----------------------------  ------------------------------
 
-T002SCH.T002T1                                                               1  TRAFODION.T002SCH.T002T1I1/1521232441739                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 1         
-T002SCH.T002T1                                                               1  TRAFODION.T002SCH.T002T1I2/1521232446363                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 1         
+T002SCH.T002T1                                                               1  TRAFODION.T002SCH.T002T1I1/1528158479307                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 1         
+T002SCH.T002T1                                                               1  TRAFODION.T002SCH.T002T1I2/1528158488210                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1                0                       0                     0                     0  ReadRequestsCount: 0           WriteRequestsCount: 1         
 
 --- 2 row(s) selected.
 >>get region stats for 
@@ -777,7 +777,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T1I1
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -788,10 +788,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T1I1/1521232441739
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T1I1/1528158479307
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -806,7 +806,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T1I2
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -817,10 +817,10 @@
 Stats Details
 =============
 
-  RegionServer:       ansharma-4:49525
+  RegionServer:       edev06:35100
   RegionNum:          1
-  RegionName:         TRAFODION.T002SCH.T002T1I2/1521232446363
-  NumStores:          2
+  RegionName:         TRAFODION.T002SCH.T002T1I2/1528158488210
+  NumStores:          1
   NumStoreFiles:      0
   UncompressedSize:   0 (less than 1MB)
   StoreFileSize:      0 (less than 1MB)
@@ -841,7 +841,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T1
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -859,7 +859,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T1I1
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -877,7 +877,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T2
   NumRegions:              4
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          8
+  TotalNumStores:          4
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -895,7 +895,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T2I1
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -916,7 +916,7 @@
   ObjectName:              TRAFODION.T002SCH.SB_HISTOGRAMS
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -930,7 +930,7 @@
   ObjectName:              TRAFODION.T002SCH.SB_HISTOGRAM_INTERVALS
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -944,7 +944,7 @@
   ObjectName:              TRAFODION.T002SCH.SB_PERSISTENT_SAMPLES
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -958,7 +958,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T1
   NumRegions:              1
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          2
+  TotalNumStores:          1
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -972,7 +972,7 @@
   ObjectName:              TRAFODION.T002SCH.T002T2
   NumRegions:              4
   RegionsLocation:         /hbase/data/default
-  TotalNumStores:          8
+  TotalNumStores:          4
   TotalNumStoreFiles:      0
   TotalUncompressedSize:   0
   TotalStoreFileSize:      0
@@ -991,7 +991,7 @@
 (EXPR)                          REGION_NUM            REGION_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       NUM_STORES   NUM_STORE_FILES
 ------------------------------  --------------------  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -----------  ---------------
 
-T002SCH.T002T1                                     1  TRAFODION.T002SCH.T002T1/1521232436741                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1                0
+T002SCH.T002T1                                     1  TRAFODION.T002SCH.T002T1/1528158469344                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1                0
 
 --- 1 row(s) selected.
 >>
@@ -1013,7 +1013,7 @@
 >>invoke table(cluster stats());
 
 -- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_CLUSTER_STATS__
--- Definition current  Fri Mar 16 20:35:23 2018
+-- Definition current  Tue Jun  5 00:29:37 2018
 
   (
     REGION_SERVER                    CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -1066,14 +1066,14 @@
 (EXPR)                          (EXPR)              
 ------------------------------  --------------------
 
-RegionName: 1521232434388                          0
-RegionName: 1521232441739                          0
-RegionName: 1521232436741                          0
-RegionName: 1521232429374                          0
-RegionName: 1521232475166                          0
-RegionName: 1521232479869                          0
-RegionName: 1521232446363                          0
-RegionName: 1521232431811                          0
+RegionName: 1528158446488                          0
+RegionName: 1528158523869                          0
+RegionName: 1528158488210                          0
+RegionName: 1528158479307                          0
+RegionName: 1528158469344                          0
+RegionName: 1528158460979                          0
+RegionName: 1528158454615                          0
+RegionName: 1528158529016                          0
 
 --- 8 row(s) selected.
 >>
@@ -1084,7 +1084,7 @@
 >>invoke table(hivemd(tables));
 
 -- Definition of Trafodion table TRAFODION.T002SCH.HIVEMD_TABLES__
--- Definition current  Fri Mar 16 20:35:24 2018
+-- Definition current  Tue Jun  5 00:29:38 2018
 
   (
     CATALOG_NAME                     CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -1116,7 +1116,7 @@
 >>invoke table(hivemd(columns));
 
 -- Definition of Trafodion table TRAFODION.T002SCH.HIVEMD_COLUMNS__
--- Definition current  Fri Mar 16 20:35:24 2018
+-- Definition current  Tue Jun  5 00:29:38 2018
 
   (
     CATALOG_NAME                     CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -1285,7 +1285,7 @@
            0  CHARACTER             CHAR(10 CHARS) CHARACTER SET UTF8                             char(10)                                        -1            -1           40
           64  VARCHAR               VARCHAR(7 CHARS) CHARACTER SET UTF8                           varchar(7)                                      -1            -1           28
          192  DATETIME              DATE                                                          date                                             1             0            4
-         192  DATETIME              TIMESTAMP(6)                                                  timestamp                                        3             6           11
+         192  DATETIME              TIMESTAMP(9)                                                  timestamp                                        3             6           11
 
 --- 9 row(s) selected.
 >>
@@ -1313,6 +1313,7 @@
 +>memstore_flush_size = '2000000',
 +>split_policy = 'org.apache.hadoop.hbase.regionserver.KeyPrefixRegionSplitPolicy',
 +>CACHE_DATA_IN_L1 = 'false',
++>HDFS_STORAGE_POLICY = 'hot' ,
 +>prefetch_blocks_on_open = 'false'
 +>);
 
@@ -1350,6 +1351,7 @@
     MEMSTORE_FLUSH_SIZE = '2000000',
     SPLIT_POLICY = 'org.apache.hadoop.hbase.regionserver.KeyPrefixRegionSplitPolicy',
     CACHE_DATA_IN_L1 = 'false',
+    HDFS_STORAGE_POLICY = 'hot',
     PREFETCH_BLOCKS_ON_OPEN = 'false'
   )
 ;
diff --git a/core/sql/regress/seabase/EXPECTED011 b/core/sql/regress/seabase/EXPECTED011
index 56c32a0..b4c1608 100644
--- a/core/sql/regress/seabase/EXPECTED011
+++ b/core/sql/regress/seabase/EXPECTED011
@@ -1295,6 +1295,9 @@
 METRIC_SESSION_TABLE
 METRIC_TEXT_TABLE
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>invoke trafodion."_REPOS_".metric_query_table;
 
diff --git a/core/sql/regress/seabase/EXPECTED012 b/core/sql/regress/seabase/EXPECTED012
index 3a59914..66c882b 100644
--- a/core/sql/regress/seabase/EXPECTED012
+++ b/core/sql/regress/seabase/EXPECTED012
@@ -289,6 +289,10 @@
 T012T11
 T012T12
 
+=======================
+Summary info of get:
+Get 5 rows.
+
 --- SQL operation complete.
 >>get indexes in schema trafodion.zschema;
 
@@ -300,6 +304,10 @@
 T012T11I1
 T012T11I2
 
+=======================
+Summary info of get:
+Get 4 rows.
+
 --- SQL operation complete.
 >>get views in schema trafodion.zschema;
 
@@ -308,6 +316,10 @@
 
 T012T11V1
 
+=======================
+Summary info of get:
+Get 1 rows.
+
 --- SQL operation complete.
 >>
 >>drop schema trafodion.zschema cascade;
@@ -316,12 +328,27 @@
 >>
 >>get tables in schema trafodion.zschema;
 
+
+=======================
+Summary info of get:
+Get 0 rows.
+
 --- SQL operation complete.
 >>get indexes in schema trafodion.zschema;
 
+
+=======================
+Summary info of get:
+Get 0 rows.
+
 --- SQL operation complete.
 >>get views in schema trafodion.zschema;
 
+
+=======================
+Summary info of get:
+Get 0 rows.
+
 --- SQL operation complete.
 >>
 >>obey TEST012(getStmts);
@@ -364,6 +391,10 @@
 TRAFODION.ZSCHEMA1.T
 TRAFODION.ZSCHEMA2.T
 
+=======================
+Summary info of get:
+Get 2 rows.
+
 --- SQL operation complete.
 >>get views on table zschema1.t;
 
@@ -373,6 +404,10 @@
 TRAFODION.ZSCHEMA1.V
 TRAFODION.ZSCHEMA2.V
 
+=======================
+Summary info of get:
+Get 2 rows.
+
 --- SQL operation complete.
 >>
 >>get tables in view zschema2.v2;
@@ -382,6 +417,10 @@
 
 TRAFODION.ZSCHEMA2.T
 
+=======================
+Summary info of get:
+Get 1 rows.
+
 --- SQL operation complete.
 >>get all tables in view zschema2.v2;
 
@@ -391,6 +430,10 @@
 TRAFODION.ZSCHEMA1.T
 TRAFODION.ZSCHEMA2.T
 
+=======================
+Summary info of get:
+Get 2 rows.
+
 --- SQL operation complete.
 >>get views in view zschema2.v2;
 
@@ -399,6 +442,10 @@
 
 TRAFODION.ZSCHEMA1.V
 
+=======================
+Summary info of get:
+Get 1 rows.
+
 --- SQL operation complete.
 >>get all objects in view zschema2.v2;
 
@@ -409,6 +456,11 @@
 TRAFODION.ZSCHEMA1.V
 TRAFODION.ZSCHEMA2.T
 
+
+=======================
+Summary info of get:
+Get 3 rows.
+
 --- SQL operation complete.
 >>
 >>drop schema zschema1 cascade;
diff --git a/core/sql/regress/seabase/EXPECTED022 b/core/sql/regress/seabase/EXPECTED022
index f7f10d4..ffd51e2 100644
--- a/core/sql/regress/seabase/EXPECTED022
+++ b/core/sql/regress/seabase/EXPECTED022
@@ -1265,6 +1265,9 @@
 "_CELL_".T022HBM2
 "_ROW_".T022HBM2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>unregister hbase table t022hbm2;
 
@@ -1280,6 +1283,9 @@
 "_CELL_".T022HBM2
 "_ROW_".T022HBM2
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>showddl hbase."_CELL_".t022hbm2;
 
@@ -1384,6 +1390,9 @@
 
 "_CELL_".T022HBM2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>showddl hbase."_CELL_".t022hbm2;
 
@@ -1449,6 +1458,9 @@
 
 "_CELL_".T022HBM2
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>showddl hbase."_CELL_".t022hbm2;
 
diff --git a/core/sql/regress/seabase/EXPECTED030 b/core/sql/regress/seabase/EXPECTED030
index b5385a7..19fa99e 100644
--- a/core/sql/regress/seabase/EXPECTED030
+++ b/core/sql/regress/seabase/EXPECTED030
@@ -411,6 +411,174 @@
 10:11:12
 
 --- 1 row(s) selected.
+>>select to_char(time '23:05:10','HH') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+23    
+
+--- 1 row(s) selected.
+>>select to_char(time '23:05:10','HH12') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+11    
+
+--- 1 row(s) selected.
+>>select to_char(time '23:05:10','HH24') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+23    
+
+--- 1 row(s) selected.
+>>select to_char(time '23:05:10','MI') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+05    
+
+--- 1 row(s) selected.
+>>select to_char(time '23:05:10','SS') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+10    
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2016-03-01 12:05:10','YYYY') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+2016  
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2016-03-01 12:05:10','YYY') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+016   
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2016-03-01 12:05:10','YY') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+16    
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2016-03-01 12:05:10','Y') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+6     
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2016-03-01 12:05:10','MON') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+MAR   
+
+--- 1 row(s) selected.
+>>select to_char(date '2006-12-01','MM') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+12    
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2016-03-01 12:05:10','DY') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+TUE   
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2016-03-01 12:05:10','DAY') from (values(1)) as t(a);
+
+(EXPR)   
+---------
+
+TUESDAY  
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2016-03-01 12:05:10','CC') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+21    
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2016-03-01 12:05:10','D') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+3     
+
+--- 1 row(s) selected.
+>>select to_char(date '2006-12-01','DD') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+01    
+
+--- 1 row(s) selected.
+>>select to_char(date '2006-12-01','DDD') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+335   
+
+--- 1 row(s) selected.
+>>select to_char(date '2006-12-31','W') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+5     
+
+--- 1 row(s) selected.
+>>select to_char(date '2006-12-31','WW') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+53    
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2001-01-07 00:00:00','J') from (values(1)) as t(a);
+
+(EXPR) 
+-------
+
+2451917
+
+--- 1 row(s) selected.
+>>select to_char(date '2006-12-01','Q') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+4     
+
+--- 1 row(s) selected.
 >>
 >>select dateformat(time '10:11:12.1', default) from (values(1)) x(a);
 
@@ -549,6 +717,70 @@
      2
 
 --- 1 row(s) selected.
+>>select extract(week from date '2005-01-01') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+     1
+
+--- 1 row(s) selected.
+>>select extract(epoch from timestamp '2000-12-30 20:38:40.12') from (values(1)) as t(a);
+
+(EXPR)
+---------------------
+
+         978208720.12
+
+--- 1 row(s) selected.
+>>select extract(dow from timestamp '2018-06-21 20:38:40') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+     5
+
+--- 1 row(s) selected.
+>>select extract(doy from timestamp '2018-06-21 20:38:40') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+   172
+
+--- 1 row(s) selected.
+>>select extract(wom from timestamp '2018-06-21 20:38:40') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+     3
+
+--- 1 row(s) selected.
+>>select extract(century from timestamp '2001-01-01 12:30:00') from (values(1)) as t(a);
+
+(EXPR)
+------
+
+    21
+
+--- 1 row(s) selected.
+>>select extract(decade from interval '9' year - interval '99' year) from (values(1)) as t(a);
+
+(EXPR)
+------
+
+    -9
+
+--- 1 row(s) selected.
+>>select extract(quarter from interval '09' month) from (values(1)) as t(a);
+
+(EXPR)
+------
+
+     3
+
+--- 1 row(s) selected.
 >>
 >>drop table if exists t030t1;
 
diff --git a/core/sql/regress/seabase/EXPECTED031 b/core/sql/regress/seabase/EXPECTED031
index f585e01..fdb9f48 100644
--- a/core/sql/regress/seabase/EXPECTED031
+++ b/core/sql/regress/seabase/EXPECTED031
@@ -1072,6 +1072,9 @@
 TRAFODION
 HIVE
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- external and hive table mismatch on hive 'string' datatype
diff --git a/core/sql/regress/seabase/TEST002 b/core/sql/regress/seabase/TEST002
index c7bc291..081793f 100644
--- a/core/sql/regress/seabase/TEST002
+++ b/core/sql/regress/seabase/TEST002
@@ -261,6 +261,7 @@
 memstore_flush_size = '2000000',
 split_policy = 'org.apache.hadoop.hbase.regionserver.KeyPrefixRegionSplitPolicy',
 CACHE_DATA_IN_L1 = 'false',
+HDFS_STORAGE_POLICY = 'hot' ,
 prefetch_blocks_on_open = 'false'
 );
 
diff --git a/core/sql/regress/seabase/TEST030 b/core/sql/regress/seabase/TEST030
index b214860..03e2145 100644
--- a/core/sql/regress/seabase/TEST030
+++ b/core/sql/regress/seabase/TEST030
@@ -79,6 +79,27 @@
 
 select to_char(TIMESTAMP '2016-03-01 10:11:12', 'YYYY-MM-DD') from (values(1)) x(a);
 select to_char(TIMESTAMP '2016-03-01 10:11:12', 'HH:MI:SS') from (values(1)) x(a);
+select to_char(time '23:05:10','HH') from (values(1)) as t(a);
+select to_char(time '23:05:10','HH12') from (values(1)) as t(a);
+select to_char(time '23:05:10','HH24') from (values(1)) as t(a);
+select to_char(time '23:05:10','MI') from (values(1)) as t(a);
+select to_char(time '23:05:10','SS') from (values(1)) as t(a);
+select to_char(timestamp '2016-03-01 12:05:10','YYYY') from (values(1)) as t(a);
+select to_char(timestamp '2016-03-01 12:05:10','YYY') from (values(1)) as t(a);
+select to_char(timestamp '2016-03-01 12:05:10','YY') from (values(1)) as t(a);
+select to_char(timestamp '2016-03-01 12:05:10','Y') from (values(1)) as t(a);
+select to_char(timestamp '2016-03-01 12:05:10','MON') from (values(1)) as t(a);
+select to_char(date '2006-12-01','MM') from (values(1)) as t(a);
+select to_char(timestamp '2016-03-01 12:05:10','DY') from (values(1)) as t(a);
+select to_char(timestamp '2016-03-01 12:05:10','DAY') from (values(1)) as t(a);
+select to_char(timestamp '2016-03-01 12:05:10','CC') from (values(1)) as t(a);
+select to_char(timestamp '2016-03-01 12:05:10','D') from (values(1)) as t(a);
+select to_char(date '2006-12-01','DD') from (values(1)) as t(a);
+select to_char(date '2006-12-01','DDD') from (values(1)) as t(a);
+select to_char(date '2006-12-31','W') from (values(1)) as t(a);
+select to_char(date '2006-12-31','WW') from (values(1)) as t(a);
+select to_char(timestamp '2001-01-07 00:00:00','J') from (values(1)) as t(a);
+select to_char(date '2006-12-01','Q') from (values(1)) as t(a);
 
 select dateformat(time '10:11:12.1', default) from (values(1)) x(a);
 select dateformat(time '10:11:12.123', usa) from (values(1)) x(a);
@@ -98,6 +119,14 @@
 select MINUTE(interval '5:13:25:2.12' day to second(2)) from (values(1)) as t(a);
 select extract (year from INTERVAL '97-02' YEAR TO MONTH) from (values (1)) as t(a);
 select interval '8' year / 4 from dual;
+select extract(week from date '2005-01-01') from (values(1)) as t(a);
+select extract(epoch from timestamp '2000-12-30 20:38:40.12') from (values(1)) as t(a);
+select extract(dow from timestamp '2018-06-21 20:38:40') from (values(1)) as t(a);
+select extract(doy from timestamp '2018-06-21 20:38:40') from (values(1)) as t(a);
+select extract(wom from timestamp '2018-06-21 20:38:40') from (values(1)) as t(a);
+select extract(century from timestamp '2001-01-01 12:30:00') from (values(1)) as t(a);
+select extract(decade from interval '9' year - interval '99' year) from (values(1)) as t(a);
+select extract(quarter from interval '09' month) from (values(1)) as t(a);
 
 drop table if exists t030t1;
 create table t030t1 (a date, b char(30), c varchar(30), d timestamp);
diff --git a/core/sql/regress/udr/EXPECTED001 b/core/sql/regress/udr/EXPECTED001
index 66c21f7..adcf75e 100644
--- a/core/sql/regress/udr/EXPECTED001
+++ b/core/sql/regress/udr/EXPECTED001
@@ -231,6 +231,9 @@
 SCH.SESSIONIZE_DYNAMIC
 SCH.SESSIONIZE_DYNAMIC_SHARED
 
+=======================
+ 3 row(s) returned
+
 --- SQL operation complete.
 >>
 >>showddl table_mapping function sessionize_dynamic;
@@ -258,6 +261,9 @@
 SCH.FIBONACCI_JAVA
 SCH.SESSIONIZE_JAVA
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>
 >>showddl table_mapping function sessionize_java;
diff --git a/core/sql/regress/udr/EXPECTED100.SB b/core/sql/regress/udr/EXPECTED100.SB
index f2c0ea8..f06bdec 100644
--- a/core/sql/regress/udr/EXPECTED100.SB
+++ b/core/sql/regress/udr/EXPECTED100.SB
@@ -153,6 +153,12 @@
 
 --- SQL operation complete.
 >>
+>>create procedure T100_io_mmm(IN IN1 timestamp(9), OUT OUT2 timestamp(9))
++>external name 't100.T100_io_mmm' language java parameter style java no sql
++>library T100;
+
+--- SQL operation complete.
+>>
 >>create procedure T100_iii_iii(IN IN1 int, IN IN2 int, IN IN3 int)
 +>external name 't100.T100_iii_iii' language java parameter style java
 +>library T100 no sql;
@@ -1087,6 +1093,14 @@
 1999-12-31 23:59:59
 
 --- SQL operation complete.
+>>call T100_io_mmm(cast(timestamp'12/31/1999 11:59:59.987654321 pm' as TIMESTAMP(9)), ?x);
+
+OUT2                         
+-----------------------------
+
+1999-12-31 23:59:59.987654321
+
+--- SQL operation complete.
 >>
 >>obey TEST100(all_datatypes2);
 >>--
@@ -1236,6 +1250,14 @@
 *** ERROR[8416] A datetime expression evaluated to an invalid datetime value.
 
 --- SQL operation failed with errors.
+>>call T100_io_mmm(interval'0.123456789'second(1,9) + timestamp'12/31/9999 11:59:59.123456789', ?x);
+
+OUT2                         
+-----------------------------
+
+9999-12-31 11:59:59.246913578
+
+--- SQL operation complete.
 >>
 >>obey TEST100(prepexec);
 >>--------------------------------------------------------------------------
@@ -1776,8 +1798,8 @@
 >>
 >>obey TEST100(udrtrace);
 >>log;
-Apache Trafodion Conversational Interface 2.1.0
-Copyright (c) 2015-2016 Apache Software Foundation
+Apache Trafodion Conversational Interface 2.3.0
+Copyright (c) 2015-2017 Apache Software Foundation
 >>?section udrtrace2
 >>--
 >>-- This section will be executed by the mxci fired off while executing
diff --git a/core/sql/regress/udr/EXPECTED102 b/core/sql/regress/udr/EXPECTED102
index 79263aa..b0c44ae 100644
--- a/core/sql/regress/udr/EXPECTED102
+++ b/core/sql/regress/udr/EXPECTED102
@@ -53,6 +53,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get procedures;
 
@@ -71,6 +74,9 @@
 RM
 RMREX
 
+=======================
+ 11 row(s) returned
+
 --- SQL operation complete.
 >>showddl procedure rm;
 
@@ -127,6 +133,9 @@
 DB__ROOTROLE
 PUBLIC
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>showddl procedure rm;
 
@@ -178,6 +187,9 @@
 
 PUBLIC
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- ****************************************************************************
@@ -210,6 +222,9 @@
 DB__ROOTROLE
 PUBLIC
 
+=======================
+ 5 row(s) returned
+
 --- SQL operation complete.
 >>
 >>-- enable library management
@@ -236,6 +251,9 @@
 DB__LIBMGRNAME
 DB__LIBMGR_LIB_CPP
 
+=======================
+ 2 row(s) returned
+
 --- SQL operation complete.
 >>get procedures;
 
@@ -254,6 +272,9 @@
 RM
 RMREX
 
+=======================
+ 11 row(s) returned
+
 --- SQL operation complete.
 >>showddl procedure rm;
 
@@ -319,6 +340,9 @@
 RM
 RMREX
 
+=======================
+ 9 row(s) returned
+
 --- SQL operation complete.
 >>call ls(?);
 
@@ -347,6 +371,9 @@
 RM
 RMREX
 
+=======================
+ 11 row(s) returned
+
 --- SQL operation complete.
 >>showddl procedure put;
 
@@ -419,6 +446,9 @@
 RM
 RMREX
 
+=======================
+ 11 row(s) returned
+
 --- SQL operation complete.
 >>
 >>
diff --git a/core/sql/regress/udr/EXPECTED103 b/core/sql/regress/udr/EXPECTED103
index aab044c..0d471f6 100644
--- a/core/sql/regress/udr/EXPECTED103
+++ b/core/sql/regress/udr/EXPECTED103
@@ -553,6 +553,9 @@
 GENERATERANDOMNUMBER
 NONDETERMINISTICRANDOM
 
+=======================
+ 4 row(s) returned
+
 --- SQL operation complete.
 >>get procedures in schema udr103sch;
 
@@ -561,6 +564,9 @@
 
 UPDATESUBSCRIPTIONS
 
+=======================
+ 1 row(s) returned
+
 --- SQL operation complete.
 >>showddl function generatePhoneNumber;
 
diff --git a/core/sql/regress/udr/EXPECTED107.SB b/core/sql/regress/udr/EXPECTED107.SB
index 03f5851..9956203 100644
--- a/core/sql/regress/udr/EXPECTED107.SB
+++ b/core/sql/regress/udr/EXPECTED107.SB
@@ -482,6 +482,9 @@
 SCH.VALIDATE_CURRENT_USER_NAME
 SCH.VALIDATE_SESSION_USER_NAME
 
+=======================
+ 37 row(s) returned
+
 --- SQL operation complete.
 >>
 >>showddl function errorwarn ;
diff --git a/core/sql/regress/udr/TEST100 b/core/sql/regress/udr/TEST100
index 9f736f9..8547877 100755
--- a/core/sql/regress/udr/TEST100
+++ b/core/sql/regress/udr/TEST100
@@ -120,6 +120,7 @@
 drop procedure T100_io_dd;
 drop procedure T100_io_tt;
 drop procedure T100_io_mm;
+drop procedure T100_io_mmm;
 drop procedure T100_iii_iii;
 drop procedure T100_xxx_iii;
 drop procedure T100_ooo_iii;
@@ -239,6 +240,10 @@
 external name 't100.T100_io_mm' language java parameter style java no sql
 library T100;
 
+create procedure T100_io_mmm(IN IN1 timestamp(9), OUT OUT2 timestamp(9))
+external name 't100.T100_io_mmm' language java parameter style java no sql
+library T100;
+
 create procedure T100_iii_iii(IN IN1 int, IN IN2 int, IN IN3 int)
 external name 't100.T100_iii_iii' language java parameter style java
 library T100 no sql;
@@ -415,7 +420,11 @@
     INOUT INOUT7000 decimal(9,0), INOUT INOUT8000 largeint,
     IN IN9000 double precision, IN IN10000 smallint,
     OUT OUT9000 double precision, OUT OUT10000 smallint,
-    INOUT INOUT9000 double precision, INOUT INOUT10000 smallint
+    INOUT INOUT9000 double precision, INOUT INOUT10000 smallint,
+
+    IN IN4000 timestamp(9),
+    OUT OUT4000 timestamp(9),
+    INOUT INOUT4000 timestamp(9),
 )
 external name 't100.T100_many' language java parameter style java no sql
 library T100;
@@ -598,6 +607,7 @@
 call T100_io_mm(cast(timestamp'12/31/1999 11:59:59 pm' as TIMESTAMP(0)), ?x);
 call T100_io_mm(cast(timestamp'12/31/1999 11:59:59 pm' as TIMESTAMP(2)), ?x);
 call T100_io_mm(cast(timestamp'12/31/1999 11:59:59 pm' as TIMESTAMP(6)), ?x);
+call T100_io_mmm(cast(timestamp'12/31/1999 11:59:59.987654321 pm' as TIMESTAMP(9)), ?x);
 
 ?section all_datatypes2
 --
@@ -658,6 +668,7 @@
 call T100_io_ss(cast(-32769 as smallint), ?x);
 call T100_io_ii(1 + 1 / 0, ?x);
 call T100_io_mm(interval'0.1'second + timestamp'12/31/9999 11:59:59.9 pm', ?x);
+call T100_io_mmm(interval'0.123456789'second(1,9) + timestamp'12/31/9999 11:59:59.123456789', ?x);
 
 ?section prepexec
 --------------------------------------------------------------------------
diff --git a/core/sql/regress/udr/t100.java b/core/sql/regress/udr/t100.java
index 9e5670c..c95bc5a 100755
--- a/core/sql/regress/udr/t100.java
+++ b/core/sql/regress/udr/t100.java
@@ -95,6 +95,10 @@
     {
         OUT2[0] = IN1;
     }
+    public static void T100_io_mmm(Timestamp IN1, Timestamp[] OUT2)
+    {
+        OUT2[0] = IN1;
+    }
 
     //
     // IN, INOUT
diff --git a/core/sql/runtimestats/SqlStats.cpp b/core/sql/runtimestats/SqlStats.cpp
index aec2999..3fcf9d3 100644
--- a/core/sql/runtimestats/SqlStats.cpp
+++ b/core/sql/runtimestats/SqlStats.cpp
@@ -74,6 +74,7 @@
       , pidToCheck_(0)
       , ssmpDumpedTimestamp_(0)
       , lobLocks_(NULL)
+      , pidViolationCount_(0)
 {
   statsHeap_.setSharedMemory();
   //Phandle wrapper in porting layer
@@ -97,6 +98,30 @@
   releasingSemPid_ = -1;
   seabedError_ = 0;
   seabedPidRecycle_ = false;
+  // Get /proc/sys/kernel/pid_max 
+  // If it is greater than a reasonable value, then
+  // let PID_MAX environment variable to override it
+  // Make sure Pid Max is set to a PID_MAX_DEFAULT_MIN value at least
+  char *pidMaxStr;
+  configuredPidMax_ = ComRtGetConfiguredPidMax();
+  if (configuredPidMax_ == 0)
+     configuredPidMax_ = PID_MAX_DEFAULT;
+  if (configuredPidMax_ > PID_MAX_DEFAULT_MAX) {
+     if ((pidMaxStr = getenv("PID_MAX")) != NULL)
+        configuredPidMax_ = atoi(pidMaxStr);
+     else
+        configuredPidMax_ = PID_MAX_DEFAULT_MAX;
+  }
+  if (configuredPidMax_ == 0)
+     configuredPidMax_ = PID_MAX_DEFAULT;
+  else if (configuredPidMax_ < PID_MAX_DEFAULT_MIN)
+     configuredPidMax_ = PID_MAX_DEFAULT_MIN; 
+  statsArray_ = new (&statsHeap_) GlobalStatsArray[configuredPidMax_];
+  for (pid_t i = 0; i < configuredPidMax_ ; i++) {
+      statsArray_[i].processId_ = 0;
+      statsArray_[i].processStats_ = NULL;
+      statsArray_[i].phandleSeqNum_ = -1;
+  }
 }
 
 void StatsGlobals::init()
@@ -118,6 +143,7 @@
   rmsStats_->setRmsVersion(version_);
   rmsStats_->setRmsEnvType(rtsEnvType_);
   rmsStats_->setStoreSqlSrcLen(storeSqlSrcLen_);
+  rmsStats_->setConfiguredPidMax(configuredPidMax_);
   int rc;
   nodeId_ = cpu_;
   MS_Mon_Node_Info_Type nodeInfo;
@@ -170,35 +196,25 @@
 
 void StatsGlobals::addProcess(pid_t pid, NAHeap *heap)
 {
-  if (statsArray_ == NULL)
-  {
-    statsArray_ = new (&statsHeap_) GlobalStatsArray[MAX_PID_ARRAY_SIZE];
-    for (pid_t i = 0; i < MAX_PID_ARRAY_SIZE ; i++)
-    {
-      statsArray_[i].processId_ = 0;
-      statsArray_[i].processStats_ = NULL;
-      statsArray_[i].creationTime_ = 0;
-      statsArray_[i].phandleSeqNum_ = -1;
-    }
-  }
+  if (pid >= configuredPidMax_)
+     return;
+  char msg[256];;
   if (statsArray_[pid].processStats_ != NULL)
   {
-
-    char msg[256];;
-    str_sprintf(msg,
+    snprintf(msg, sizeof(msg),
         "Pid %d,%d got recycled soon or SSMP didn't receive the death message ",
            cpu_, pid);
     SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, msg, 0);
     removeProcess(pid, TRUE);
   }   
   statsArray_[pid].processId_ = pid;
-  statsArray_[pid].creationTime_ = GetCliGlobals()->myStartTime();
   statsArray_[pid].phandleSeqNum_ = GetCliGlobals()->myVerifier();
   statsArray_[pid].processStats_ = new (heap) ProcessStats(heap, nodeId_, pid);
   incProcessRegd();
   incProcessStatsHeaps();
   if (pid > maxPid_)
      maxPid_ = pid;
+  return;
 }
 
 void StatsGlobals::removeProcess(pid_t pid, NABoolean calledAtAdd)
@@ -206,13 +222,10 @@
   short retcode;
   NABoolean queryRemain = FALSE;
   NAHeap *prevHeap = NULL;
-  if (statsArray_ == NULL)
+  if (pid >= configuredPidMax_)
      return;
   if (statsArray_[pid].processStats_ != NULL)
   {
-    if (!calledAtAdd)
-    {
-    }
     stmtStatsList_->position();
     StmtStats *ss;
     prevHeap = statsArray_[pid].processStats_->getHeap();
@@ -240,7 +253,6 @@
     }
   }
   statsArray_[pid].processId_ = 0;
-  statsArray_[pid].creationTime_ = 0;
   statsArray_[pid].phandleSeqNum_ = -1;
   statsArray_[pid].processStats_ = NULL;
   if (pid == maxPid_)
@@ -261,9 +273,9 @@
 {
   int error = 0;
 
-  if (statsArray_ == NULL)
-    return;
-
+  if (myPid >= configuredPidMax_)
+     return;
+  
   if (!DeadPollingInitialized)
   {
     DeadPollingInitialized = true;  // make getenv calls once per process
@@ -409,8 +421,7 @@
 
 ProcessStats *StatsGlobals::checkProcess(pid_t pid)
 {
-
-  if (statsArray_ == NULL)
+  if (pid >= configuredPidMax_)
     return NULL;
   if (statsArray_[pid].processId_ == pid)
     return statsArray_[pid].processStats_;
@@ -426,6 +437,8 @@
   StmtStats *ss;
   char *sqlSrc = NULL;
   Lng32 storeSqlSrcLen = 0;
+  if (pid >= configuredPidMax_)
+     return NULL;
   if (storeSqlSrcLen_ > 0)
   {
     sqlSrc = sourceStr;
@@ -447,6 +460,7 @@
 {
   int error = 0;
   timespec ts;
+  ex_assert(pid < configuredPidMax_, "Semaphore can't be obtained for pids greater than configured pid max")
   error = sem_trywait((sem_t *)semId);
   NABoolean retrySemWait = FALSE;
   NABoolean resetClock = TRUE;
@@ -1248,7 +1262,6 @@
       :heap_(heap),
       pid_(pid),
       stats_(NULL),
-      EspProcHandle_(NULL),
       refCount_(0),
       fragId_(fragId)
 {
@@ -1604,6 +1617,20 @@
    memMonitor_->enableLogger();
 }
 
+NABoolean StatsGlobals::getInitError(pid_t pid, NABoolean &reportError)
+{
+   NABoolean retcode = FALSE;
+   reportError = FALSE; 
+   if ((getVersion() != StatsGlobals::CURRENT_SHARED_OBJECTS_VERSION_) ||
+        (pid >= configuredPidMax_))
+   {
+      retcode = TRUE;
+      if (pidViolationCount_++ < PID_VIOLATION_MAX_COUNT) 
+         reportError = TRUE;
+   } 
+   return retcode; 
+}
+
 short getMasterCpu(char *uniqueStmtId, Lng32 uniqueStmtIdLen, char *nodeName, short maxLen, short &cpu)
 {
   Int32 nodeNumber = 0;
diff --git a/core/sql/runtimestats/SqlStats.h b/core/sql/runtimestats/SqlStats.h
index 5e23b0c..1cfc18f 100644
--- a/core/sql/runtimestats/SqlStats.h
+++ b/core/sql/runtimestats/SqlStats.h
@@ -1,5 +1,5 @@
 /**********************************************************************
-// @@@ START COPYRIGHT @@@
+/ @@@ START COPYRIGHT @@@
 //
 // Licensed to the Apache Software Foundation (ASF) under one
 // or more contributor license agreements.  See the NOTICE file
@@ -69,13 +69,15 @@
 #include "SQLCLIdev.h"
 #include "memorymonitor.h"
 
-#define MAX_PID_ARRAY_SIZE 65536
+#define PID_MAX_DEFAULT     65536
+#define PID_MAX_DEFAULT_MAX 131072
+#define PID_MAX_DEFAULT_MIN 32768
+#define PID_VIOLATION_MAX_COUNT 100
 
 typedef struct GlobalStatsArray
 {
   pid_t  processId_;
   SB_Verif_Type  phandleSeqNum_;
-  Int64  creationTime_;
   ProcessStats  *processStats_;
 } GlobalStatsArray;
 
@@ -200,6 +202,7 @@
   RtsExplainFrag *getExplainInfo() { return explainInfo_; }
   void deleteExplainFrag();
   ULng32 getFlags() const { return flags_; }
+  NABoolean reportError(pid_t pid);
 private:
   enum Flags
   {
@@ -219,7 +222,6 @@
   char *queryId_;
   Lng32 queryIdLen_;
   ExMasterStats *masterStats_;
-  HashQueue *EspProcHandle_;
   ExStatisticsArea *stats_;
   Int64 lastMergedTime_;
   ExStatisticsArea *mergedStats_;
@@ -435,6 +437,7 @@
   inline pid_t getSemPid() { return semPid_; }
   inline pid_t getSsmpPid();
   inline Int64 getSsmpTimestamp();
+  inline pid_t getConfiguredPidMax() { return configuredPidMax_; }
   inline void setSsmpDumpTimestamp(Int64 dumpTime) 
           { ssmpDumpedTimestamp_ = dumpTime; }
   inline Int64 getSsmpDumpTimestamp() 
@@ -495,6 +498,7 @@
   Long &getSsmpProcSemId() { return ssmpProcSemId_; } 
   void setSscpProcSemId(Long semId) { sscpProcSemId_ = semId; } 
   void setSeabedError(Int32 error) { seabedError_ = error; }
+  NABoolean getInitError(pid_t pid, NABoolean &reportError );
 private:
   void *statsSharedSegAddr_;
   Lng32 version_;             // A field used to prevent downrev compiler or other 
@@ -534,6 +538,8 @@
   Int64 ssmpDumpedTimestamp_;
   MemoryMonitor *memMonitor_;
   SyncHashQueue *lobLocks_;
+  pid_t configuredPidMax_;
+  Int64 pidViolationCount_;
 };
 StatsGlobals * shareStatsSegment(Int32 &shmid, NABoolean checkForSSMP = TRUE);
 short getMasterCpu(char *uniqueStmtId, Lng32 uniqueStmtIdLen, char *nodeName, short maxLen, short &cpu);
diff --git a/core/sql/sqlci/SqlCmd.cpp b/core/sql/sqlci/SqlCmd.cpp
index 8370aa8..d2b5176 100644
--- a/core/sql/sqlci/SqlCmd.cpp
+++ b/core/sql/sqlci/SqlCmd.cpp
@@ -1671,6 +1671,7 @@
                   
                   rec_datetime_field dtStartField = REC_DATE_YEAR;
                   rec_datetime_field dtEndField = REC_DATE_SECOND;
+                  Lng32 intLeadPrec = SQLInterval::DEFAULT_LEADING_PRECISION;
                   if (datatype == REC_DATETIME)
                     {
                       Lng32 dtCode;
@@ -1701,12 +1702,28 @@
                           dtEndField = REC_DATE_SECOND;
                         }
                      }
+                  else if (DFS2REC::isInterval(datatype))
+                    {
+                      getIntervalFields(datatype, dtStartField, dtEndField);
+
+                      // this will get fractional precision
+                      retcode = SQL_EXEC_GetDescItem(input_desc, entry,
+                                                     SQLDESC_PRECISION,
+                                                     &precision, 0, 0, 0, 0);
+                      HandleCLIError(retcode, sqlci_env);
+
+                      // this will get interval leading precision
+                      retcode = SQL_EXEC_GetDescItem(input_desc, entry,
+                                                     SQLDESC_INT_LEAD_PREC,
+                                                     &intLeadPrec, 0, 0, 0, 0);
+                      HandleCLIError(retcode, sqlci_env);
+                    }
 
 		  NAType::convertTypeToText(tgttype,
 					    datatype, length, precision, scale,
 					    dtStartField, dtEndField,
 					    (short)precision,
-					    SQLInterval::DEFAULT_LEADING_PRECISION,
+                                            (short)intLeadPrec,
 					    FALSE/*upshift*/,
 					    FALSE/*caseinsensitive*/,
 					    (CharInfo::CharSet) charSet,
diff --git a/core/sql/sqlci/sqlci_lex.ll b/core/sql/sqlci/sqlci_lex.ll
index ac4376d..c795608 100755
--- a/core/sql/sqlci/sqlci_lex.ll
+++ b/core/sql/sqlci/sqlci_lex.ll
@@ -206,6 +206,7 @@
 [Mm][Ee][Tt][Aa][Dd][Aa][Tt][Aa]                   return_IDENT_or_TOKEN(METADATAtoken, 0);
 [Mm][Aa][Pp]                           return_IDENT_or_TOKEN(MAPtoken, 0);
 [Mm][Oo][Dd][Ii][Ff][Yy]               return_IDENT_or_TOKEN(MODIFY, 0);
+[Mm][Ss][Cc][Kk] 		       return_IDENT_or_TOKEN(MSCKtoken, 0);
 [Oo][Bb][Ee][Yy]  		       { 
                      BEGIN FNAME; 
                                          return_IDENT_or_TOKEN (OBEY, 0); 
diff --git a/core/sql/sqlci/sqlci_yacc.y b/core/sql/sqlci/sqlci_yacc.y
index dc97892..b3ab7d2 100644
--- a/core/sql/sqlci/sqlci_yacc.y
+++ b/core/sql/sqlci/sqlci_yacc.y
@@ -429,6 +429,7 @@
 %token MODE
 %token MODIFY
 %token MODIFYV
+%token MSCKtoken
 %token NEXT
 %token NOEtoken
 %token OBEY
@@ -1934,6 +1935,7 @@
 	|	TRANSFORM		{$$ = DML_DDL_TYPE;}
 	|	CALLToken		{$$ = DML_DDL_TYPE;}
 	|	LOADtoken		{$$ = DML_DDL_TYPE;}
+	|	MSCKtoken		{$$ = DML_DDL_TYPE;}
 	|	EXTRACTtoken		{$$ = DML_DESCRIBE_TYPE;}
 	|	REPLICATEtoken		{$$ = DML_DESCRIBE_TYPE;}
 	|	GENERATEtoken		{$$ = DML_DESCRIBE_TYPE;}
diff --git a/core/sql/sqlcomp/CmpDDLCatErrorCodes.h b/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
index 3c22d90..e372a3e 100644
--- a/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
+++ b/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
@@ -374,6 +374,10 @@
                   , CAT_OBJECT_DOES_NOT_EXIST_IN_TRAFODION        = 1389
                   , CAT_TRAFODION_OBJECT_EXISTS                   = 1390
 
+                  , TRAF_ALREADY_INITIALIZED                      = 1392
+                  , TRAF_NOT_INITIALIZED                          = 1393
+                  , TRAF_HBASE_ACCESS_ERROR                       = 1398
+
                   // unused                                       = 1400
                   , CAT_UNABLE_TO_CONVERT_COLUMN_DEFAULT_VALUE_TO_CHARSET = 1401
                   , CAT_UNIQUE_INDEX_COLS_NOT_IN_DIV_EXPRS        = 1402
diff --git a/core/sql/sqlcomp/CmpDescribe.cpp b/core/sql/sqlcomp/CmpDescribe.cpp
index 26e0deb..61faa54 100644
--- a/core/sql/sqlcomp/CmpDescribe.cpp
+++ b/core/sql/sqlcomp/CmpDescribe.cpp
@@ -2516,98 +2516,6 @@
   return 0;
 }
 
-// this method is used to convert a trafodion table definition to corresponding
-// Hive 'create' DDL. 
-// Used when a Hive table is being create 'like' a traf table.
-short CmpDescribeTrafAsHiveTable ( 
-     const CorrName  &dtName,
-     short type, 
-     char* &outbuf,
-     ULng32 &outbuflen,
-     CollHeap *heap,
-     UInt32 columnLengthLimit)
-{
-  BindWA bindWA(ActiveSchemaDB(), CmpCommon::context(), FALSE/*inDDL*/);
-  NATable *naTable = bindWA.getNATable((CorrName&)dtName); 
-  if (naTable == NULL || bindWA.errStatus())
-    return -1;
-
-  if (NOT naTable->isSeabaseTable())
-    return -1;
-
-  char * buf = new (heap) char[15000];
-  CMPASSERT(buf);
-
-  time_t tp;
-  time(&tp);
-  
-  Space space;
-
-  if (!CmpDescribeIsAuthorized(SQLOperation::UNKNOWN,
-                               naTable->getPrivInfo(),
-                               COM_BASE_TABLE_OBJECT))
-    return -1;
-
-  // emit an initial newline
-  outputShortLine(space, " ");
-
-  outputShortLine(space, "  ( ");
-
-  Int32 ii = 0;
-  for (Int32 i = 0; i < (Int32)naTable->getColumnCount(); i++)
-    {
-      NAColumn * nac = naTable->getNAColumnArray()[i];
-
-      if (nac->isSystemColumn())
-        continue;
-
-      NAString colName = nac->getColName();
-      colName.toLower();
-
-      const NAType * nat = nac->getType();
-
-      sprintf(buf, "%s ", colName.data());
-      
-      NAString nas;
-      nat->getMyTypeAsHiveText(&nas);
-      
-      // if it is a character type and it is longer than the length
-      // limit in bytes, then shorten the target type
-      if ((nat->getTypeQualifier() == NA_CHARACTER_TYPE) &&
-          (!nat->isLob()) &&
-          (columnLengthLimit < UINT_MAX))
-        {
-          const CharType * natc = (const CharType *)nat;
-          if (natc->getDataStorageSize() > columnLengthLimit)
-            {
-              CharType * newType = (CharType *)natc->newCopy(NULL);
-              newType->setDataStorageSize(columnLengthLimit);
-              nas.clear();
-              newType->getMyTypeAsText(&nas, FALSE);
-              delete newType;
-            }
-        }
-
-      sprintf(&buf[strlen(buf)], "%s", nas.data());
-
-      NAString colString(buf);
-      Int32 j = ii;
-      outputColumnLine(space, colString, j);
-
-      ii++;
-    }
-
-  outputShortLine(space, "  )");
-
-  outbuflen = space.getAllocatedSpaceSize();
-  outbuf = new (heap) char[outbuflen];
-  space.makeContiguous(outbuf, outbuflen);
-  
-  NADELETEBASIC(buf, heap);
-
-  return 0;
-}
-
 // type:  1, invoke. 2, showddl. 3, create_like
 short cmpDisplayColumn(const NAColumn *nac,
                        char * inColName,
diff --git a/core/sql/sqlcomp/CmpDescribe.h b/core/sql/sqlcomp/CmpDescribe.h
index 532001f..0903759 100644
--- a/core/sql/sqlcomp/CmpDescribe.h
+++ b/core/sql/sqlcomp/CmpDescribe.h
@@ -91,14 +91,6 @@
                              NABoolean isDetail = FALSE,
                              UInt32 columnLengthLimit = UINT_MAX);
 
-short CmpDescribeTrafAsHiveTable ( 
-     const CorrName  &dtName,
-     short type, // 1, invoke. 2, showddl. 3, createLike
-     char* &outbuf,
-     ULng32 &outbuflen,
-     CollHeap *heap,
-     UInt32 columnLengthLimit = UINT_MAX);
-
 // type:  1, invoke. 2, showddl. 3, create_like
 extern short cmpDisplayColumn(const NAColumn *nac,
                               char * inColName,
diff --git a/core/sql/sqlcomp/CmpSeabaseDDL.h b/core/sql/sqlcomp/CmpSeabaseDDL.h
index 346b6dc..6215f7d 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDL.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDL.h
@@ -1009,6 +1009,7 @@
      Int32 ownerID,
      NABoolean ignoreIfExists);
      
+  short createDefaultSystemSchema(ExeCliInterface * cliInterface);
   short createSchemaObjects(ExeCliInterface * cliInterface);
   
   void  createSeabaseSchema(
@@ -1086,11 +1087,6 @@
                                    const ComObjectName &tgtTableName,
                                    const ComObjectName &srcTableName);
 
-  static short genDDLforHiveTableLikeTrafTable(
-       StmtDDLCreateTable * createTableNode,
-       NAString &currCatName, NAString &currSchName,
-       NAString &tableDDL); // output. Contains hive DDL string.
-  
 public:
   static NABoolean setupQueryTreeForHiveDDL(
        Parser::HiveDDLInfo * hiveDDLInfo,
@@ -1449,13 +1445,14 @@
   void processDDLonHiveObjects(StmtDDLonHiveObjects * hddl,
                                NAString &currCatName, NAString &currSchName);
 
-  void initSeabaseMD(NABoolean ddlXns, NABoolean minimal);
   void dropSeabaseMD(NABoolean ddlXns);
   void createSeabaseMDviews();
   void dropSeabaseMDviews();
   void createSeabaseSchemaObjects();
   void updateVersion();
 
+  short initTrafMD(CmpDDLwithStatusInfo *mdti);
+  
   short createPrivMgrRepos(ExeCliInterface *cliInterface, NABoolean ddlXns);
   short initSeabaseAuthorization(ExeCliInterface *cliInterface,
                                  NABoolean ddlXns,
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcleanup.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcleanup.cpp
index f08b642..291cfbe 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcleanup.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcleanup.cpp
@@ -1732,7 +1732,7 @@
               {
               case 0:
                 {
-                  dws->setMsg("  Start: Cleanup Orphan Objects Entries");              
+                  dws->setMsg("  Start: Cleanup Orphan Objects Entries");
                   dws->subStep()++;
                   dws->setEndStep(FALSE);
                   
@@ -2009,7 +2009,8 @@
         checkOnly_ = TRUE;
       if (dws->getReturnDetails())
         returnDetails_ = TRUE;
-      return cleanupMetadataEntries(&cliInterface, ehi, dws);
+      cleanupMetadataEntries(&cliInterface, ehi, dws);
+      return;
     }
 
   if (cleanupMetadataEntries_)
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp
index 411560d..9bbaeb6 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp
@@ -354,21 +354,16 @@
 
   if (comment.length() > 0)
     {
-		
-	  //'removeConsecutiveQuotes' was done at the beginning of lexical analysis.
-	  // so we should recovery it("'" ==> "''") in there to make insert successfully.
-      NAString quotedComment; 
-      ToQuotedString(quotedComment, comment, FALSE);
-
       //add or modify comment
       char query[2048];
+	  
       str_sprintf(query, "insert into %s.\"%s\".%s values (%ld, %d, %d, %d, 0, '%s') ; ",
               getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_TEXT,
               objUID, 
               textType, 
               subID, 
               0,
-              quotedComment.data());
+              comment.data());
       cliRC = cliInterface.executeImmediate(query);
       
       if (cliRC < 0)
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
index 9e6e464..ae401f8 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
@@ -1251,7 +1251,7 @@
   ExpHbaseInterface * ehi = allocEHI(server, zkPort, FALSE);
   if (! ehi)
     {
-      retcode = -1398;
+      retcode = -TRAF_HBASE_ACCESS_ERROR;
       goto label_return;
     }
 
@@ -1417,7 +1417,7 @@
               CmpCommon::diags()->clear();
             }
 
-          retcode = -1398;
+          retcode = -TRAF_HBASE_ACCESS_ERROR;
           goto label_return;
         }
     }
@@ -1431,7 +1431,7 @@
       if (hbaseErrStr)
         *hbaseErrStr = (char*)GetCliGlobals()->getJniErrorStr();
 
-      retcode = -1398;
+      retcode = -TRAF_HBASE_ACCESS_ERROR;
       goto label_return;
     }
 
@@ -1456,7 +1456,7 @@
           goto label_return;
         }
       
-      retcode = -1393;
+      retcode = -TRAF_NOT_INITIALIZED;
       goto label_return;
     }
 
@@ -1506,7 +1506,7 @@
       if (hbaseErrStr)
         *hbaseErrStr = (char*)GetCliGlobals()->getJniErrorStr();
 
-      retcode = -1398;
+      retcode = -TRAF_HBASE_ACCESS_ERROR;
       goto label_return;
     }
   else
@@ -1895,7 +1895,7 @@
       // generated?
       CmpCommon::diags()->clear();
       deallocEHI(ehi);
-      return -1398;
+      return -TRAF_HBASE_ACCESS_ERROR;
     }
 
   // Call existsInHbase to check for privmgr metadata tables existence
@@ -2492,6 +2492,11 @@
           else
 	      isError = TRUE;
         }
+      else if (hbaseOption->key() == "HDFS_STORAGE_POLICY")
+        {
+          hbaseCreateOptionsArray[HBASE_HDFS_STORAGE_POLICY] =
+            hbaseOption->val();
+        }
       else
         isError = TRUE;
 
@@ -7220,296 +7225,13 @@
   return 0;
 }
 
-void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns, NABoolean minimal)
-{
-  int breadCrumb = -1;  // useful for debugging
+/*
+// This method has been rewritten and moved to CmpSeabaseDDLinitraf.cpp.
+ void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns, NABoolean minimal)
 
-  // verify user is authorized
-  if (!ComUser::isRootUserID())
-    {
-       *CmpCommon::diags() << DgSqlCode(-CAT_NOT_AUTHORIZED);
-       return;
-    }
+ New method is called  initTrafMD.
 
-  Lng32 retcode = 0;
-  Lng32 cliRC = 0;
-  NABoolean xnWasStartedHere = FALSE;
-  Int64 schemaUID = -1;  
-  Int64 objectFlags = 0;
-
-  Lng32 numTables = sizeof(allMDtablesInfo) / sizeof(MDTableInfo);
-
-  Queue * tempQueue = NULL;
-
-  // create metadata tables in hbase
-  ExpHbaseInterface * ehi = allocEHI();
-  if (ehi == NULL)
-    return;
-
-  ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
-    CmpCommon::context()->sqlSession()->getParentQid());
-
-  const char* sysCat = ActiveSchemaDB()->getDefaults().getValue(SEABASE_CATALOG);
-
-  ComTdbVirtTableTableInfo * tableInfo = new(STMTHEAP) ComTdbVirtTableTableInfo[1];
- 
-  Lng32 hbaseErrNum = 0;
-  NAString hbaseErrStr;
-  Lng32 errNum = validateVersions(&ActiveSchemaDB()->getDefaults(), ehi,
-                                  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                  &hbaseErrNum, &hbaseErrStr);
-  if (errNum != 0)
-    {
-      CmpCommon::context()->setIsUninitializedSeabase(TRUE);
-      CmpCommon::context()->uninitializedSeabaseErrNum() = errNum;
-      CmpCommon::context()->hbaseErrNum() = hbaseErrNum;
-      CmpCommon::context()->hbaseErrStr() = hbaseErrStr;
-
-      if (errNum != -1393) // 1393: metadata is not initialized
-        {
-          if (errNum == -1398)
-            *CmpCommon::diags() << DgSqlCode(errNum)
-                                << DgInt0(hbaseErrNum)
-                                << DgString0(hbaseErrStr);
-          else
-            *CmpCommon::diags() << DgSqlCode(errNum);
-
-          deallocEHI(ehi); 
-          return;
-        }
-    }
-  else
-    {
-      CmpCommon::context()->setIsUninitializedSeabase(FALSE);
-
-      *CmpCommon::diags() << DgSqlCode(-1392);
-
-      deallocEHI(ehi); 
-      return;
-    }
-
-  // drop and recreate DTM table TDDL.
-  // Do not do this drop/recreate operation under a dtm transaction.
-  // See file core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TmDDL.java
-  // Keep the name TRAFODION._DTM_.TDDL and col fam "tddlcf" in sync with
-  // that file.
-  HbaseStr tddlTable;
-  const NAString tddlNAS("TRAFODION._DTM_.TDDL");
-  tddlTable.val = (char*)tddlNAS.data();
-  tddlTable.len = tddlNAS.length();
-  if (ehi->exists(tddlTable) == -1) // exists
-    {
-      ehi->truncate(tddlTable, TRUE, TRUE);
-    }
-
-  // create hbase physical objects
-  for (Lng32 i = 0; i < numTables; i++)
-    {
-      const MDTableInfo &mdti = allMDtablesInfo[i];
-
-      HbaseStr hbaseObject;
-      NAString hbaseObjectStr(sysCat);
-      hbaseObjectStr += ".";
-      hbaseObjectStr += SEABASE_MD_SCHEMA;
-      hbaseObjectStr += ".";
-      hbaseObjectStr += mdti.newName;
-      hbaseObject.val = (char*)hbaseObjectStr.data();
-      hbaseObject.len = hbaseObjectStr.length();
-      if (createHbaseTable(ehi, &hbaseObject, SEABASE_DEFAULT_COL_FAMILY, NULL,
-                           0, 0, NULL,
-                           FALSE, ddlXns) == -1)
-        {
-          deallocEHI(ehi); 
-          return;
-        }
-
-    } // for
- 
-  deallocEHI(ehi); 
-  ehi = NULL;
-
-  // Note that this is not an existing jar file, the class
-  // loader will attempt to load the class from the CLASSPATH if
-  // it can't find this jar
-  NAString installJar(getenv("TRAF_HOME"));
-  installJar += "/export/lib/trafodion-sql-currversion.jar";
-
-  breadCrumb = 1;
-  if (beginXnIfNotInProgress(&cliInterface, xnWasStartedHere))
-    goto label_error;
-
-  cliRC = cliInterface.holdAndSetCQD("traf_bootstrap_md_mode", "ON");
-  if (cliRC < 0)
-    {
-      breadCrumb = 2;
-      goto label_error;
-    }
-  breadCrumb = 3;
-
-  // Create Seabase system schema
-  if (updateSeabaseMDObjectsTable(&cliInterface,sysCat,SEABASE_SYSTEM_SCHEMA,
-                                  SEABASE_SCHEMA_OBJECTNAME,
-                                  COM_SHARED_SCHEMA_OBJECT,"Y",SUPER_USER,
-                                  SUPER_USER,objectFlags,schemaUID))
-  {
-    goto label_error;
-  }
-  breadCrumb = 4;
-  
-  // Create Seabase metadata schema
-  schemaUID = -1;
-  if (updateSeabaseMDObjectsTable(&cliInterface,sysCat,SEABASE_MD_SCHEMA,
-                                  SEABASE_SCHEMA_OBJECTNAME,
-                                  COM_PRIVATE_SCHEMA_OBJECT,"Y",SUPER_USER,
-                                  SUPER_USER,objectFlags, schemaUID))
-  {
-    goto label_error;
-  }
-
-  // update MD with information about metadata objects
-  for (Lng32 i = 0; i < numTables; i++)
-    {
-      const MDTableInfo &mdti = allMDtablesInfo[i];
-      MDDescsInfo &mddi = CmpCommon::context()->getTrafMDDescsInfo()[i];
-
-      if (mdti.isIndex)
-        continue;
-
-      Int64 objUID = -1;
-      if (updateSeabaseMDTable(&cliInterface, 
-                               sysCat, SEABASE_MD_SCHEMA, mdti.newName,
-                               COM_BASE_TABLE_OBJECT,
-                               "Y",
-                               mddi.tableInfo,
-                               mddi.numNewCols,
-                               mddi.newColInfo,
-                               mddi.numNewKeys,
-                               mddi.newKeyInfo,
-                               mddi.numIndexes,
-                               mddi.indexInfo,
-                               objUID))
-        {
-          breadCrumb = 5;
-          goto label_error;
-        }
-
-    } // for
-
-  // update metadata with metadata indexes information
-  for (Lng32 i = 0; i < numTables; i++)
-    {
-      const MDTableInfo &mdti = allMDtablesInfo[i];
-      MDDescsInfo &mddi = CmpCommon::context()->getTrafMDDescsInfo()[i];
-
-      if (NOT mdti.isIndex)
-        continue;
-
-      tableInfo->tableName = NULL,
-      tableInfo->createTime = 0;
-      tableInfo->redefTime = 0;
-      tableInfo->objUID = 0;
-      tableInfo->objOwnerID = SUPER_USER;
-      tableInfo->schemaOwnerID = SUPER_USER;
-      tableInfo->isAudited = 1;
-      tableInfo->validDef = 1;
-      tableInfo->hbaseCreateOptions = NULL;
-      tableInfo->numSaltPartns = 0;
-      tableInfo->rowFormat = COM_UNKNOWN_FORMAT_TYPE;
-      tableInfo->objectFlags = 0;
-
-      Int64 objUID = -1;
-      if (updateSeabaseMDTable(&cliInterface, 
-                               sysCat, SEABASE_MD_SCHEMA, mdti.newName,
-                               COM_INDEX_OBJECT,
-                               "Y",
-                               tableInfo,
-                               mddi.numNewCols,
-                               mddi.newColInfo,
-                               mddi.numNewKeys,
-                               mddi.newKeyInfo,
-                               0, NULL,
-                               objUID))
-        {
-          breadCrumb = 6;
-          goto label_error;
-        }
-    } // for
-
-  // update SPJ info
-  if (updateSeabaseMDSPJ(&cliInterface, sysCat, SEABASE_MD_SCHEMA, 
-                         SEABASE_VALIDATE_LIBRARY,
-                         installJar.data(),SUPER_USER,SUPER_USER,
-                         &seabaseMDValidateRoutineInfo,
-                         sizeof(seabaseMDValidateRoutineColInfo) / sizeof(ComTdbVirtTableColumnInfo),
-                         seabaseMDValidateRoutineColInfo))
-    {
-      breadCrumb = 7;
-      goto label_error;
-    }
-
-  updateSeabaseVersions(&cliInterface, sysCat);
-  updateSeabaseAuths(&cliInterface, sysCat);
-
-  if (endXnIfStartedHere(&cliInterface, xnWasStartedHere, 0) < 0)
-    return;
-
-  CmpCommon::context()->setIsUninitializedSeabase(FALSE);
-  CmpCommon::context()->uninitializedSeabaseErrNum() = 0;
-
-  if (createSchemaObjects(&cliInterface))
-    {
-      breadCrumb = 8;
-      goto label_error;
-    }
- 
- if (createMetadataViews(&cliInterface))
-    {
-      breadCrumb = 9;
-      goto label_error;
-    }
-
- // If this is a MINIMAL initialization, don't create the repository
- // or privilege manager tables. (This happens underneath an upgrade,
- // for example, because the repository and privilege manager tables
- // already exist and we will later upgrade them.)
- if (!minimal)  
-   {
-     if (createRepos(&cliInterface))
-       {
-         breadCrumb = 10;
-         goto label_error;
-       }
-
-     if (createPrivMgrRepos(&cliInterface, ddlXns))
-       {
-         breadCrumb = 11;
-         goto label_error;
-       }
-   }
-
- if (createSeabaseLibmgr (&cliInterface))
-   {   
-     breadCrumb = 12;
-     goto label_error;
-   }
-
-  cliRC = cliInterface.restoreCQD("traf_bootstrap_md_mode");
-
-  return;
-
- label_error:
-
-  // When debugging, the breadCrumb variable is useful to tell you
-  // how you got here.
-
-  endXnIfStartedHere(&cliInterface, xnWasStartedHere, -1);
-
-  char msg[80];
-  str_sprintf(msg,"CmpSeabaseDDL::initSeabaseMD failed, breadCrumb = %d",breadCrumb);
-  SQLMXLoggingArea::logSQLMXDebugEvent(msg, -1, __LINE__);
-
-  return;
-}
+*/
 
 void CmpSeabaseDDL::createSeabaseMDviews()
 {
@@ -7526,9 +7248,9 @@
     CmpCommon::context()->sqlSession()->getParentQid());
 
   if ((CmpCommon::context()->isUninitializedSeabase()) &&
-      (CmpCommon::context()->uninitializedSeabaseErrNum() == -1393))
+      (CmpCommon::context()->uninitializedSeabaseErrNum() == -TRAF_NOT_INITIALIZED))
     {
-      *CmpCommon::diags() << DgSqlCode(-1393);
+      *CmpCommon::diags() << DgSqlCode(-TRAF_NOT_INITIALIZED);
       return;
     }
 
@@ -7555,9 +7277,9 @@
     CmpCommon::context()->sqlSession()->getParentQid());
 
   if ((CmpCommon::context()->isUninitializedSeabase()) &&
-      (CmpCommon::context()->uninitializedSeabaseErrNum() == -1393))
+      (CmpCommon::context()->uninitializedSeabaseErrNum() == -TRAF_NOT_INITIALIZED))
     {
-      *CmpCommon::diags() << DgSqlCode(-1393);
+      *CmpCommon::diags() << DgSqlCode(-TRAF_NOT_INITIALIZED);
       return;
     }
 
@@ -7583,9 +7305,9 @@
     CmpCommon::context()->sqlSession()->getParentQid());
 
   if ((CmpCommon::context()->isUninitializedSeabase()) &&
-      (CmpCommon::context()->uninitializedSeabaseErrNum() == -1393))
+      (CmpCommon::context()->uninitializedSeabaseErrNum() == -TRAF_NOT_INITIALIZED))
     {
-      *CmpCommon::diags() << DgSqlCode(-1393);
+      *CmpCommon::diags() << DgSqlCode(-TRAF_NOT_INITIALIZED);
       return;
     }
 
@@ -7596,6 +7318,22 @@
 
 }
 
+short CmpSeabaseDDL::createDefaultSystemSchema(ExeCliInterface *cliInterface)
+{
+  Lng32 cliRC = 0;
+  char buf[4000];
+  
+  str_sprintf(buf,"create shared schema " TRAFODION_SYSCAT_LIT"." SEABASE_SYSTEM_SCHEMA" ");
+  
+  cliRC = cliInterface->executeImmediate(buf);
+  if (cliRC < 0)
+    {
+      cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
+      return -1;
+    }
+
+  return 0;
+}
 
 short CmpSeabaseDDL::createSchemaObjects(ExeCliInterface *cliInterface)
 
@@ -7725,14 +7463,6 @@
 short CmpSeabaseDDL::createPrivMgrRepos(ExeCliInterface *cliInterface,
                                         NABoolean ddlXns)
 {
-  // During install, the customer can choose to enable security features through 
-  // an installation option which sets the the environment variable 
-  // TRAFODION_ENABLE_AUTHENTICATION to YES. Check to see if security features
-  // should be enabled.
-  char * env = getenv("TRAFODION_ENABLE_AUTHENTICATION");
-  if (strcmp(env, "NO") == 0)
-    return 0;
-
   std::vector<std::string> tablesCreated;
   std::vector<std::string> tablesUpgraded;
 
@@ -8180,9 +7910,9 @@
   NABoolean xnWasStartedHere = FALSE;
 
   if ((CmpCommon::context()->isUninitializedSeabase()) &&
-      (CmpCommon::context()->uninitializedSeabaseErrNum() == -1393))
+      (CmpCommon::context()->uninitializedSeabaseErrNum() == -TRAF_NOT_INITIALIZED))
     {
-      *CmpCommon::diags() << DgSqlCode(-1393);
+      *CmpCommon::diags() << DgSqlCode(-TRAF_NOT_INITIALIZED);
       return;
     }
 
@@ -8193,7 +7923,7 @@
   dropLOBHdfsFiles();
 
   CmpCommon::context()->setIsUninitializedSeabase(TRUE);
-  CmpCommon::context()->uninitializedSeabaseErrNum() = -1393;
+  CmpCommon::context()->uninitializedSeabaseErrNum() = -TRAF_NOT_INITIALIZED;
   CmpCommon::context()->setIsAuthorizationEnabled(FALSE);
 
   // kill child arkcmp process. It would ensure that a subsequent
@@ -8326,7 +8056,7 @@
   }
 
   // change authorization status in compiler contexts
-  //CmpCommon::context()->setAuthorizationState (1);
+  CmpCommon::context()->setAuthorizationState (1);
   GetCliGlobals()->currContext()->setAuthStateInCmpContexts(TRUE, TRUE);
 
   // change authorization status in compiler processes
@@ -8606,9 +8336,9 @@
     CmpCommon::context()->sqlSession()->getParentQid());
 
   if ((CmpCommon::context()->isUninitializedSeabase()) &&
-      (CmpCommon::context()->uninitializedSeabaseErrNum() == -1393))
+      (CmpCommon::context()->uninitializedSeabaseErrNum() == -TRAF_NOT_INITIALIZED))
     {
-      *CmpCommon::diags() << DgSqlCode(-1393);
+      *CmpCommon::diags() << DgSqlCode(-TRAF_NOT_INITIALIZED);
       return;
     }
 
@@ -8741,7 +8471,31 @@
               tableName.getSchemaNamePart().getInternalName(),
               tableName.getCatalogNamePart().getInternalName());
   cn.setSpecialType(purgedataTableName);
+
+  if (cn.isHive())
+    {
+      *CmpCommon::diags() << DgSqlCode(-3242) 
+                          << DgString0("Purgedata is not allowed for Hive tables. Use 'Truncate Table' command.");
+      return;
+    }
+
+  if (cn.isHbase())
+    {
+      *CmpCommon::diags() << DgSqlCode(-3242) 
+                          << DgString0("Purgedata is not allowed for HBase tables.");
+      return;
+    }
+    
   NATable *naTable = bindWA.getNATable(cn); 
+
+  // if table doesn't exist and 'if exists' clause is specified, return.
+  if (ddlExpr->purgedataIfExists() && (! naTable))
+    {
+      bindWA.resetErrStatus();
+      CmpCommon::diags()->clear();
+      return;
+    }
+
   if (naTable == NULL || bindWA.errStatus())
     {
       processReturn();
@@ -8907,7 +8661,7 @@
 
   // error accessing hbase. Return.
   if ((CmpCommon::context()->isUninitializedSeabase()) &&
-      (CmpCommon::context()->uninitializedSeabaseErrNum() == -1398))
+      (CmpCommon::context()->uninitializedSeabaseErrNum() == -TRAF_HBASE_ACCESS_ERROR))
     {
       *CmpCommon::diags() << DgSqlCode(CmpCommon::context()->uninitializedSeabaseErrNum())
                           << DgInt0(CmpCommon::context()->hbaseErrNum())
@@ -8937,6 +8691,9 @@
       ignoreUninitTrafErr = TRUE;
     }
 
+  if (dws && dws->getInitTraf())
+    ignoreUninitTrafErr = TRUE;
+
   if ((CmpCommon::context()->isUninitializedSeabase()) &&
       (NOT ignoreUninitTrafErr))
     {
@@ -8949,26 +8706,10 @@
       CMPASSERT(0);
       return -1;
     }
-  
-  if (dws)
-    {
-      if (dws->getMDcleanup())
-        {
-          StmtDDLCleanupObjects * co = 
-            (ddlNode ? ddlNode->castToStmtDDLNode()->castToStmtDDLCleanupObjects()
-             : NULL);
-
-          CmpSeabaseMDcleanup cmpSBDC(STMTHEAP);
-
-           cmpSBDC.cleanupObjects(co, currCatName, currSchName, dws);
-
-           return 0;
-         }
-    }
 
   NABoolean startXn = FALSE;
   NABoolean ddlXns = FALSE;
-  if (ddlExpr->ddlXnsInfo(ddlXns, startXn))
+  if (ddlExpr && ddlExpr->ddlXnsInfo(ddlXns, startXn))
     return -1;
   
   if (startXn)
@@ -8977,9 +8718,50 @@
         goto label_return;
     }
 
+  if (dws)
+    {
+      if (dws->getMDcleanup())
+        {
+          StmtDDLCleanupObjects * co = 
+            (ddlNode ? ddlNode->castToStmtDDLNode()->castToStmtDDLCleanupObjects()
+             : NULL);
+          
+          CmpSeabaseMDcleanup cmpSBDC(STMTHEAP);
+          
+          cmpSBDC.cleanupObjects(co, currCatName, currSchName, dws);
+          
+          return 0;
+        }
+      else if (dws->getInitTraf())
+        {
+          if (ddlExpr)
+            {
+              dws->setDDLXns(TRUE);
+              if (ddlExpr->minimal())
+                dws->setMinimalInitTraf(TRUE);
+            }
+
+          initTrafMD(dws);
+          return 0;
+        }
+    }
+
   if (ddlExpr->initHbase()) 
     {
-      initSeabaseMD(ddlExpr->ddlXns(), ddlExpr->minimal());
+      // will reach here it 'init traf' is to be done without returning status.
+      // drive initTrafMD method in a loop without returning any status rows.
+      // Do this until DONE state is returned.
+      CmpDDLwithStatusInfo dws;
+      dws.setDDLXns(TRUE);
+      if (ddlExpr->minimal())
+        dws.setMinimalInitTraf(TRUE);      
+      NABoolean done = FALSE;
+      while (NOT done)
+        {
+          initTrafMD(&dws);
+          if (dws.done())
+            done = TRUE;
+        }
     }
   else if (ddlExpr->dropHbase())
     {
@@ -10880,8 +10662,10 @@
 
   NABoolean dataBlockEncodingOptionSpecified = FALSE;
   NABoolean compressionOptionSpecified = FALSE;
+  NABoolean memstoreFlushSizeOptionSpecified = FALSE;
   const char *dataBlockEncodingOptionString = "DATA_BLOCK_ENCODING";
   const char *compressionOptionString = "COMPRESSION";
+  const char *flushSizeOptionString = "MEMSTORE_FLUSH_SIZE";
 
   Lng32 numHbaseOptions = 0;
   if (hbaseOptionsClause)
@@ -10902,6 +10686,8 @@
         dataBlockEncodingOptionSpecified = TRUE;
       else if (hbaseOption->key() == compressionOptionString)
         compressionOptionSpecified = TRUE;
+      else if (hbaseOption->key() == flushSizeOptionString)
+        memstoreFlushSizeOptionSpecified= TRUE;
       
       hbaseOptionsStr += hbaseOption->key();
       hbaseOptionsStr += "='";
@@ -10974,6 +10760,8 @@
     CmpCommon::getDefaultString(HBASE_DATA_BLOCK_ENCODING_OPTION);
   NAString compression = 
     CmpCommon::getDefaultString(HBASE_COMPRESSION_OPTION);
+  NAString flushSize =
+    CmpCommon::getDefaultString(HBASE_MEMSTORE_FLUSH_SIZE_OPTION); 
   HbaseCreateOption * hbaseOption = NULL;
   
   char optionStr[200];
@@ -10987,11 +10775,24 @@
           (HBASE_DATA_BLOCK_ENCODING_OPTION) == TRUE)
         {
           numHbaseOptions += 1;
-          sprintf(optionStr, "DATA_BLOCK_ENCODING='%s'|", dataBlockEncoding.data());
+          snprintf(optionStr, 200, "DATA_BLOCK_ENCODING='%s'|", dataBlockEncoding.data());
           hbaseOptionsStr += optionStr;
         }
     }
+  if (!flushSize.isNull() && !memstoreFlushSizeOptionSpecified)
+    {
+      hbaseOption = new(STMTHEAP) HbaseCreateOption("MEMSTORE_FLUSH_SIZE", 
+                                                    flushSize.data());
+      hbaseCreateOptions.insert(hbaseOption);
 
+      if (ActiveSchemaDB()->getDefaults().userDefault
+          (HBASE_MEMSTORE_FLUSH_SIZE_OPTION) == TRUE)
+        {
+          numHbaseOptions += 1;
+          snprintf(optionStr, 200, "MEMSTORE_FLUSH_SIZE='%s'|", flushSize.data());
+          hbaseOptionsStr += optionStr;
+        }
+    }
   if (!compression.isNull() && !compressionOptionSpecified)
     {
       hbaseOption = new(STMTHEAP) HbaseCreateOption("COMPRESSION", 
@@ -11002,7 +10803,7 @@
           (HBASE_COMPRESSION_OPTION) == TRUE)
         {
           numHbaseOptions += 1;
-          sprintf(optionStr, "COMPRESSION='%s'|", compression.data());
+          snprintf(optionStr, 200, "COMPRESSION='%s'|", compression.data());
           hbaseOptionsStr += optionStr;
         }
     }
@@ -11017,7 +10818,7 @@
     hco += "HBASE_OPTIONS=>";
 
     char hbaseOptionsNumCharStr[HBASE_OPTION_MAX_INTEGER_LENGTH];
-    sprintf(hbaseOptionsNumCharStr, "%04d", numHbaseOptions);
+    snprintf(hbaseOptionsNumCharStr, HBASE_OPTION_MAX_INTEGER_LENGTH, "%04d", numHbaseOptions);
     hco += hbaseOptionsNumCharStr;
 
     hco += hbaseOptionsStr.data();
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLinitraf.cpp b/core/sql/sqlcomp/CmpSeabaseDDLinitraf.cpp
new file mode 100644
index 0000000..e5491aa
--- /dev/null
+++ b/core/sql/sqlcomp/CmpSeabaseDDLinitraf.cpp
@@ -0,0 +1,844 @@
+/**********************************************************************
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+**********************************************************************/
+
+/* -*-C++-*-
+ *****************************************************************************
+ *
+ * File:         CmpSeabaseDDLinitraf.cpp
+ * Description:  Implements initialize trafodion
+ *
+ *
+ * Created:     
+ * Language:     C++
+ *
+ *
+ *****************************************************************************
+ */
+
+#include "CmpSeabaseDDLincludes.h"
+
+enum InitTrafSteps {
+  IT_NO_CHANGE      = -1,
+  IT_START          = 0,
+  IT_VERIFY_USER,
+  IT_VERSION_CHECK,
+  IT_TDDL_TRUNCATE,
+  IT_START_XN,
+  IT_CREATE_MD_TABLES,
+  IT_UPDATE_MD_TABLES,
+  IT_CREATE_SCHEMA_OBJECTS,
+  IT_CREATE_MD_VIEWS,
+  IT_CREATE_REPOS,
+  IT_CREATE_PRIVMGR_REPOS,
+  IT_CREATE_LIBMGR,
+  IT_STEP_FAILED,
+  IT_ABORT_XN,
+  IT_FAILED,
+  IT_DONE,
+};
+
+
+static void initDWS(CmpDDLwithStatusInfo *dws)
+{
+  dws->setBlackBoxLen(0);
+  dws->setBlackBox(NULL);
+  dws->setComputeST(FALSE);
+  dws->setComputeET(FALSE);
+  dws->setReturnET(FALSE);
+}
+  
+static void setValuesInDWS(
+     CmpDDLwithStatusInfo *dws,
+     Lng32 nextStep,
+     const char * msg = NULL, 
+     Lng32 subStep = 0, NABoolean isEndStep = FALSE,
+     NABoolean computeST = FALSE, 
+     NABoolean computeET = FALSE, 
+     NABoolean returnET = FALSE,
+     NABoolean done = FALSE)
+{
+  if (msg)
+    dws->setMsg(msg);
+  if (nextStep != IT_NO_CHANGE)
+    dws->setStep(nextStep);
+  if (subStep >= 0)
+    dws->setSubstep(subStep);
+  dws->setEndStep(isEndStep);
+  
+  if (computeST)
+    dws->setComputeST(computeST);
+  if (computeET)
+    dws->setComputeET(computeET);
+  if (returnET)
+    dws->setReturnET(computeET);
+  
+  if (done)
+    dws->setDone(TRUE);
+}
+
+short CmpSeabaseDDL::initTrafMD(CmpDDLwithStatusInfo *dws)
+{
+  Lng32 cliRC = 0;
+
+  initDWS(dws);
+
+  while (1) // exit via return from within the while loop
+    {
+      switch (dws->step())
+        {
+        case IT_START:
+          {
+            setValuesInDWS(dws, IT_VERIFY_USER,
+                           "Initialize Trafodion: Started",
+                           0, TRUE);
+
+            return 0;
+          }
+          break;
+
+        case IT_VERIFY_USER:
+          {
+           switch (dws->subStep())
+              {
+              case 0:
+                {
+                  setValuesInDWS(dws, IT_NO_CHANGE, 
+                                 "Verify User: Started", 1, FALSE,
+                                 TRUE);
+                  
+                  return 0;
+                }
+                break;
+
+              case 1:
+                {
+                  // verify user is authorized
+                  if (!ComUser::isRootUserID())
+                    {
+                      //*CmpCommon::diags() << DgSqlCode(CAT_NOT_AUTHORIZED);
+                      
+                      setValuesInDWS(dws, IT_NO_CHANGE,
+                                     "  Current user is not authorized to Initialize Trafodion. Must be Root to perform this operation.", 2, FALSE);
+
+                      return 0;
+                    }
+                  
+                  CmpCommon::diags()->clear();
+
+                  setValuesInDWS(dws, IT_VERSION_CHECK,
+                                 "Verify User: Completed", 0, TRUE,
+                                 FALSE, TRUE, TRUE);
+                  return 0;
+                } // case 1
+                break;
+
+              case 2:
+                {
+                  setValuesInDWS(dws, IT_FAILED, 
+                                 "Verify User: Failed", 0, TRUE,
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                }
+                break;
+
+              } // switch
+          }
+          break;
+
+        case IT_VERSION_CHECK:
+          {
+            Lng32 hbaseErrNum = 0;
+            NAString hbaseErrStr;
+            
+            ExpHbaseInterface * ehi = allocEHI();
+            if (ehi == NULL)
+              {
+                setValuesInDWS(dws, IT_FAILED, NULL,
+                               0, TRUE);
+
+                break;
+              }
+
+           switch (dws->subStep())
+              {
+              case 0:
+                {
+                  setValuesInDWS(dws, IT_NO_CHANGE,
+                                 "Version Check: Started", 1, FALSE,
+                                 TRUE);
+
+                  return 0;
+                }
+                break;
+
+              case 1:
+                {
+                  // check if traf is already initialized
+                  Lng32 errNum = validateVersions(&ActiveSchemaDB()->getDefaults(), ehi,
+                                                  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                                  &hbaseErrNum, &hbaseErrStr);
+                  deallocEHI(ehi); 
+                  if (errNum == 0)
+                    {
+                      CmpCommon::context()->setIsUninitializedSeabase(FALSE);
+                      
+                      // add warning 1392 to indicate that traf is already init.
+                      // This is needed as installer checks for this error code to
+                      // determine if traf is initialized.
+                      *CmpCommon::diags() << DgSqlCode(TRAF_ALREADY_INITIALIZED);
+                      
+                      // Metadata is initialized
+                      setValuesInDWS(dws, IT_NO_CHANGE,
+                                     "  Trafodion is already initialized on this system.",
+                                     2, FALSE);
+
+                      return 0;
+                    }
+                  
+                  CmpCommon::context()->setIsUninitializedSeabase(TRUE);
+                  CmpCommon::context()->uninitializedSeabaseErrNum() = errNum;
+                  CmpCommon::context()->hbaseErrNum() = hbaseErrNum;
+                  CmpCommon::context()->hbaseErrStr() = hbaseErrStr;
+                  
+                  // Return any other error besides uninitialized traf error.
+                  if (errNum != -TRAF_NOT_INITIALIZED)
+                    {
+                      // add returned error nums as warnings.
+                      // It will show why init traf failed.
+                      if (errNum == -TRAF_HBASE_ACCESS_ERROR)
+                        *CmpCommon::diags() << DgSqlCode(-errNum)
+                                            << DgInt0(hbaseErrNum)
+                                            << DgString0(hbaseErrStr);
+                      else
+                        *CmpCommon::diags() << DgSqlCode(-errNum);
+                      
+                      char msgBuf[1000];
+                      sprintf(msgBuf, "  Error %d returned. See error details for further action.", -errNum);
+                      
+                      setValuesInDWS(dws, IT_NO_CHANGE, msgBuf, 3, FALSE);
+
+                      return 0;
+                    }
+                  
+                  CmpCommon::diags()->clear();
+
+                  setValuesInDWS(dws, IT_TDDL_TRUNCATE, 
+                                 "Version Check: Completed",
+                                 0, TRUE, 
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                } // case 1
+                break;
+
+              case 2:
+                {
+                  setValuesInDWS(dws, IT_DONE,
+                                 "Version Check: Completed",
+                                 0, TRUE, 
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                }
+                break;
+
+              case 3:
+                {
+                  setValuesInDWS(dws, IT_FAILED, "Version Check: Failed",
+                                 0, TRUE, 
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                }
+                break;
+
+              } // switch
+          }
+          break;
+
+        case IT_TDDL_TRUNCATE:
+          {
+            ExpHbaseInterface * ehi = allocEHI();
+            if (ehi == NULL)
+              {
+                setValuesInDWS(dws, IT_FAILED);
+                               
+                break;
+              }
+
+            // truncate DTM table TDDL.
+            // Do not do this operation under a dtm transaction.
+            // See file core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TmDDL.java
+            // Keep the name TRAFODION._DTM_.TDDL and col fam "tddlcf" in sync with
+            // that file.
+            HbaseStr tddlTable;
+            const NAString tddlNAS("TRAFODION._DTM_.TDDL");
+            tddlTable.val = (char*)tddlNAS.data();
+            tddlTable.len = tddlNAS.length();
+            if (ehi->exists(tddlTable) == -1) // exists
+              {
+                ehi->truncate(tddlTable, TRUE, TRUE);
+              }
+
+            deallocEHI(ehi); 
+
+            setValuesInDWS(dws, IT_START_XN);
+          }
+          break;
+
+        case IT_START_XN:
+          {
+            if (dws->getDDLXns())
+              {
+                ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
+                                             CmpCommon::context()->sqlSession()->getParentQid());
+
+                NABoolean xnWasStartedHere = FALSE;
+                if (beginXnIfNotInProgress(&cliInterface, xnWasStartedHere))
+                  {
+                    setValuesInDWS(dws, IT_FAILED);
+                    break;
+                  }
+                dws->setXnStarted(TRUE);
+              }
+
+            setValuesInDWS(dws, IT_CREATE_MD_TABLES);
+          }
+          break;
+
+        case IT_CREATE_MD_TABLES:
+          {
+            switch (dws->subStep())
+              {
+              case 0:
+                {
+                  setValuesInDWS(dws, IT_NO_CHANGE,
+                                 "Create Metadata Tables: Started", 1, FALSE,
+                                 TRUE, FALSE, FALSE);
+                  return 0;
+                }
+                break;
+
+              case 1:
+                {
+                  ExpHbaseInterface * ehi = allocEHI();
+                  if (ehi == NULL)
+                    {
+                      setValuesInDWS(dws, IT_STEP_FAILED,
+                                     "Create Metadata Tables: Failed", 0, TRUE,
+                                     FALSE, TRUE, TRUE);
+
+                      return 0;
+                    }
+
+                  Lng32 numTables = sizeof(allMDtablesInfo) / sizeof(MDTableInfo);
+                  const char* sysCat = 
+                    ActiveSchemaDB()->getDefaults().getValue(SEABASE_CATALOG);
+
+                  // create hbase physical objects
+                  for (Lng32 i = 0; i < numTables; i++)
+                    {
+                      const MDTableInfo &mdti = allMDtablesInfo[i];
+                      
+                      HbaseStr hbaseObject;
+                      NAString hbaseObjectStr(sysCat);
+                      hbaseObjectStr += ".";
+                      hbaseObjectStr += SEABASE_MD_SCHEMA;
+                      hbaseObjectStr += ".";
+                      hbaseObjectStr += mdti.newName;
+                      hbaseObject.val = (char*)hbaseObjectStr.data();
+                      hbaseObject.len = hbaseObjectStr.length();
+                      if (createHbaseTable(ehi, &hbaseObject, SEABASE_DEFAULT_COL_FAMILY, NULL,
+                                           0, 0, NULL,
+                                           FALSE, dws->getDDLXns()) == -1)
+                        {
+                          deallocEHI(ehi); 
+
+                          setValuesInDWS(dws, IT_STEP_FAILED,
+                                         "Create Metadata Tables: Failed", 
+                                         0, TRUE,
+                                         FALSE, TRUE, TRUE);
+
+                          return 0;
+                        }
+                      
+                    } // for
+                  
+                  deallocEHI(ehi); 
+                  ehi = NULL;
+                  
+                  setValuesInDWS(dws, IT_UPDATE_MD_TABLES,
+                                 "Create Metadata Tables: Completed", 
+                                 0, TRUE,
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                }
+                break;
+
+              } // switch
+          }
+          break;
+
+        case IT_UPDATE_MD_TABLES:
+          {
+            switch (dws->subStep())
+              {
+              case 0:
+                {
+                  setValuesInDWS(dws, IT_NO_CHANGE,
+                                 "Update Metadata Tables: Started", 1, FALSE,
+                                 TRUE, FALSE, FALSE);
+                  
+                  return 0;
+                }
+                break;
+
+              case 1:
+                {
+                  ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
+                                               CmpCommon::context()->sqlSession()->getParentQid());
+
+                  cliRC = cliInterface.holdAndSetCQD("traf_bootstrap_md_mode", "ON");
+                  if (cliRC < 0)
+                    {
+                      setValuesInDWS(dws, IT_STEP_FAILED,
+                                     "Update Metadata Tables: Failed", 0, TRUE,
+                                     FALSE, TRUE, TRUE);
+                      
+                      return 0;
+                    }
+                  
+                  Int64 objectFlags = 0;
+                  Int64 schemaUID = -1;  
+
+                  const char* sysCat = 
+                    ActiveSchemaDB()->getDefaults().getValue(SEABASE_CATALOG);
+                  
+                  // Create Seabase metadata schema
+                  schemaUID = -1;
+                  if (updateSeabaseMDObjectsTable(&cliInterface,sysCat,SEABASE_MD_SCHEMA,
+                                                  SEABASE_SCHEMA_OBJECTNAME,
+                                                  COM_PRIVATE_SCHEMA_OBJECT,"Y",SUPER_USER,
+                                                  SUPER_USER,objectFlags, schemaUID))
+                    {
+                      setValuesInDWS(dws, IT_STEP_FAILED,
+                                     "Update Metadata Tables: Failed", 0, TRUE,
+                                     FALSE, TRUE, TRUE);
+
+                      return 0;
+                    }
+                  
+                  // update MD with information about metadata objects
+                  Lng32 numTables = sizeof(allMDtablesInfo) / sizeof(MDTableInfo);
+                  for (Lng32 i = 0; i < numTables; i++)
+                    {
+                      const MDTableInfo &mdti = allMDtablesInfo[i];
+                      MDDescsInfo &mddi = CmpCommon::context()->getTrafMDDescsInfo()[i];
+                      
+                      if (mdti.isIndex)
+                        continue;
+                      
+                      Int64 objUID = -1;
+                      if (updateSeabaseMDTable(&cliInterface, 
+                                               sysCat, SEABASE_MD_SCHEMA, mdti.newName,
+                                               COM_BASE_TABLE_OBJECT,
+                                               "Y",
+                                               mddi.tableInfo,
+                                               mddi.numNewCols,
+                                               mddi.newColInfo,
+                                               mddi.numNewKeys,
+                                               mddi.newKeyInfo,
+                                               mddi.numIndexes,
+                                               mddi.indexInfo,
+                                               objUID))
+                        {
+                          setValuesInDWS(dws, IT_STEP_FAILED,
+                                         "Update Metadata Tables: Failed", 0, TRUE,
+                                         FALSE, TRUE, TRUE);
+                          
+                          return 0;
+                        }
+                      
+                    } // for
+                  
+                  // update metadata with metadata indexes information
+                  for (Lng32 i = 0; i < numTables; i++)
+                    {
+                      const MDTableInfo &mdti = allMDtablesInfo[i];
+                      MDDescsInfo &mddi = CmpCommon::context()->getTrafMDDescsInfo()[i];
+                      
+                      if (NOT mdti.isIndex)
+                        continue;
+                      
+                      ComTdbVirtTableTableInfo * tableInfo = 
+                        new(STMTHEAP) ComTdbVirtTableTableInfo[1];
+                      
+                      tableInfo->tableName = NULL;
+                      tableInfo->createTime = 0;
+                      tableInfo->redefTime = 0;
+                      tableInfo->objUID = 0;
+                      tableInfo->objOwnerID = SUPER_USER;
+                      tableInfo->schemaOwnerID = SUPER_USER;
+                      tableInfo->isAudited = 1;
+                      tableInfo->validDef = 1;
+                      tableInfo->hbaseCreateOptions = NULL;
+                      tableInfo->numSaltPartns = 0;
+                      tableInfo->rowFormat = COM_UNKNOWN_FORMAT_TYPE;
+                      tableInfo->objectFlags = 0;
+                      
+                      Int64 objUID = -1;
+                      if (updateSeabaseMDTable(&cliInterface, 
+                                               sysCat, SEABASE_MD_SCHEMA, mdti.newName,
+                                               COM_INDEX_OBJECT,
+                                               "Y",
+                                               tableInfo,
+                                               mddi.numNewCols,
+                                               mddi.newColInfo,
+                                               mddi.numNewKeys,
+                                               mddi.newKeyInfo,
+                                               0, NULL,
+                                               objUID))
+                        {
+                          setValuesInDWS(dws, IT_STEP_FAILED,
+                                         "Update Metadata Tables: Failed", 0, TRUE,
+                                         FALSE, TRUE, TRUE);                          
+                          return 0;
+                        }
+                    } // for
+                  
+                  // update SPJ info
+                  // Note that this is not an existing jar file, the class
+                  // loader will attempt to load the class from the CLASSPATH if
+                  // it can't find this jar
+                  NAString installJar(getenv("TRAF_HOME"));
+                  installJar += "/export/lib/trafodion-sql-currversion.jar";
+                  if (updateSeabaseMDSPJ(&cliInterface, sysCat, SEABASE_MD_SCHEMA, 
+                                         SEABASE_VALIDATE_LIBRARY,
+                                         installJar.data(),SUPER_USER,SUPER_USER,
+                                         &seabaseMDValidateRoutineInfo,
+                                         sizeof(seabaseMDValidateRoutineColInfo) / sizeof(ComTdbVirtTableColumnInfo),
+                                         seabaseMDValidateRoutineColInfo))
+                    {
+                      setValuesInDWS(dws, IT_STEP_FAILED,
+                                     "Update Metadata Tables: Failed", 0, TRUE,
+                                     FALSE, TRUE, TRUE);                      
+
+                      return 0;
+                    }
+                  
+                  updateSeabaseVersions(&cliInterface, sysCat);
+                  updateSeabaseAuths(&cliInterface, sysCat);
+                  
+                  CmpCommon::context()->setIsUninitializedSeabase(FALSE);
+                  CmpCommon::context()->uninitializedSeabaseErrNum() = 0;
+
+                  setValuesInDWS(dws, IT_CREATE_SCHEMA_OBJECTS,
+                                 "Update Metadata Tables: Completed", 0, TRUE,
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                } // case 1
+              } // switch
+          }
+          break;
+
+        case IT_CREATE_SCHEMA_OBJECTS:
+          {
+           switch (dws->subStep())
+              {
+              case 0:
+                {
+                  setValuesInDWS(dws, IT_NO_CHANGE,
+                                 "Create Schema Objects: Started", 1, FALSE,
+                                 TRUE, FALSE, FALSE);
+
+                  return 0;
+                }
+                break;
+
+              case 1:
+                {
+                  ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
+                                               CmpCommon::context()->sqlSession()->getParentQid());
+
+                  if (createDefaultSystemSchema(&cliInterface))
+                    {
+                      setValuesInDWS(dws, IT_STEP_FAILED,
+                                     "Create Schema Objects: Failed", 0, TRUE,
+                                     FALSE, TRUE, TRUE);
+
+                      return 0;
+                    }
+    
+                  if (createSchemaObjects(&cliInterface))
+                    {
+                      setValuesInDWS(dws, IT_STEP_FAILED,
+                                     "Create Schema Objects: Failed", 0, TRUE,
+                                     FALSE, TRUE, TRUE);
+
+                      return 0;
+                    }
+                  
+                  setValuesInDWS(dws, IT_CREATE_MD_VIEWS,
+                                 "Create Schema Objects: Completed", 0, TRUE,
+                                 FALSE, TRUE, TRUE);
+                  
+                  return 0;
+                } // case 1
+              } // switch
+          }
+          break;
+
+        case IT_CREATE_MD_VIEWS:
+          {
+            switch (dws->subStep())
+              {
+              case 0:
+                {
+                  setValuesInDWS(dws, IT_NO_CHANGE,
+                                 "Create Metadata Views: Started", 1, FALSE,
+                                 TRUE, FALSE, FALSE);
+  
+                  return 0;
+                }
+                break;
+
+              case 1:
+                {
+                  ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
+                                               CmpCommon::context()->sqlSession()->getParentQid());
+
+                  if (createMetadataViews(&cliInterface))
+                    {
+                      setValuesInDWS(dws, IT_STEP_FAILED,
+                                     "Create Metadata Views: Failed", 0, TRUE,
+                                     FALSE, TRUE, TRUE);
+
+                      return 0;
+                    }
+                  
+                  // If this is a MINIMAL initialization, don't create the 
+                  // repository or privilege manager tables. 
+                  // (This happens underneath an upgrade, for example, 
+                  // because the repository and privilege manager tables
+                  // already exist and we will later upgrade them.)
+                  setValuesInDWS(dws, 
+                                 (dws->getMinimalInitTraf() ? IT_CREATE_LIBMGR : IT_CREATE_REPOS),
+                                 "Create Metadata Views: Completed", 
+                                 0, TRUE,
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                } // case
+              } // switch
+          }
+          break;
+
+        case IT_CREATE_REPOS:
+          {
+            switch (dws->subStep())
+              {
+              case 0:
+                {
+                  setValuesInDWS(dws, IT_NO_CHANGE,
+                                 "Create Repository Tables: Started", 1, FALSE,
+                                 TRUE, FALSE, FALSE);
+
+                  return 0;
+                }
+                break;
+
+              case 1:
+                {
+                  ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
+                                               CmpCommon::context()->sqlSession()->getParentQid());
+
+                  if (createRepos(&cliInterface))
+                    {
+                      setValuesInDWS(dws, IT_STEP_FAILED,
+                                     "Create Repository Tables: Failed", 0, TRUE,
+                                     FALSE, TRUE, TRUE);
+                      return 0;
+                    }
+
+                  setValuesInDWS(dws, IT_CREATE_PRIVMGR_REPOS,
+                                 "Create Repository Tables: Completed", 0, TRUE,
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                } // case 1
+              } // switch
+          }
+          break;
+
+        case IT_CREATE_PRIVMGR_REPOS:
+          {
+            switch (dws->subStep())
+              {
+              case 0:
+                {
+                  setValuesInDWS(dws, IT_NO_CHANGE,
+                                 "Create PrivMgr Tables: Started", 1, FALSE,
+                                 TRUE, FALSE, FALSE);
+                  return 0;
+                }
+                break;
+                
+              case 1:
+                {
+                  ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
+                                               CmpCommon::context()->sqlSession()->getParentQid());
+
+                  if (createPrivMgrRepos(&cliInterface, dws->getDDLXns()))
+                    {
+                      setValuesInDWS(dws, IT_STEP_FAILED,
+                                     "Create PrivMgr Tables: Failed", 0, TRUE,
+                                     FALSE, TRUE, TRUE);
+                      return 0;
+                    }
+                  
+                  setValuesInDWS(dws, IT_CREATE_LIBMGR,
+                                 "Create PrivMgr Tables: Completed", 0, TRUE,
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                } // case 1
+              } // switch
+          }
+          break;
+
+        case IT_CREATE_LIBMGR:
+          {
+            switch (dws->subStep())
+              {
+              case 0:
+                {
+                  setValuesInDWS(dws, IT_NO_CHANGE,
+                                 "Create Library Manager: Started", 1, FALSE,
+                                 TRUE, FALSE, FALSE);
+
+                  return 0;
+                }
+                break;
+                
+              case 1:
+                {
+                  ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
+                                               CmpCommon::context()->sqlSession()->getParentQid());
+
+                  if (createSeabaseLibmgr (&cliInterface))
+                    {   
+                      setValuesInDWS(dws, IT_STEP_FAILED,
+                                     "Create Library Manager: Failed", 0, TRUE,
+                                     FALSE, TRUE, TRUE);
+ 
+                      return 0;
+                    }
+                  
+                  cliRC = cliInterface.restoreCQD("traf_bootstrap_md_mode");
+
+                  setValuesInDWS(dws, IT_DONE,
+                                 "Create Library Manager: Completed", 0, TRUE,
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                } // case 1
+              } // switch
+          }
+          break;
+
+        case IT_STEP_FAILED:
+          {
+            setValuesInDWS(dws, (dws->xnStarted() ? IT_ABORT_XN : IT_FAILED));
+
+            break;
+          }
+          break;
+
+        case IT_ABORT_XN:
+          {
+            switch (dws->subStep())
+              {
+              case 0:
+                {
+                  setValuesInDWS(dws, IT_NO_CHANGE,
+                                 "Abort Transaction: Started", 1, FALSE,
+                                 TRUE, FALSE, FALSE);
+  
+                  return 0;
+                }
+                break;
+
+              case 1:
+                {
+                  ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
+                                               CmpCommon::context()->sqlSession()->getParentQid());
+                  
+                  NABoolean xnWasStartedHere = dws->xnStarted();
+                  endXnIfStartedHere(&cliInterface, xnWasStartedHere, -1);
+                  dws->setXnStarted(xnWasStartedHere);
+                  
+                  setValuesInDWS(dws, IT_FAILED,
+                                 "Abort Transaction: Completed", 0, TRUE,
+                                 FALSE, TRUE, TRUE);
+
+                  return 0;
+                }
+                break;
+              } // switch
+          }
+          break;
+
+        case IT_FAILED:
+          {
+            setValuesInDWS(dws, IT_START,
+                           "Initialize Trafodion: Failed", 0, FALSE,
+                           FALSE, TRUE, TRUE, TRUE);
+            
+            return -1;
+          }
+          break;
+          
+        case IT_DONE:
+          {
+            ExeCliInterface cliInterface(STMTHEAP, 0, NULL, 
+                                         CmpCommon::context()->sqlSession()->getParentQid());
+  
+            NABoolean xnWasStartedHere = dws->xnStarted();
+            endXnIfStartedHere(&cliInterface, xnWasStartedHere, 0);
+            dws->setXnStarted(xnWasStartedHere);
+
+            setValuesInDWS(dws, IT_START,
+                           "Initialize Trafodion: Completed", 0, FALSE,
+                           FALSE, TRUE, TRUE, TRUE);
+
+	    return 0;
+          }   
+          break;
+        } // switch
+    } // while
+
+  return 0;
+}
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
index b28d2cf..29ef68e 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
@@ -1597,9 +1597,9 @@
   Lng32 cliRC = 0;
   
   if ((CmpCommon::context()->isUninitializedSeabase()) &&
-      (CmpCommon::context()->uninitializedSeabaseErrNum() == -1393))
+      (CmpCommon::context()->uninitializedSeabaseErrNum() == -TRAF_NOT_INITIALIZED))
     {
-      *CmpCommon::diags() << DgSqlCode(-1393);
+      *CmpCommon::diags() << DgSqlCode(-TRAF_NOT_INITIALIZED);
       return -1;
     }
 
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 3e9f1a2..a620624 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -11351,81 +11351,6 @@
   return;
 }
 
-static short processHiveTruncate(StmtDDLonHiveObjects * hddl,
-                                 NATable * naTable,
-                                 NAString &extObjectName)
-{
-  // A Hive table can be an External or Managed table.
-  // Currently, an External Hive table cannot be truncated.
-  // Maybe some future Hive version will allow that.
-  // Temporarily change the table attribute to be Managed,
-  // truncate the table and then change it back to be External.
-  NABoolean tableWasAltered = FALSE;
-  NAString alterStmt;
-  if ((hddl->getOper() == StmtDDLonHiveObjects::TRUNCATE_) &&
-      (naTable && naTable->isHiveExternalTable()))
-    {
-      // make the table managed table before truncate
-      alterStmt = "alter table " + extObjectName + " set tblproperties ('EXTERNAL'='False')";
-      if (HiveClient_JNI::executeHiveSQL(alterStmt.data()) != HVC_OK)
-        {
-          // alter failed
-          *CmpCommon::diags() << DgSqlCode(-1214)
-                              << DgString0(getSqlJniErrorStr())
-                              << DgString1(hddl->getHiveDDL());
-          
-          return -1;
-        }
-      
-      tableWasAltered = TRUE;
-      
-      // alter stmt to switch the table back to external type
-      alterStmt = "alter table " + extObjectName + " set tblproperties ('EXTERNAL'='TRUE')";
-    }
-  
-  // execute the hive DDL statement.
-  if (HiveClient_JNI::executeHiveSQL(hddl->getHiveDDL().data()) != HVC_OK)
-    {
-      if (tableWasAltered)
-        {
-          // table was altered to Managed. Alter it back to External.
-          if (HiveClient_JNI::executeHiveSQL(alterStmt.data()) != HVC_OK)
-            {
-              // alter itself failed. Return error.
-              *CmpCommon::diags() << DgSqlCode(-1214)
-                                  << DgString0(getSqlJniErrorStr())
-                                  << DgString1(hddl->getHiveDDL());
-              
-              return -1;
-            }
-        }
-
-      *CmpCommon::diags() << DgSqlCode(-1214)
-                          << DgString0(getSqlJniErrorStr())
-                          << DgString1(hddl->getHiveDDL());
-      
-      return -1;
-    }
-
-  if ((hddl->getOper() == StmtDDLonHiveObjects::TRUNCATE_) &&
-      (naTable && naTable->isHiveExternalTable()) &&
-      (tableWasAltered))
-     {
-       // table was altered to Managed. Alter it back to External.
-       if (HiveClient_JNI::executeHiveSQL(alterStmt.data()) != HVC_OK)
-         {
-           // alter itself failed. Return error.
-           *CmpCommon::diags() << DgSqlCode(-1214)
-                               << DgString0(getSqlJniErrorStr())
-                               << DgString1(hddl->getHiveDDL());
-           
-           return -1;
-         }
-     }
-
-  return 0;
-}
-
 static void processPassthruHiveDDL(StmtDDLonHiveObjects * hddl)
 {
   NAString hiveQuery(hddl->getHiveDDL());
@@ -11437,7 +11362,8 @@
            (hiveQuery.index("TRUNCATE ", 0, NAString::ignoreCase) == 0) ||
            (hiveQuery.index("GRANT ", 0, NAString::ignoreCase) == 0) ||
            (hiveQuery.index("REVOKE ", 0, NAString::ignoreCase) == 0) ||
-           (hiveQuery.index("RELOAD ", 0, NAString::ignoreCase) == 0)))
+           (hiveQuery.index("RELOAD ", 0, NAString::ignoreCase) == 0) ||
+           (hiveQuery.index("MSCK ", 0, NAString::ignoreCase) == 0)))
     {
       // error case
       *CmpCommon::diags() << DgSqlCode(-3242) << DgString0("Specified DDL operation cannot be executed directly by hive.");
@@ -11487,10 +11413,10 @@
   
   // Start error checks
   if (NOT ((hddl->getOper() == StmtDDLonHiveObjects::CREATE_) ||
-           (hddl->getOper() == StmtDDLonHiveObjects::CREATE_LIKE_TRAF_) ||
            (hddl->getOper() == StmtDDLonHiveObjects::DROP_) ||
            (hddl->getOper() == StmtDDLonHiveObjects::ALTER_) ||
-           (hddl->getOper() == StmtDDLonHiveObjects::TRUNCATE_)))
+           (hddl->getOper() == StmtDDLonHiveObjects::TRUNCATE_) ||
+           (hddl->getOper() == StmtDDLonHiveObjects::MSCK_)))
     {
       // error case
       *CmpCommon::diags() << DgSqlCode(-3242) << DgString0("Only CREATE, DROP, ALTER or TRUNCATE DDL commands can be specified on hive objects. Use \"PROCESS HIVE DDL '<ddl-stmt>' \" to directly execute other statements through hive.");
@@ -11617,8 +11543,7 @@
          }
      }
 
-   if ((hddl->getOper() == StmtDDLonHiveObjects::CREATE_) ||
-       (hddl->getOper() == StmtDDLonHiveObjects::CREATE_LIKE_TRAF_))
+   if (hddl->getOper() == StmtDDLonHiveObjects::CREATE_)
      {
        if (objExists)
          {
@@ -11692,7 +11617,6 @@
    
    if ((CmpCommon::getDefault(HIVE_NO_REGISTER_OBJECTS) == DF_OFF) &&
        ((hddl->getOper() == StmtDDLonHiveObjects::CREATE_) ||
-        (hddl->getOper() == StmtDDLonHiveObjects::CREATE_LIKE_TRAF_) ||
         (hddl->getOper() == StmtDDLonHiveObjects::ALTER_)) &&
        (NOT isRegistered))
      {
@@ -11737,26 +11661,57 @@
          }
      } // register this object
 
-   if (hddl->getOper() == StmtDDLonHiveObjects::TRUNCATE_)
+   // execute the hive DDL statement.
+   if (HiveClient_JNI::executeHiveSQL(hddl->getHiveDDL().data()) != HVC_OK)
      {
-       if (processHiveTruncate(hddl, naTable, extObjectName))
-         goto label_error;
-     }
-   else
-     {
-       // execute the hive DDL statement.
-       if (HiveClient_JNI::executeHiveSQL(hddl->getHiveDDL().data()) != HVC_OK)
-         {
-           *CmpCommon::diags() << DgSqlCode(-1214)
-                               << DgString0(getSqlJniErrorStr())
-                               << DgString1(hddl->getHiveDDL());
-           
-           goto label_error;
-         }
+       *CmpCommon::diags() << DgSqlCode(-1214)
+                           << DgString0(getSqlJniErrorStr())
+                           << DgString1(hddl->getHiveDDL());
+       
+       goto label_error;
      }
 
   endXnIfStartedHere(&cliInterface, xnWasStartedHere, 0);
 
+  // this ALTER may be a RENAME command. 
+  // If the table being renamed is registered in Traf MD, unregister it.
+  if (hddl->getOper() == StmtDDLonHiveObjects::ALTER_)
+    {
+      // set cqd so NATable is recreated instead of returning cached one.
+      NABoolean cqdChanged = FALSE;
+      if (CmpCommon::getDefault(TRAF_RELOAD_NATABLE_CACHE) == DF_OFF)
+        {
+          NAString value("ON");
+          ActiveSchemaDB()->getDefaults().validateAndInsert(
+               "traf_reload_natable_cache", value, FALSE);
+          cqdChanged = TRUE;
+        }
+
+      NATable *naTable = bindWA.getNATable(cnTgt);
+      
+      if (cqdChanged)
+        {
+          NAString value("OFF");
+          ActiveSchemaDB()->getDefaults().validateAndInsert(
+               "traf_reload_natable_cache", value, FALSE);
+        }
+
+      NABoolean objExists = FALSE;
+      if (naTable == NULL || bindWA.errStatus())
+        objExists = FALSE;
+      else
+        objExists = TRUE;
+      
+      if (NOT objExists)
+        {
+          CmpCommon::diags()->clear();
+          cliRC = unregisterNativeTable(
+               catName, schName, objName,
+               cliInterface, 
+               objType);
+        }
+    }
+
   ActiveSchemaDB()->getNATableDB()->removeNATable
     (cnTgt,
      ComQiScope::REMOVE_FROM_ALL_USERS,
@@ -11770,102 +11725,6 @@
   return;
 }
 
-short CmpSeabaseDDL::genDDLforHiveTableLikeTrafTable(StmtDDLCreateTable * createTableNode,
-                                                     NAString &currCatName, NAString &currSchName,
-                                                     NAString &tableDDL)
-{ 
-  Lng32 cliRC = 0;
-  Lng32 retcode = 0;
-
-  ComObjectName tgtTableName(createTableNode->getTableName(), COM_TABLE_NAME);
-  ComAnsiNamePart currCatAnsiName(currCatName);
-  ComAnsiNamePart currSchAnsiName(currSchName);
-  tgtTableName.applyDefaults(currCatAnsiName, currSchAnsiName);
-
-  if (tgtTableName.getCatalogNamePartAsAnsiString() != HIVE_SYSTEM_CATALOG)
-    {
-      *CmpCommon::diags()
-        << DgSqlCode(-3242)
-        << DgString0("LIKE target table must be a hive table.");
-      return -1;
-    }
-
-  NAString tgtSchName;
-
-  if ((tgtTableName.getSchemaNamePartAsAnsiString(TRUE).compareTo(HIVE_DEFAULT_SCHEMA_EXE, NAString::ignoreCase) == 0) ||
-      (tgtTableName.getSchemaNamePartAsAnsiString(TRUE).compareTo(HIVE_SYSTEM_SCHEMA, NAString::ignoreCase) == 0))
-    tgtSchName = HIVE_SYSTEM_SCHEMA;
-  else
-    tgtSchName = tgtTableName.getSchemaNamePartAsAnsiString(TRUE);
-
-  ComObjectName srcTableName(createTableNode->getLikeSourceTableName(), COM_TABLE_NAME);
-
-  srcTableName.applyDefaults(currCatName, currSchName);
-
-  const NAString srcCatNamePart = srcTableName.getCatalogNamePartAsAnsiString();
-  const NAString srcSchNamePart = srcTableName.getSchemaNamePartAsAnsiString(TRUE);
-  const NAString srcObjNamePart = srcTableName.getObjectNamePartAsAnsiString(TRUE);
-  CorrName srcCN(srcObjNamePart, STMTHEAP, srcSchNamePart, srcCatNamePart);
-  
-  if (NOT createTableNode->getIsLikeOptionSpecified())
-    {
-      *CmpCommon::diags()
-        << DgSqlCode(-3242)
-        << DgString0("LIKE clause must be specified to create this hive table.");
-      return -1;
-    }
-
-  ParDDLLikeOptsCreateTable &likeOptions = createTableNode->getLikeOptions();
-
-  if (srcTableName.getCatalogNamePartAsAnsiString() != TRAFODION_SYSCAT_LIT)
-    {
-      *CmpCommon::diags()
-        << DgSqlCode(-3242)
-        << DgString0("LIKE source table must be a trafodion table.");
-      return -1;
-    }
-
-  if (createTableNode->managedHiveTable())
-    tableDDL = "CREATE TABLE ";
-  else
-    tableDDL = "CREATE EXTERNAL TABLE ";
-  if (createTableNode->createIfNotExists())
-    tableDDL += " IF NOT EXISTS ";
-
-  tableDDL += (tgtSchName == HIVE_SYSTEM_SCHEMA ? "`default`" : tgtSchName) + ".";
-  tableDDL += tgtTableName.getObjectNamePartAsAnsiString(TRUE);
-
-  char * buf = NULL;
-  ULng32 buflen = 0;
-  retcode = CmpDescribeTrafAsHiveTable(srcCN, 3/*createlike*/, 
-                                       buf, buflen, 
-                                       STMTHEAP);
-  if (retcode)
-    return -1;
-
-  NABoolean done = FALSE;
-  Lng32 curPos = 0;
-  while (NOT done)
-    {
-      short len = *(short*)&buf[curPos];
-      NAString frag(&buf[curPos+sizeof(short)],
-                    len - ((buf[curPos+len-1]== '\n') ? 1 : 0));
-
-      tableDDL += frag;
-      curPos += ((((len+sizeof(short))-1)/8)+1)*8;
-
-      if (curPos >= buflen)
-        done = TRUE;
-    }
-
-  if (NOT likeOptions.getLikeOptHiveOptions().isNull())
-    {
-      tableDDL += " " + likeOptions.getLikeOptHiveOptions();
-    }
-
-  return 0;
-}
-
 // ------------------------------------------------------------------------
 // setupQueryTreeForHiveDDL
 //
@@ -11903,43 +11762,6 @@
   StmtDDLonHiveObjects::ObjectType type = 
     (StmtDDLonHiveObjects::ObjectType)hiveDDLInfo->ddlObjectType_;
 
-  if ((oper == StmtDDLonHiveObjects::CREATE_LIKE_TRAF_) &&
-      (NOT ((hiveDDLInfo->essd_ == Parser::HiveDDLInfo::EXPLAIN_) ||
-            (hiveDDLInfo->essd_ == Parser::HiveDDLInfo::SHOWPLAN_) ||
-            (hiveDDLInfo->essd_ == Parser::HiveDDLInfo::SHOWSHAPE_))))
-    {
-      ExprNode *hlt = *node;
-      if (hlt == NULL)
-        return FALSE; // node must be passed in.
-
-      StmtQuery * stmt = (StmtQuery*)hlt->castToStatementExpr();
-      RelRoot * root = (RelRoot*)stmt->getQueryExpression();
-      DDLExpr * ddl = (DDLExpr*)root->child(0)->castToRelExpr();
-      StmtDDLonHiveObjects * doh = 
-        ddl->getDDLNode()->castToStmtDDLNode()->castToStmtDDLonHiveObjects();
-      StmtDDLCreateTable * ct = doh->getChild(0)->castToStmtDDLNode()->castToStmtDDLCreateTable();
-      if (! ct)
-        return FALSE;
-
-      NAString tableDDL;
-      if (CmpSeabaseDDL::genDDLforHiveTableLikeTrafTable(ct, currCatName, currSchName,
-                                                         tableDDL))
-        return FALSE;
-      
-      doh->setHiveDDL(tableDDL);
-
-      // indicate that this is the root for the entire query
-      if (root)
-        {
-          if (hiveDDLInfo->essd_ == Parser::HiveDDLInfo::DISPLAY_)
-            ((RelRoot*)root)->setDisplayTree(TRUE);
-        }
-      
-      *node = stmt;  
-      
-      return TRUE;
-    }
-
   // position and length of the object name specified in the query.
   Lng32 hiveNamePos = hiveDDLInfo->ddlNamePos_;
   Lng32 hiveNameLen =  hiveDDLInfo->ddlNameLen_;
@@ -11967,46 +11789,16 @@
     }
 
   NAString newHiveName;
-  if (con.getCatalogNamePartAsAnsiString(TRUE).compareTo(HIVE_SYSTEM_CATALOG, NAString::ignoreCase) != 0)
+  newHiveName = ComConvertTrafHiveNameToNativeHiveName
+    (con.getCatalogNamePartAsAnsiString(TRUE),
+     con.getSchemaNamePartAsAnsiString(TRUE),
+     (type != StmtDDLonHiveObjects::SCHEMA_ ?
+      con.getObjectNamePartAsAnsiString(TRUE) : NAString("")));
+  if (newHiveName.isNull())
     {
-      // should never reach here. Parser should have validated that the
-      // name is a hive name.
-      // Throw an assertion if it does.
       PARSERASSERT(1);
     }
 
-  // Original hive name specified in the query may have any of the following
-  // forms after they are fully qualified:
-  //  hive.hive.t, hive.`default`.t, hive.hivesch.t, hive.hivesch
-  // These names are valid in traf environment only and are used to determine
-  // if hive ddl is being processed.
-  //
-  // Replace them in the query by equivalent hive names:
-  //   t, `default`.t, hivesch.t, hivesch
-  //
-  if (con.getSchemaNamePartAsAnsiString(TRUE).compareTo(HIVE_DEFAULT_SCHEMA_EXE, NAString::ignoreCase) == 0) // matches  'default'
-    {
-      newHiveName += NAString("`") + con.getSchemaNamePartAsAnsiString(TRUE) + "`";
-      if (type != StmtDDLonHiveObjects::SCHEMA_)
-        newHiveName += ".";
-    }
-  else if (con.getSchemaNamePartAsAnsiString(TRUE).compareTo(HIVE_SYSTEM_SCHEMA, NAString::ignoreCase) == 0) // matches  'hive'
-    {
-      // set fully qualified hive default schema name `default`
-      newHiveName += NAString("`default`");
-      if (type != StmtDDLonHiveObjects::SCHEMA_)
-        newHiveName += ".";
-    }
-  else // user schema name
-    {
-      newHiveName += con.getSchemaNamePartAsAnsiString(1);
-      if (type != StmtDDLonHiveObjects::SCHEMA_)
-        newHiveName += ".";
-    }
-
-  if (type != StmtDDLonHiveObjects::SCHEMA_)
-    newHiveName += con.getObjectNamePartAsAnsiString(TRUE);
-  
   // remove original name at hiveNamePos/hiveNameLen and replace with the
   // newly constructed name.
   if ((hiveDDL.length() > 0) && (hiveNameLen > 0))
@@ -12021,12 +11813,47 @@
     hiveDDL.remove(hiveDDL.length()-1);
   
   CmpCommon::diags()->clear();
+  
+  if (oper == StmtDDLonHiveObjects::MSCK_)
+    {
+      // this may be set through 'msck repair table <tablename>' or 
+      // 'alter table <tablename> repair partitions'.
+      // Underlying Hive may not support the 'alter repair' syntax on
+      // all platforms.
+      // Create 'msck' version which is supported.
+      NAString newHiveDDL("MSCK REPAIR TABLE ");
+      newHiveDDL += newHiveName;
+      hiveDDL.clear();
+      hiveDDL = newHiveDDL;
+    }
+
+  DDLExpr * ddlExpr = NULL;
+  RelExpr * ddlExprRoot = NULL;
+  if (oper == StmtDDLonHiveObjects::TRUNCATE_)
+    {
+      NAString newHiveDDL("TRUNCATE TABLE ");
+      newHiveDDL += hiveDDL(hiveNamePos, hiveDDL.length() - hiveNamePos);
+      hiveDDL.clear();
+      hiveDDL = newHiveDDL;
+
+      CorrName cn(con.getObjectNamePartAsAnsiString(), 
+                  PARSERHEAP(),
+                  con.getSchemaNamePartAsAnsiString(),
+                  con.getCatalogNamePartAsAnsiString());
+      ExeUtilHiveTruncate * ht = 
+        new (PARSERHEAP()) ExeUtilHiveTruncate
+        (cn, newHiveName, hiveDDL, PARSERHEAP());
+
+      if (ifExistsOrNotExists)
+        ht->setIfExists(TRUE);
+
+      ddlExprRoot = new(CmpCommon::statementHeap()) RelRoot(ht);
+    }
 
   // Construct DDL expr tree for regular query or query
   // explain/showplan/showshape/display.
   //
   // Regular DDL query:
-  // HiveLikeTraf DDL query:
   //   StmtQuery => RelRoot => DDLExpr => StmtDDLonHiveObjects
   //
   // explain query:
@@ -12039,16 +11866,23 @@
   // display:
   //   same as regular query with displayTree flag set in RelRoot
   //
-  DDLExpr * ddlExpr = NULL;
-  RelExpr * ddlExprRoot = NULL;
-  if (NOT ((hiveDDLInfo->essd_ == Parser::HiveDDLInfo::SHOWPLAN_) ||
-           (hiveDDLInfo->essd_ == Parser::HiveDDLInfo::SHOWSHAPE_)))
+  else if (NOT ((hiveDDLInfo->essd_ == Parser::HiveDDLInfo::SHOWPLAN_) ||
+                (hiveDDLInfo->essd_ == Parser::HiveDDLInfo::SHOWSHAPE_)))
     {
+      // get the hive schema name if set in the session.
+      BindWA bindWA(ActiveSchemaDB(), CmpCommon::context(), FALSE/*inDDL*/);
+      NAString hiveDB = ComConvertTrafHiveNameToNativeHiveName
+        (bindWA.getDefaultSchema().getCatalogName(),
+         bindWA.getDefaultSchema().getSchemaName(),
+         NAString(""));
+      hiveDB.toLower();
+      
       StmtDDLonHiveObjects * sdho = 
         new (PARSERHEAP()) StmtDDLonHiveObjects(oper, type, 
                                                 ifExistsOrNotExists,
                                                 con.getExternalName(),
-                                                hiveDDL, PARSERHEAP());
+                                                hiveDDL, hiveDB,
+                                                PARSERHEAP());
       
       DDLExpr * ddlExpr = new(CmpCommon::statementHeap()) 
         DDLExpr(sdho, inputStr, inputStrCharSet,
@@ -13824,7 +13658,7 @@
   if ((CmpCommon::context()->isUninitializedSeabase()) &&
       (!Get_SqlParser_Flags(INTERNAL_QUERY_FROM_EXEUTIL)))
      {
-      if (CmpCommon::context()->uninitializedSeabaseErrNum() == -1398)
+      if (CmpCommon::context()->uninitializedSeabaseErrNum() == -TRAF_HBASE_ACCESS_ERROR)
         *CmpCommon::diags() << DgSqlCode(CmpCommon::context()->uninitializedSeabaseErrNum())
                             << DgInt0(CmpCommon::context()->hbaseErrNum())
                             << DgString0(CmpCommon::context()->hbaseErrStr());
@@ -13872,7 +13706,7 @@
       if ((CmpCommon::context()->isUninitializedSeabase()) &&
           (!Get_SqlParser_Flags(INTERNAL_QUERY_FROM_EXEUTIL)))
         {
-          if (CmpCommon::context()->uninitializedSeabaseErrNum() == -1398)
+          if (CmpCommon::context()->uninitializedSeabaseErrNum() == -TRAF_HBASE_ACCESS_ERROR)
             *CmpCommon::diags() << DgSqlCode(CmpCommon::context()->uninitializedSeabaseErrNum())
                                 << DgInt0(CmpCommon::context()->hbaseErrNum())
                                 << DgString0(CmpCommon::context()->hbaseErrStr());
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
index 6556d7e..eb68813 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
@@ -525,7 +525,7 @@
 		  deallocEHI(ehi);
 		  
 		  if ((retcode == 0) ||
-                      (retcode == -1393) ||
+                      (retcode == -TRAF_NOT_INITIALIZED) ||
                       (retcode == -1395))
 		    {
 		      // no version mismatch detected between system and expected software.
@@ -985,12 +985,12 @@
 		  //
 		  // initialize trafodion
 		  CmpCommon::context()->setIsUninitializedSeabase(TRUE);
-		  CmpCommon::context()->uninitializedSeabaseErrNum() = -1393; // MD doesn't exist
+		  CmpCommon::context()->uninitializedSeabaseErrNum() = -TRAF_NOT_INITIALIZED; // MD doesn't exist
 
                   // Use "initialize trafodion, minimal" so we only create the metadata
                   // tables. The other tables (repository and privilege manager) already
                   // exist; we will upgrade them later in this method.
-		  str_sprintf(buf, "initialize trafodion, minimal;");
+		  str_sprintf(buf, "initialize trafodion, minimal, no return status;");
 		  
 		  cliRC = cliInterface.executeImmediate(buf);
 		  if (cliRC < 0)
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLview.cpp b/core/sql/sqlcomp/CmpSeabaseDDLview.cpp
index 0b8372c..49e0bf9 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLview.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLview.cpp
@@ -1612,7 +1612,6 @@
   return 0;
 }
 
-
 // *****************************************************************************
 // *                                                                           *
 // * Function: checkAccessPrivileges                                           *
diff --git a/core/sql/sqlcomp/DefaultConstants.h b/core/sql/sqlcomp/DefaultConstants.h
index 77f14b4..2098024 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -1817,8 +1817,6 @@
   GEN_UDRRS_SIZE_DOWN  ,
   GEN_UDRRS_SIZE_UP    ,
 
-  FAST_DELETE,
-
   ALLOW_UNEXTERNALIZED_MAINTAIN_OPTIONS,
 
   EXE_MEMORY_AVAILABLE_IN_MB, // Mem size (MB) in ESP available for BMOs
@@ -2921,6 +2919,7 @@
 
   HBASE_DATA_BLOCK_ENCODING_OPTION,
   HBASE_COMPRESSION_OPTION,
+  HBASE_MEMSTORE_FLUSH_SIZE_OPTION,
   HQC_LOG,
   HQC_LOG_FILE, // specify the HQC log file name
   HYBRID_QUERY_CACHE,
@@ -3319,8 +3318,8 @@
 
   BMO_MEMORY_ESTIMATE_OUTLIER_FACTOR,
 
-  // Use the earlier implementation of HdfsScan via libhdfs
-  USE_LIBHDFS_SCAN,
+  // Use the earlier implementation of Hdfs access including LOB via libhdfs
+  USE_LIBHDFS,
 
   // if set, make primary key columns non-nullable. ANSI specification.
   // Default is ON.
@@ -3340,14 +3339,19 @@
 
   // if set, ddl from Traf interface on Hive objects is supported.
   TRAF_DDL_ON_HIVE_OBJECTS,
-  
-  // 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)!
+
+  // If set to TRUE, CTAS on Hive object(Create and Insert...select) is processed in Hive.
+  // If set to FALSE, Create is done in Hive, and Insert...select is done in Traf.
+  // Default is OFF.
+  HIVE_CTAS_IN_NATIVE_MODE,
+
   // Size of byte[] in java when direct byteBuffer can't be used
   // Used to read compressed hdfs text files and to write
   // both compressed and uncompressed hdfs files
   HDFS_IO_INTERIM_BYTEARRAY_SIZE_IN_KB,
 
+  // 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
 };
 
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index a12557f..e56efa5 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -1221,8 +1221,6 @@
   DDkwd__(FAKE_VOLUME_ASSIGNMENTS,		"OFF"),
   DDui1__(FAKE_VOLUME_NUM_VOLUMES,              "24"),
 
-  DDkwd__(FAST_DELETE,                          "OFF"),
-
  // upper and lower limit (2,10) must be in sync with error values in 
  //ExFastTransport.cpp
   DDkwd__(FAST_EXTRACT_DIAGS,			"OFF"),
@@ -1465,6 +1463,7 @@
  DDui___(HBASE_MAX_COLUMN_VAL_LENGTH,                  "1000"),
  DDui___(HBASE_MAX_ESPS,                        "9999"),
  DDui___(HBASE_MAX_NUM_SEARCH_KEYS,                  "512"),
+ DDkwd__(HBASE_MEMSTORE_FLUSH_SIZE_OPTION,              ""),
  DDui1__(HBASE_MIN_BYTES_PER_ESP_PARTITION,     "67108864"),
 
   DDkwd__(HBASE_NATIVE_IUD,		"ON"),
@@ -1636,6 +1635,8 @@
 
   DD_____(HIVE_CATALOG,                                ""),
 
+  DDkwd__(HIVE_CTAS_IN_NATIVE_MODE,             "OFF"),
+
   DDkwd__(HIVE_DATA_MOD_CHECK,                  "ON"),
 
   DDkwd__(HIVE_DEFAULT_CHARSET,            (char *)SQLCHARSETSTRING_UTF8),
@@ -3058,7 +3059,7 @@
   // Use large queues on RHS of Flow/Nested Join when appropriate
   DDkwd__(USE_LARGE_QUEUES,                     "ON"),
 
-  DDkwd__(USE_LIBHDFS_SCAN,                     "OFF"),
+ XDDkwd__(USE_LIBHDFS,                          "OFF"),
 
   DDkwd__(USE_MAINTAIN_CONTROL_TABLE,          "OFF"),
 
@@ -5964,6 +5965,7 @@
         (attrEnum == USE_HIVE_SOURCE) ||
         (attrEnum == HIVE_FILE_CHARSET) ||
         (attrEnum == HBASE_DATA_BLOCK_ENCODING_OPTION) ||
+        (attrEnum == HBASE_MEMSTORE_FLUSH_SIZE_OPTION) ||
         (attrEnum == HBASE_COMPRESSION_OPTION))
       return DF_USER;
     
@@ -6311,6 +6313,7 @@
       break;
 
     case AUTO_QUERY_RETRY_WARNINGS:
+    case USE_LIBHDFS:
       if (tok == DF_ON ||
 	  tok == DF_OFF)
 	isValid = TRUE;
diff --git a/core/sql/sqlcomp/parser.cpp b/core/sql/sqlcomp/parser.cpp
index 20937bd..8ade55b 100644
--- a/core/sql/sqlcomp/parser.cpp
+++ b/core/sql/sqlcomp/parser.cpp
@@ -896,20 +896,10 @@
       // if a hive ddl object was found during parsing, generate ddl expr tree.
       // foundDDL_ could be set during successful parsing as well as for
       // a query which gave a syntax error.
-      if (SqlParser_CurrentParser->hiveDDLInfo_->ddlOperation_ == 
-          StmtDDLonHiveObjects::CREATE_LIKE_TRAF_)
-        {
-          // TheParseTree is already set up with the needed structures.
-          // Any additional info would be added in processHiveDDL method.
-          *node = TheParseTree;  
-        }
-      else
-        {
-          if (TheParseTree)
-            delete TheParseTree; 
-          TheParseTree = NULL;
-          *node = NULL;
-        }
+      if (TheParseTree)
+        delete TheParseTree; 
+      TheParseTree = NULL;
+      *node = NULL;
       
       if ((processHiveDDL(SqlParser_CurrentParser->hiveDDLInfo_, node)) &&
           (*node != NULL))
diff --git a/core/sql/sqlcomp/parser.h b/core/sql/sqlcomp/parser.h
index bbb6da9..6189c20 100644
--- a/core/sql/sqlcomp/parser.h
+++ b/core/sql/sqlcomp/parser.h
@@ -323,6 +323,11 @@
       ifExistsOrNotExists_ = ifExistsOrNotExists;
     }
 
+    void setFoundDDL(NABoolean v) 
+    {
+      foundDDL_ = v;
+    }
+
     // in some cases, parser should not do hive ddl check.
     // This may happen for internal parsing, for ex, for view expansion,
     // or internal MD ddl compiles.
diff --git a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
index bb44217..8853495 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
@@ -34,6 +34,8 @@
 import java.util.Arrays;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 
 import org.apache.log4j.PropertyConfigurator;
 import org.apache.log4j.Logger;
@@ -93,6 +95,8 @@
 
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
 import org.apache.hadoop.fs.permission.AclEntry;
 import org.apache.hadoop.hbase.io.hfile.CacheConfig;
 import org.apache.hadoop.hbase.io.hfile.HFile;
@@ -161,6 +165,7 @@
     public static final int HBASE_SPLIT_POLICY = 22;
     public static final int HBASE_CACHE_DATA_IN_L1 = 23;
     public static final int HBASE_PREFETCH_BLOCKS_ON_OPEN = 24;
+    public static final int HBASE_HDFS_STORAGE_POLICY= 25;
 
 
     private static Connection connection; 
@@ -230,10 +235,12 @@
    private class ChangeFlags {
        boolean tableDescriptorChanged;
        boolean columnDescriptorChanged;
+       boolean storagePolicyChanged;
 
        ChangeFlags() {
            tableDescriptorChanged = false;
            columnDescriptorChanged = false;
+           storagePolicyChanged = false;
        }
 
        void setTableDescriptorChanged() {
@@ -251,6 +258,19 @@
        boolean columnDescriptorChanged() {
            return columnDescriptorChanged;
        }
+
+       void setStoragePolicyChanged(String str) {
+           storagePolicy_ = str;
+           storagePolicyChanged = true;
+       }
+
+       boolean storagePolicyChanged()    {
+           return storagePolicyChanged;
+       }
+
+       String storagePolicy_;
+
+
    }
 
    private ChangeFlags setDescriptors(Object[] tableOptions,
@@ -470,6 +490,11 @@
 		  colDesc.setPrefetchBlocksOnOpen(false); 
 	      returnStatus.setColumnDescriptorChanged();
 	      break ;
+           case HBASE_HDFS_STORAGE_POLICY:
+               //TODO HBase 2.0 support this
+               //So when come to HBase 2.0, no need to do this via HDFS, just set here
+             returnStatus.setStoragePolicyChanged(tableOption);
+             break ;
            case HBASE_SPLIT_POLICY:
                // This method not yet available in earlier versions
                // desc.setRegionSplitPolicyClassName(tableOption));
@@ -491,6 +516,7 @@
        throws IOException, MasterNotRunningException {
             if (logger.isDebugEnabled()) logger.debug("HBaseClient.createk(" + tblName + ") called.");
             String trueStr = "TRUE";
+            ChangeFlags setDescRet = null;
             HTableDescriptor desc = new HTableDescriptor(tblName);
             addCoprocessor(desc);
             int defaultVersionsValue = 0;
@@ -511,7 +537,7 @@
                 HColumnDescriptor colDesc = new HColumnDescriptor(colFam);
 
                 // change the descriptors based on the tableOptions; 
-                setDescriptors(tableOptions,desc /*out*/,colDesc /*out*/, defaultVersionsValue);
+                setDescRet = setDescriptors(tableOptions,desc /*out*/,colDesc /*out*/, defaultVersionsValue);
                 
                 desc.addFamily(colDesc);
             }
@@ -538,7 +564,21 @@
                      admin.createTable(desc);
                   }
                }
-            admin.close();
+
+            if(setDescRet!= null)
+            {
+              if(setDescRet.storagePolicyChanged())
+              {
+                 Object tableOptionsStoragePolicy[] = new Object[HBASE_HDFS_STORAGE_POLICY+1];
+                 for(int i=0; i<HBASE_HDFS_STORAGE_POLICY; i++)
+                   tableOptionsStoragePolicy[i]="";
+                 tableOptionsStoragePolicy[HBASE_HDFS_STORAGE_POLICY]=(String)setDescRet.storagePolicy_ ;
+                 tableOptionsStoragePolicy[HBASE_NAME]=(String)tblName;
+                 alter(tblName,tableOptionsStoragePolicy,transID);
+              }
+            }
+            else
+              admin.close();
         return true;
     }
 
@@ -579,7 +619,6 @@
         Admin admin = getConnection().getAdmin();
         HTableDescriptor htblDesc = admin.getTableDescriptor(TableName.valueOf(tblName));       
         HColumnDescriptor[] families = htblDesc.getColumnFamilies();
-
         String colFam = (String)tableOptions[HBASE_NAME];
         if (colFam == null)
             return true; // must have col fam name
@@ -611,13 +650,18 @@
                 return true; // col fam already exists
         }
         else {
-            if (colDesc == null)
+            if (colDesc == null )
+            {
+               if( (String)tableOptions[HBASE_HDFS_STORAGE_POLICY] == null || (String)tableOptions[HBASE_HDFS_STORAGE_POLICY]=="" )
                 return true; // colDesc must exist
+            }
+            else {
 
-            int defaultVersionsValue = colDesc.getMaxVersions(); 
+              int defaultVersionsValue = colDesc.getMaxVersions(); 
 
-            status = 
+              status = 
                 setDescriptors(tableOptions,htblDesc /*out*/,colDesc /*out*/, defaultVersionsValue);
+           }
         }
 
             if (transID != 0) {
diff --git a/core/sql/src/main/java/org/trafodion/sql/HDFSClient.java b/core/sql/src/main/java/org/trafodion/sql/HDFSClient.java
index 2f24dce..d4a697f 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HDFSClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HDFSClient.java
@@ -87,6 +87,7 @@
    private static ExecutorService executorService_ = null;
    private static FileSystem defaultFs_ = null;
    private static CompressionCodecFactory codecFactory_ = null;
+   private static boolean alluxioNotInstalled_ = false;
    private FileSystem fs_ = null;
    private int bufNo_;
    private int rangeNo_;
@@ -95,6 +96,7 @@
    private OutputStream outStream_;
    private String filename_;
    private ByteBuffer buf_;
+   private ByteBuffer savedBuf_;
    private byte[] bufArray_;
    private int bufLen_;
    private int bufOffset_ = 0;
@@ -126,6 +128,16 @@
       catch (IOException ioe) {
          throw new RuntimeException("Exception in HDFSClient static block", ioe);
       }
+      try {
+         boolean alluxioFs = defaultFs_ instanceof alluxio.hadoop.FileSystem;
+      }
+      catch (Throwable rte)
+      {
+         // Ignore the exception. It is not needed for alluxio to be installed
+         // for the methods of this class to work if 
+         // alluxio filesystem is NOT required
+         alluxioNotInstalled_ = true;
+      }
       codecFactory_ = new CompressionCodecFactory(config_); 
       System.loadLibrary("executor");
    }
@@ -142,21 +154,32 @@
       HDFSRead() 
       {
       }
- 
+    
       public Object call() throws IOException 
       {
          int bytesRead;
          int totalBytesRead = 0;
          if (compressed_) {
             bufArray_ = new byte[ioByteArraySizeInKB_ * 1024];
-         } else 
-         if (! buf_.hasArray()) {
-            try {
-              fsdis_.seek(pos_);
-            } catch (EOFException e) {
-              isEOF_ = 1;
-              return new Integer(totalBytesRead);
-            } 
+         } 
+         else  {
+            // alluxio doesn't support direct ByteBuffer reads
+            // Hence, create a non-direct ByteBuffer, read into
+            // byteArray backing up this ByteBuffer and 
+            // then copy the data read to direct ByteBuffer for the 
+            // native layer to process the data
+            if ((! alluxioNotInstalled_) && fs_ instanceof alluxio.hadoop.FileSystem) {
+               savedBuf_ = buf_;
+               buf_ = ByteBuffer.allocate(savedBuf_.capacity());
+            }
+            if (! buf_.hasArray()) {
+               try {
+                  fsdis_.seek(pos_);
+               } catch (EOFException e) {
+                  isEOF_ = 1;
+                  return new Integer(totalBytesRead);
+               } 
+            }
          }
          do
          {
@@ -181,6 +204,12 @@
             pos_ += bytesRead;
             lenRemain_ -= bytesRead;
          } while (lenRemain_ > 0); 
+         if ((! alluxioNotInstalled_) && fs_ instanceof alluxio.hadoop.FileSystem) {
+            if (totalBytesRead > 0) {
+               byte[] temp = buf_.array();
+               savedBuf_.put(temp, 0, totalBytesRead);
+            }
+         }
          return new Integer(totalBytesRead);
       }
     } 
@@ -292,6 +321,7 @@
 
    boolean hdfsCreate(String fname , boolean overwrite, boolean compress) throws IOException
    {
+      filename_ = fname;
       if (logger_.isDebugEnabled()) 
         logger_.debug("HDFSClient.hdfsCreate() - started" );
       if (!compress || (compress && fname.endsWith(".gz")))
@@ -302,27 +332,22 @@
       fs_ = FileSystem.get(filepath_.toUri(),config_);
       compressed_ = compress;
       fsdis_ = null;      
-      FSDataOutputStream fsOut;
-      if (overwrite)
-         fsOut = fs_.create(filepath_);
-      else
       if (fs_.exists(filepath_))
-         fsOut = fs_.append(filepath_);
-      else
-         fsOut = fs_.create(filepath_);
-
-      if (compressed_) {
-          GzipCodec gzipCodec = (GzipCodec) ReflectionUtils.newInstance( GzipCodec.class, config_);
-          Compressor gzipCompressor = CodecPool.getCompressor(gzipCodec);
-          outStream_= gzipCodec.createOutputStream(fsOut, gzipCompressor);
+      {
+         if (overwrite)
+            fs_.delete(filepath_);
+         else
+            throw new IOException(filepath_ + " already exists");
       }
-      else
-         outStream_ = fsOut;
+      FSDataOutputStream fsOut = null;
+      fsOut = fs_.create(filepath_);
+      fsOut.close();
       return true;
-   }
+   } 
 
    boolean hdfsOpen(String fname , boolean compress) throws IOException
    {
+      filename_ = fname;
       if (logger_.isDebugEnabled()) 
          logger_.debug("HDFSClient.hdfsOpen() - started" );
       if (!compress || (compress && fname.endsWith(".gz")))
@@ -335,6 +360,43 @@
       fsdis_ = null;      
       return true;
     }
+
+    long hdfsSize() throws IOException
+    {
+       FileStatus filestatus;
+       try 
+       {
+          filestatus = fs_.getFileStatus(filepath_);
+       } catch (java.io.FileNotFoundException e)
+       {
+          return 0;
+       }
+       if (filestatus.isFile())
+          return filestatus.getLen();
+       else
+          return -1;
+    }
+
+    long hdfsWriteImmediate(byte[] buff) throws IOException
+    {
+      if (logger_.isDebugEnabled()) 
+         logger_.debug("HDFSClient.hdfsWriteClose() - started" );
+      FSDataOutputStream fsOut;
+      FileStatus filestatus;
+      long writeOffset; 
+      if (fs_.exists(filepath_)) {
+         filestatus = fs_.getFileStatus(filepath_);
+         fsOut = fs_.append(filepath_);
+         writeOffset = filestatus.getLen(); 
+      }
+      else {
+         fsOut = fs_.create(filepath_);
+         writeOffset = 0;
+      }
+      fsOut.write(buff);
+      fsOut.close();
+      return writeOffset;
+    }
     
     int hdfsWrite(byte[] buff) throws IOException
     {
@@ -359,16 +421,19 @@
             logger_.debug("HDFSClient.hdfsWrite() - output stream created" );
       }
       outStream_.write(buff);
+      if (outStream_ instanceof FSDataOutputStream)
+         ((FSDataOutputStream)outStream_).hsync();
       if (logger_.isDebugEnabled()) 
          logger_.debug("HDFSClient.hdfsWrite() - bytes written " + buff.length);
       return buff.length;
     }
 
-    int hdfsRead(ByteBuffer buffer) throws IOException
+    int hdfsRead(long pos, ByteBuffer buffer) throws IOException
     {
       if (logger_.isDebugEnabled()) 
          logger_.debug("HDFSClient.hdfsRead() - started" );
       if (fsdis_ == null && inStream_ == null ) {
+         try {
          codec_ = codecFactory_.getCodec(filepath_);
          if (codec_ != null) {
             compressed_ = true;
@@ -376,19 +441,34 @@
          }
          else
             fsdis_ = fs_.open(filepath_);
-         pos_ = 0;
+         } catch (java.io.FileNotFoundException e) {
+            return 0;
+         }
       }
       int lenRemain;   
       int bytesRead;
       int totalBytesRead = 0;
       int bufLen;
       int bufOffset = 0;
+      if (compressed_) {
+         if (pos != 0 && pos != -1)
+            throw new IOException("Compressed files can be read from a non-zero position");
+         else
+            pos_ = 0;
+      }
+      else
+      if (pos != -1) 
+         pos_ = pos;
       if (compressed_ && bufArray_ != null) 
          bufArray_ = new byte[ioByteArraySizeInKB_ * 1024];
       if (buffer.hasArray())
          bufLen = buffer.array().length;
       else
+      {
+         if (pos_ != -1)
+            fsdis_.seek(pos_);
          bufLen = buffer.capacity();
+      }
       lenRemain = bufLen;
       do
       {
@@ -413,7 +493,6 @@
     {
       if (logger_.isDebugEnabled()) logger_.debug("HDFSClient.hdfsClose() - started" );
       if (outStream_ != null) {
-          outStream_.flush();
           outStream_.close();
           outStream_ = null;
       }
@@ -422,7 +501,24 @@
       return true;
     }
 
-    
+    static long hdfsSize(String filename) throws IOException
+    {
+       Path filepath = new Path(filename);
+       FileSystem fs = FileSystem.get(filepath.toUri(),config_);
+       FileStatus filestatus;
+       try
+       {
+          filestatus = fs.getFileStatus(filepath);
+       } catch (java.io.FileNotFoundException e)
+       {
+          return 0;
+       } 
+       if (filestatus.isFile())
+          return filestatus.getLen();
+       else
+          return -1;
+    } 
+
     public static boolean hdfsMergeFiles(String srcPathStr, String dstPathStr) throws IOException
     {
       if (logger_.isDebugEnabled()) logger_.debug("HDFSClient.hdfsMergeFiles() - start");
@@ -547,7 +643,7 @@
          return 0;
    }
 
-
+   
    public void stop() throws IOException
    {
       if (future_ != null) {
@@ -669,6 +765,17 @@
       return true;
    }
 
+   public static boolean hdfsRename(String fromPathStr, String toPathStr) throws IOException 
+   {
+      if (logger_.isDebugEnabled()) 
+         logger_.debug("HDFSClient.hdfsRename(" + fromPathStr + ", " + toPathStr + ")");
+      Path fromPath = new Path(fromPathStr );
+      Path toPath = new Path(toPathStr );
+      FileSystem fs = FileSystem.get(fromPath.toUri(), config_);
+      fs.rename(fromPath, toPath);
+      return true;
+   }
+
    private native int sendFileStatus(long jniObj, int numFiles, int fileNo, boolean isDir, 
                         String filename, long modTime, long len,
                         short numReplicas, long blockSize, String owner, String group,
diff --git a/core/sql/src/main/java/org/trafodion/sql/HiveClient.java b/core/sql/src/main/java/org/trafodion/sql/HiveClient.java
index 586f10e..e5268f8 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HiveClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HiveClient.java
@@ -63,6 +63,9 @@
     private static HiveConf hiveConf = null;
     private static HiveMetaStoreClient hmsClient  ;
     private static String ddlTimeConst = null;
+
+    private static Statement stmt = null;
+
     static {
          String confFile = System.getProperty("trafodion.log4j.configFile");
          System.setProperty("trafodion.root", System.getenv("TRAF_HOME"));
@@ -241,24 +244,29 @@
         return fieldVal.toString();
   }
 
-  public static void executeHiveSQL(String ddl) throws ClassNotFoundException, SQLException
+    public static void executeHiveSQL(String ddl) 
+        throws ClassNotFoundException, SQLException
   {
-      Class.forName("org.apache.hive.jdbc.HiveDriver");
-      Connection con = null;
-      String isSecureHadoop = System.getenv("SECURE_HADOOP");
-      //If Kerberos is enabled, then we need to connect to remote hiveserver2 using hive principal
-      if(isSecureHadoop != null && isSecureHadoop.equalsIgnoreCase("Y")){
-         String hiveServer2Url = System.getenv("HIVESERVER2_URL");
-         if(hiveServer2Url == null || hiveServer2Url.isEmpty()){
-            hiveServer2Url = "localhost:10000";
-         }
-         String hivePrincipal = System.getenv("HIVE_PRINCIPAL");
-         con = DriverManager.getConnection("jdbc:hive2://" + hiveServer2Url+"/;principal=" + hivePrincipal, "hive", "");
-      }else{
-         con = DriverManager.getConnection("jdbc:hive2://", "hive", "");
+      if (stmt == null) {
+          Class.forName("org.apache.hive.jdbc.HiveDriver");
+          Connection con = null;
+          String isSecureHadoop = System.getenv("SECURE_HADOOP");
+          //If Kerberos is enabled, then we need to connect to remote hiveserver2 using hive principal
+          if(isSecureHadoop != null && isSecureHadoop.equalsIgnoreCase("Y")){
+              String hiveServer2Url = System.getenv("HIVESERVER2_URL");
+              if(hiveServer2Url == null || hiveServer2Url.isEmpty()){
+                  hiveServer2Url = "localhost:10000";
+              }
+              String hivePrincipal = System.getenv("HIVE_PRINCIPAL");
+              con = DriverManager.getConnection("jdbc:hive2://" + hiveServer2Url+"/;principal=" + hivePrincipal, "hive", "");
+          }else{
+              con = DriverManager.getConnection("jdbc:hive2://", "hive", "");
+          }
+          stmt = con.createStatement();
       }
-      Statement stmt = con.createStatement();
+
       try {
+
           stmt.execute(ddl);
       } catch (SQLException s) {
           throw s;            
diff --git a/core/sql/src/main/java/org/trafodion/sql/udr/TypeInfo.java b/core/sql/src/main/java/org/trafodion/sql/udr/TypeInfo.java
index 392f7bd..747bdee 100644
--- a/core/sql/src/main/java/org/trafodion/sql/udr/TypeInfo.java
+++ b/core/sql/src/main/java/org/trafodion/sql/udr/TypeInfo.java
@@ -396,22 +396,22 @@
             break;
             
         case TIME:
-            // string hh:mm:ss
+            // string hh:mm:ss[.fffffffff]
             length_ = 8;
             if (scale > 0)
                 length_ += scale+1;
-            if (scale < 0 || scale > 6)
-                throw new UDRException(38900,"Scale %d of time in TypeInfo::TypeInfo is outside the allowed range of 0-6", scale);
+            if (scale < 0 || scale > 9)
+                throw new UDRException(38900,"Scale %d of time in TypeInfo::TypeInfo is outside the allowed range of 0-9", scale);
             break;
             
         case TIMESTAMP:
-            // string yyyy-mm-dd hh:mm:ss.ffffff
-            //        12345678901234567890123456
+            // string yyyy-mm-dd hh:mm:ss[.fffffffff]
+            //        1234567890123456789 0123456789
             length_ = 19;
             if (scale > 0)
                 length_ += scale+1;
-            if (scale < 0 || scale > 6)
-                throw new UDRException(38900,"Scale %d of timestamp in TypeInfo::TypeInfo is outside the allowed range of 0-6", scale);
+            if (scale < 0 || scale > 9)
+                throw new UDRException(38900,"Scale %d of timestamp in TypeInfo::TypeInfo is outside the allowed range of 0-9", scale);
             break;
 
         case INTERVAL:
@@ -421,8 +421,8 @@
           
           if (intervalCode_ == SQLIntervalCode.UNDEFINED_INTERVAL_CODE.getSQLIntervalCode())
               throw new UDRException(38900,"Interval code in TypeInfo::TypeInfo is undefined");
-        if (scale < 0 || scale > 6)
-            throw new UDRException(38900,"Scale %d of interval in TypeInfo::TypeInfo is outside the allowed range of 0-6", sqlType);
+          if (scale < 0 || scale > 9)
+            throw new UDRException(38900,"Scale %d of interval in TypeInfo::TypeInfo is outside the allowed range of 0-9", sqlType);
 
         // all intervals are treated like signed numbers, need to compute
         // the length from the combined precision of all parts, see method
diff --git a/core/sql/ustat/hs_globals.cpp b/core/sql/ustat/hs_globals.cpp
index ab703d7..b033e65 100644
--- a/core/sql/ustat/hs_globals.cpp
+++ b/core/sql/ustat/hs_globals.cpp
@@ -5328,14 +5328,17 @@
 {
   Lng32 retcode = 0;
 
+  // use QualifiedName constructor to correctly handle delimited names.
+  QualifiedName qualTableName(user_table->data(), 1);
+  NAString tableNameStr = qualTableName.getUnqualifiedObjectNameAsAnsiString();
+  NAString query = "select count(*) from ";
+  query.append(tableNameStr);
+  query.append(" where ").append(getWherePredicateForIUS());
+
   // set PARSING_IUS_WHERE_CLAUSE bit in Sql_ParserFlags; return it to
   // its entry value on exit
   PushAndSetSqlParserFlags savedParserFlags(PARSING_IUS_WHERE_CLAUSE);
 
-  NAString query = "select count(*) from ";
-  query.append(getTableName(strrchr(user_table->data(), '.')+1, nameSpace));
-  query.append(" where ").append(getWherePredicateForIUS());
-
   Parser parser(CmpCommon::context());
   Lng32 diagsMark = diagsArea.mark();
 
diff --git a/core/sql/ustat/hs_la.cpp b/core/sql/ustat/hs_la.cpp
index 3e92350..62ed05d 100644
--- a/core/sql/ustat/hs_la.cpp
+++ b/core/sql/ustat/hs_la.cpp
@@ -1372,7 +1372,10 @@
         if (DFS2REC::isLOB(getColInfo(i).datatype)) // skip LOB columns
           continue;
 
-        if (!ComTrafReservedColName(*getColInfo(i).colname))
+        // skip derived column names (e.g. "_SALT_", "_DIVISION_n_")
+        // but only in Trafodion tables
+        if ((getTblOrigin() != HBASE_TBL) ||
+            (!ComTrafReservedColName(*getColInfo(i).colname)))
           {
             if (!first)
               qry += ", ";
diff --git a/core/sql/ustat/hs_read.cpp b/core/sql/ustat/hs_read.cpp
index ab53202..80def3d 100644
--- a/core/sql/ustat/hs_read.cpp
+++ b/core/sql/ustat/hs_read.cpp
@@ -195,43 +195,6 @@
   close();
 }
 
-#ifdef NA_USTAT_USE_STATIC  // use static query defined in module file
-
-Lng32 HSStatsTimeCursor::open(NABoolean updateReadTime)
-{
-  if (!validCursor_)
-    return -1;
-  HSTranMan *TM = HSTranMan::Instance();
-
-  HSGlobalsClass::autoInterval = CmpCommon::getDefaultLong(USTAT_AUTOMATION_INTERVAL);
-  NAString stmt;
-  // Assign appropriate query depending on table type, schema version, and automation.
-  // For automation, the updatable CURSOR106 requires that a transaction be started.
-  // It is ended in the destructor.
-  if (fileType_ == SQLMP)
-    stmt = "CURSOR102_MP";
-  else if (HSGlobalsClass::schemaVersion >= COM_VERS_2300)
-    {
-      if (updateReadTime) 
-      {  
-        stmt = "CURSOR106_MX_2300";  
-        startedTrans_ = (((retcode_ = TM->Begin("CURSOR106")) == 0) ? TRUE : FALSE);
-        HSHandleError(retcode_);
-      }
-      else
-        stmt = "CURSOR102_MX_2300";
-    }
-  else
-        stmt = "CURSOR102_MX"; 
-
-  return OpenCursor( stmt,
-                      (void *)histogramTableName_,
-                      (void *)&tableUID_,
-                      desc_);
-}
-
-#else // NA_USTAT_USE_STATIC not defined, use dynamic query
-
 Lng32 HSStatsTimeCursor::open(NABoolean updateReadTime)
 {
   Lng32 retcode;
@@ -292,19 +255,13 @@
   return retcode;
 }
 
-#endif // NA_USTAT_USE_STATIC not defined
-
 void HSStatsTimeCursor::close()
 {
   // Commit transaction if started for updatable CURSOR106 (for READ_TIME).
   HSTranMan *TM = HSTranMan::Instance();
   if (startedTrans_)
   {
-#ifdef NA_USTAT_USE_STATIC
-    if (!desc_ || update_retcode_) TM->Rollback();
-#else
     if (!cursor106_ || update_retcode_) TM->Rollback();
-#endif
     else                           TM->Commit();  // doesn't issue COMMIT if trans not started.
   }
   if (desc_)
@@ -343,9 +300,7 @@
   Int32 colNumber;
   Int64 statTime, readTime;
   short readCount;
-#ifdef NA_USTAT_USE_STATIC
-  SQL_EXEC_ClearDiagnostics(desc_);
-#endif
+
   maxStatTime = 0;
   HSLogMan *LM = HSLogMan::Instance();
   HSTranMan *TM = HSTranMan::Instance();
@@ -354,19 +309,11 @@
   LM->LogTimeDiff("Entering: HSStatsTimeCursor::get()");
   while(TRUE) // Loop until break statement below.
   {
-    if (HSGlobalsClass::schemaVersion >= COM_VERS_2300)
-#ifdef NA_USTAT_USE_STATIC  // use static query defined in module file
-      retcode_ = SQL_EXEC_Fetch(desc_, NULL, 4,
-#else // NA_USTAT_USE_STATIC not defined, use dynamic query
-      retcode_ = SQL_EXEC_Fetch(cursor102_->getStmt(), cursor102_->getOutDesc(), 4,
-#endif // NA_USTAT_USE_STATIC not defined
+    retcode_ = SQL_EXEC_Fetch(cursor102_->getStmt(), cursor102_->getOutDesc(), 4,
                                 (void *)(&statTime),   NULL, 
                                 (void *)(&colNumber),  NULL,
                                 (void *)(&readTime),   NULL,
                                 (void *)(&readCount),  NULL);
-    else
-      retcode_ = SQL_EXEC_Fetch(desc_, NULL, 2,(void *)(&statTime),   NULL, 
-                                               (void *)(&colNumber),  NULL);
     if (retcode_ == HS_EOF || retcode_ < 0) break;
 
     LM->Log("While Fetching StatsTime: Check for update of READ_TIME/READ_COUNT.");
@@ -378,8 +325,7 @@
       if (!updateReadTime && // If already set, no need to check again.
           updatable_ &&
           nacol && 
-          nacol->needFullHistogram() && 
-          HSGlobalsClass::schemaVersion >= COM_VERS_2300
+          nacol->needFullHistogram()
           )
       {
         // Check if READ_TIME is such that it needs to be updated.
@@ -432,20 +378,14 @@
   Int64 statTime, readTime;
   char readTimeTstmp[HS_TIMESTAMP_SIZE];
   short readCount;
-#ifdef NA_USTAT_USE_STATIC
-  SQL_EXEC_ClearDiagnostics(desc_);
-#endif
+
   HSLogMan *LM = HSLogMan::Instance();
   HSTranMan *TM = HSTranMan::Instance();
   
   LM->LogTimeDiff("Entering: HSStatsTimeCursor::update()");
   while(TRUE) // Loop until break statement below.
   {
-#ifdef NA_USTAT_USE_STATIC  // use static query defined in module file
-    retcode_ = SQL_EXEC_Fetch(desc_, NULL, 5,
-#else // NA_USTAT_USE_STATIC not defined, use dynamic query
     retcode_ = SQL_EXEC_Fetch(cursor106_->getStmt(), cursor106_->getOutDesc(), 5,
-#endif // NA_USTAT_USE_STATIC not defined
                               (void *)(&statTime),   NULL, 
                               (void *)(&colNumber),  NULL,
                               (void *)(&readTime),   NULL,// for read
@@ -459,8 +399,7 @@
       const NAColumn *nacol = colArray.getColumnByPos(colNumber);
       // Only update READ_TIME if column is requested.
       if (nacol && 
-          nacol->needFullHistogram() && 
-          HSGlobalsClass::schemaVersion >= COM_VERS_2300
+          nacol->needFullHistogram()
           )
       {
         // Update the READ_TIME and READ_COUNT.
@@ -1315,8 +1254,7 @@
               LM->Log("\nFetchHistograms: Unable to get table schema version.");
               return -1;
             }
-          if (HSGlobalsClass::schemaVersion >= COM_VERS_2300) 
-            HSGlobalsClass::autoInterval = CmpCommon::getDefaultLong(USTAT_AUTOMATION_INTERVAL);
+          HSGlobalsClass::autoInterval = CmpCommon::getDefaultLong(USTAT_AUTOMATION_INTERVAL);
           if (LM->LogNeeded())
            {
              sprintf(LM->msg, "\nFetchHistograms: TABLE: %s; SCHEMA VERSION: %d; AUTOMATION INTERVAL: %d\n", 
@@ -1720,7 +1658,7 @@
   fakeRowCount = correctedRowCount_;
   TotalHistogramDBG += numHistograms;
 
-  if (updateReadTime && HSGlobalsClass::schemaVersion >= COM_VERS_2300)
+  if (updateReadTime)
   {
     // Update requested histograms' READ_TIME and READ_COUNT entries using mechanism
     // employed by FetchStatsTime().
@@ -1746,14 +1684,8 @@
 
   SQL_EXEC_ClearDiagnostics(desc_);
 
-  // histogram versioning
-  if (HSGlobalsClass::schemaVersion >= COM_VERS_2300) 
-    // CURSOR101_MX_2300
-#ifdef NA_USTAT_USE_STATIC  // use static query defined in module file
-    retcode_ = SQL_EXEC_Fetch(desc_, NULL, 18,
-#else // NA_USTAT_USE_STATIC not defined, use dynamic query
-    retcode_ = SQL_EXEC_Fetch(cursor101_->getStmt(), cursor101_->getOutDesc(), 18,
-#endif // NA_USTAT_USE_STATIC not defined
+  retcode_ = SQL_EXEC_Fetch(cursor101_->getStmt(), 
+                            cursor101_->getOutDesc(), 18,
                             (void *)&histid_, NULL,
                             (void *)&tableColNum_, NULL,
                             (void *)&colCount_, NULL,
@@ -1778,17 +1710,6 @@
                             //(void *)buf3_, NULL,
                             //(void *)buf4_, NULL
                             );
-  else
-    retcode_ = SQL_EXEC_Fetch(desc_, NULL, 9,
-                            (void *)&histid_, NULL,
-                            (void *)&tableColNum_, NULL,
-                            (void *)&colCount_, NULL,
-                            (void *)&intCount_, NULL,
-                            (void *)&tempRowCount, NULL,
-                            (void *)&tempUEC, NULL,
-                            (void *)&statsTime_, NULL,
-                            (void *)buf1_, NULL,
-                            (void *)buf2_, NULL);
 
   if (retcode_ < 0)
     {
@@ -1836,44 +1757,6 @@
   return 0;
 }
 
-#ifdef NA_USTAT_USE_STATIC  // use static query defined in module file
-Lng32 HSHistogrmCursor::open()
-{
-  if (!validCursor_)
-    return -1;
-
-  HSTranMan *TM = HSTranMan::Instance();
-
-  // Assign appropriate query depending on table type and schema version.
-  NAString stmt;
-  //As of APR2003, USTAT produces bad UECs for multi-column histograms. We
-  //need to have the flexibility to use them or not.
-  if (CmpCommon::getDefault(HIST_MC_STATS_NEEDED) == DF_ON)
-    {
-      if (fileType_ == SQLMP)   stmt = "CURSOR101_MP";
-      else
-        if (HSGlobalsClass::schemaVersion >= COM_VERS_2300) 
-                                stmt = "CURSOR101_MX_2300";
-        else                    stmt = "CURSOR101_MX";
-    }
-  else
-    {
-      if (fileType_ == SQLMP)   stmt = "CURSOR101_NOMC_MP";
-      else
-        if (HSGlobalsClass::schemaVersion >= COM_VERS_2300) 
-              stmt = "CURSOR101_NOMC_MX_2300";
-        else stmt = "CURSOR101_NOMC_MX";
-    }
-
-  return OpenCursor( stmt
-                    , (void *)histogramTableName_
-                    , (void *)&tableUID_
-                    , desc_
-                    );
-}
-
-#else // NA_USTAT_USE_STATIC not defined, use dynamic query
-
 Lng32 HSHistogrmCursor::open()
 {
   char sbuf[25];
@@ -1904,7 +1787,6 @@
   HSHandleError(retcode);
   return retcode;
 }
-#endif // NA_USTAT_USE_STATIC not defined
 
 
 /******************************************************************************/
@@ -1915,87 +1797,6 @@
 /* RETCODE    Success: (0)                                                    */
 /*                                                                            */
 /******************************************************************************/
-#ifdef NA_USTAT_USE_STATIC  // use static query defined in module file
-
-Lng32 updateHistogram(const char *histogramTableName, Int32 stmtNum, short readCount)
-{
-  HSLogMan           *LM = HSLogMan::Instance();
-  static SQLMODULE_ID module;
-  static char         moduleName[HS_MODULE_LENGTH] = {'\0'};
-  static Int32          moduleNum = 0;
-  static SQLSTMT_ID   update_stmt;               // for update statement
-  static SQLDESC_ID   desc_ivar;                 // input descriptor
-  const char         *stmt, *ivar_stmt;
-  Lng32                retcode;
-  
-  if (stmtNum != moduleNum)
-    {
-      if (stmtNum == 104) {
-        stmt      = "UPD104_MX_2300";
-        ivar_stmt = "UPD104_MX_2300_IVAR";
-      } else if (stmtNum == 106) {
-        stmt      = "UPD106_MX_2300";
-        ivar_stmt = "UPD106_MX_2300_IVAR";
-      } else return -1;
-      init_SQLMODULE_ID(&module);
-      strncpy(moduleName, HS_MODULE, HS_MODULE_LENGTH);
-  
-      module.module_name = (char *)moduleName;
-      module.module_name_len = strlen((char*)moduleName);
-      module.creation_timestamp = 1234567890;
-      moduleNum = stmtNum;
-
-      // descriptor for update
-      init_SQLCLI_OBJ_ID(&update_stmt);
-      update_stmt.name_mode = stmt_name;
-      update_stmt.module = &module;
-      update_stmt.handle = 0;
-      update_stmt.identifier = stmt;
-      update_stmt.identifier_len = strlen(stmt);
-
-      // descriptor for input variable
-      init_SQLCLI_OBJ_ID(&desc_ivar);
-      desc_ivar.name_mode = desc_name;
-      desc_ivar.module = &module;
-      desc_ivar.handle = 0;
-      desc_ivar.identifier = ivar_stmt;
-      desc_ivar.identifier_len = strlen(ivar_stmt);
-    }
-
-  char time_str[HS_TIMESTAMP_SIZE];
-  hs_formatTimestamp(time_str);                                 // current time
-
-  retcode = SQL_EXEC_ClearExecFetchClose(
-                           &update_stmt,                        // statement_id
-                           &desc_ivar,                          // input descriptor
-                           NULL,                                // output descriptor
-                           3,                                   // input ptr_pairs
-                           0,                                   // output ptr_pairs
-                           3,                                   // total ptr_pairs
-                           (void *) histogramTableName, NULL,
-                           (void *) time_str, NULL,
-                           (void *) &readCount, NULL);
-
-  HSFilterWarning(retcode);
-  if (retcode < 0)
-    HSFuncMergeDiags(-UERR_INTERNAL_ERROR, "Update Histogram's READ_TIME", NULL, TRUE);
-
-  if (LM->LogNeeded())
-  {
-    if (retcode)
-      {
-        sprintf(LM->msg, "updateHistogram: ***[FAIL=%d]Unable to update read count/time", retcode);
-      }
-    else
-      {
-        sprintf(LM->msg, "updateHistogram: READ_COUNT/TIME updated; %d, %s", readCount, time_str);
-      }
-    LM->Log(LM->msg);
-  }
-  return (retcode);
-}
-
-#else // NA_USTAT_USE_STATIC not defined, use dynamic query
 Lng32 updateHistogram(const char *histogramTableName, Int32 stmtNum, short readCount)
 {
   HSLogMan* LM = HSLogMan::Instance();
@@ -2030,8 +1831,6 @@
   return (retcode);
 }
 
-#endif // NA_USTAT_USE_STATIC not defined
-
 // -----------------------------------------------------------------------
 // Constructor and destructor for the second cursor.
 // -----------------------------------------------------------------------
@@ -2101,36 +1900,6 @@
   delete cursor201_;
 }
 
-#ifdef NA_USTAT_USE_STATIC  // use static query defined in module file
-
-Lng32 HSHistintsCursor::open()
-{
-  if (!validCursor_)
-    return -1;
-
-  NAString stmt;
-  if (fileType_ == SQLMP)
-    stmt = "CURSOR201_MP"; 
-  else
-    // histogram versioning
-    if (HSGlobalsClass::schemaVersion >= COM_VERS_2300) 
-      stmt = "CURSOR201_MX_2300";
-    else 
-      stmt = "CURSOR201_MX";
-
-  Lng32 retcode = OpenCursor( stmt
-                            , (void *)histintsTableName_
-                            , (void *)&tableUID_
-                            , desc_
-                            );
-  if (retcode)
-    return retcode;
-  get(0, 0);  // skip first row
-  return 0;
-}
-
-#else // NA_USTAT_USE_STATIC not defined, use dynamic query
-
 Lng32 HSHistintsCursor::open()
 {
   char sbuf[25];
@@ -2155,8 +1924,6 @@
   return retcode;
 }
 
-#endif // NA_USTAT_USE_STATIC not defined
-
 // -----------------------------------------------------------------------
 // Fetch interval rows and set the ColStats object.
 //
@@ -2252,13 +2019,8 @@
       intNum_++;
       SQL_EXEC_ClearDiagnostics(desc_);
 
-      // histogram versioning
-      if (HSGlobalsClass::schemaVersion >= COM_VERS_2300) 
-#ifdef NA_USTAT_USE_STATIC  // use static query defined in module file
-        retcode_ =  SQL_EXEC_Fetch(desc_, NULL, 9,
-#else // NA_USTAT_USE_STATIC not defined, use dynamic query
-        retcode_ = SQL_EXEC_Fetch(cursor201_->getStmt(), cursor201_->getOutDesc(), 9,
-#endif // NA_USTAT_USE_STATIC not defined
+      retcode_ = SQL_EXEC_Fetch(cursor201_->getStmt(), 
+                                 cursor201_->getOutDesc(), 9,
                                  (void *)&histid_, NULL,
                                  (void *)&short1_, NULL,
                                  (void *)&tempIntRowCount, NULL,
@@ -2273,13 +2035,7 @@
                                  (void *)buf_mfv_, NULL
                                  //(void *)buf_v6_, NULL
                                  );
-      else 
-        retcode_ =  SQL_EXEC_Fetch(desc_, NULL, 5,
-                                 (void *)&histid_, NULL,
-                                 (void *)&short1_, NULL,
-                                 (void *)&tempIntRowCount, NULL,
-                                 (void *)&tempIntUec, NULL,
-                                 (void *)buf_, NULL);
+
       if (retcode_ && retcode_ != HS_EOF)
         HSLogError(retcode_);
       if (retcode_)
diff --git a/core/sql/ustat/hs_update.cpp b/core/sql/ustat/hs_update.cpp
index ca946df..7dd075c 100644
--- a/core/sql/ustat/hs_update.cpp
+++ b/core/sql/ustat/hs_update.cpp
@@ -511,35 +511,6 @@
 
     hs_globals_y = NULL;
 
-    // Remove IUS persistent sample if necessary.
-    //@ZXhbase -- need to make sure seabase.seabase.persistent_samples exists, and
-    //            provide dynamic version of CURSOR_PST_REASON_CODE.
-#ifdef NA_USTAT_USE_STATIC  // use static query defined in module file
-    if (statsWritten)
-      {
-        // The update has completed successfully. If it was neither a persistent
-        // (i.e., using the PERSISTENT keyword) RUS nor an IUS, drop the target
-        // table's IUS persistent sample if it exists, and remove the corresponding
-        // row from the PERSISTENT_SAMPLES table.
-        HSGlobalsClass* hs_globals = GetHSContext();
-        if (!(hs_globals->optFlags & IUS_PERSIST ||
-              (hs_globals->okToPerformIUS() &&
-               hs_globals->wherePredicateSpecifiedForIUS())))
-          {
-            Int64 dummy1, dummy2;
-            double dummy3;
-            HSPersSamples* ps =
-                  HSPersSamples::Instance(hs_globals->objDef->getCatName(), FALSE);
-            NAString IUSSampTblName;
-            retcode = ps->find(hs_globals->objDef, char('I'), IUSSampTblName,
-                               dummy1, dummy2, dummy3);
-            if (retcode >= 0 && IUSSampTblName.length() > 0)
-              ps->removeSample(hs_globals->objDef, IUSSampTblName, TRUE,
-                               "DROP IUS PERSISTENT SAMPLE TABLE AND REMOVE FROM LIST");
-          }
-      }
-#endif
-
     // Reset CQDs set above; ignore errors
     HSFuncExecQuery("CONTROL QUERY DEFAULT TRAF_BLOB_AS_VARCHAR RESET");
     HSFuncExecQuery("CONTROL QUERY DEFAULT TRAF_CLOB_AS_VARCHAR RESET");
diff --git a/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc b/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
index 42b8509..f295205 100644
--- a/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
+++ b/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
@@ -2919,3 +2919,17 @@
 
 *Recovery:* See message.
 
+[[SQL-4497]]
+== SQL 4497
+
+```
+The <number> operand of builtin-func <name> must be <data type>.
+
+```
+
+*Cause:* You attempted to use an invalid type for the given operand of the given function.
+
+*Effect:* The operation fails.
+
+*Recovery:* Correct the syntax and resubmit.
+
diff --git a/docs/messages_guide/src/asciidoc/_chapters/executor_msgs.adoc b/docs/messages_guide/src/asciidoc/_chapters/executor_msgs.adoc
index 06403c7..71b34ff 100644
--- a/docs/messages_guide/src/asciidoc/_chapters/executor_msgs.adoc
+++ b/docs/messages_guide/src/asciidoc/_chapters/executor_msgs.adoc
@@ -464,6 +464,19 @@
 commit or rollback. {project-name} must start any transactions it will later commit or rollback.
 
 <<<
+[[SQL-8691]]                                                                                    
+== SQL 8691
+```
+Field position must be great than zero.
+```
+
+*Cause:* You attempted to use an invalid value for the third operand of the split_part function.
+
+*Effect:* The operation fails.
+
+*Recovery:* Correct the syntax and resubmit.
+
+<<<
 [[SQL-8808]]
 == SQL 8808
 
diff --git a/docs/sql_reference/src/asciidoc/_chapters/introduction.adoc b/docs/sql_reference/src/asciidoc/_chapters/introduction.adoc
index 4434227..3779177 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/introduction.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/introduction.adoc
@@ -260,35 +260,103 @@
 

 

 <<<

-[[type_mapping_from_hive_to_trafodion_sql]]

-=== Type Mapping From Hive to {project-name} SQL

+[[data_type_mapping_from_hive_to_trafodion_sql]]

+=== Data Type Mapping From Hive to {project-name} SQL

 

-{project-name} performs the following data-type mappings:

+{project-name} performs the following data-type mappings.

 

-[cols="2*",options="header"]

+[[numeric_data_type_mapping_from_hive_to_trafodion]]

+==== Numeric Data Type Mapping From Hive to Trafodion

+

+[cols="6*^.^",options="header"]

 |===

-| Hive Type             | {project-name} SQL Type

-| `tinyint`             | `tinyint`

-| `tinyint`             | `smallint`

-| `smallint`            | `smallint`

-| `int`                 | `int`

-| `bigint`              | `largeint`

+6+| +++<u>Numeric</u>+++ Data Type Mapping From Hive to Trafodion

+3+| *Hive ^1^* 3+| *Trafodion*

+| Data Type | Range | Byte(s) | Data Type | Range | Byte(s)

+| tinyint + 

+(signed) | -128 ~ +127 | 1 | tinyint +

+(signed) | -128 ~ +127 | 1

+| smallint +

+(signed) | -32,768 ~ +32,767 |	2	| smallint +

+(signed)	| -32,768 ~ +32,767	| 2

+| int +

+(signed) | -2,147,483,648 ~ +2,147,483,647	| 4	| int +

+(signed) |	-2,147,483,648 ~ +2,147,483,647	| 4

+| bigint +

+(signed) |	-9,223,372,036,854,775,808 ~ +9,223,372,036,854,775,807	| 8 |	largeint +

+(signed)	| -9,223,372,036,854,775,808 ~ +9,223,372,036,854,775,807	| 8

+|===

+

+1. Hive supports *only signed numeric data types*. +

+For more information about numeric data type for Hive and Trafodion, see the table below.

+

+[cols="6*^.^",options="header"]

+|===

+6+| Comparison of Numeric Data Type between Hive and Trafodion

+3+| *Hive* 3+| *Trafodion*

+| Data Type | Range | Byte(s) | Data Type | Range | Byte(s)

+| tinyint +

+(signed) | -128 ~ +127 | 1 | tinyint +

+(signed) | -128 ~ +127 .2+| 1

+.2+| smallint +

+(signed) .2+| -32,768 ~ +32,767 .2+| 2 | tinyint +

+(unsigned) | 0 ~ 255 | smallint +

+(signed)	| -32,768 ~ +32,767	.2+| 2

+.2+| int +

+(signed) .2+| -2,147,483,648 ~ +2,147,483,647	.2+| 4	| smallint +

+(unsigned) | 0 ~ 65,535 | int +

+(signed) |	-2,147,483,648 ~ +2,147,483,647	.2+| 4

+.2+| bigint +

+(signed) .2+| -9,223,372,036,854,775,808 ~ +9,223,372,036,854,775,807 .2+| 8 | int +

+(unsigned)	| 0 ~ 4,294,967,295 | largeint +

+(signed)	| -9,223,372,036,854,775,808 ~ +9,223,372,036,854,775,807	.2+| 8

+| / | / | / | largeint +

+(unsigned)	| 0 ~ 18,446,744,073,709,551,615

+|===

+

+[[character_string_data_type_mapping_from_hive_to_trafodion]]

+==== Character String Data Type Mapping From Hive to Trafodion

+

+[cols="2*^.^",options="header"]

+|===

+2+| +++<u>Character String</u>+++ Data Type Mapping From Hive to Trafodion

+| *Hive*                | *Trafodion*

 | `string`              | `varchar(_n_ bytes) character set utf8`^1^

 | `varchar`             | `varchar`

 | `char`                | `char`

-| `float`               | `real`

-| `decimal (precision, scale)`                | `decimal (precision, scale)`^2^ +

-`numeric (precision, scale)`^3^

-| `double`              | `float(54)`

-| `timestamp`           | `timestamp(6)`^4^

-| `date`                | `date`

 |===

 

 1. The value `_n_` is determined by `CQD HIVE_MAX_STRING_LENGTH`. See the

 {docs-url}/cqd_reference/index.hmtl[{project-name} Control Query Default (CQD) Reference Guide].

-2. If p is less than or equal to 18, decimal (precision, scale) is mapped to decimal (precision, scale).

-3. If p is greater than 18, decimal (precision, scale) is mapped to numeric (precision, scale).

-4. Hive supports timestamps with nanosecond resolution (precision of 9). {project-name} SQL supports only microsecond resolution (precision 6).

+

+[[numeric_data_type_mapping_from_hive_to_trafodion]]

+==== Numeric Data Type Mapping From Hive to Trafodion

+

+[cols="2*^.^",options="header"]

+|===

+2+| +++<u>Numeric</u>+++ Data Type Mapping From Hive to Trafodion

+| *Hive*                | *Trafodion*

+| `float`               | `real`

+| `decimal (precision, scale)`                | `decimal (precision, scale)`^1^ +

+`numeric (precision, scale)`^2^

+| `double`              | `float`

+|===

+

+1. If p is less than or equal to 18, decimal (precision, scale) is mapped to decimal (precision, scale).

+2. If p is greater than 18, decimal (precision, scale) is mapped to numeric (precision, scale).

+

+[[datetime_data_type_mapping_from_hive_to_trafodion]]

+==== Datetime Data Type Mapping From Hive to Trafodion

+

+[cols="2*^.^",options="header"]

+|===

+2+| +++<u>Datetime</u>+++ Data Type Mapping From Hive to Trafodion

+| *Hive*                | *Trafodion*

+| `timestamp`           | `timestamp(6)`^1^

+| `date`                | `date`

+|===

+

+1. Hive supports timestamps with nanosecond resolution (precision of 9). {project-name} SQL supports only microsecond resolution (precision 6).

 

 [[supported_sql_statements_with_hive_tables]]

 === Supported SQL Statements With Hive Tables

diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
index f84eec0..b1bed39 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
@@ -8267,10 +8267,10 @@
 STDDEV is evaluated after eliminating all nulls from the set. If the
 result table is empty, STDDEV returns NULL.
 
-[[float54_and_double_precision_data]]
-==== FLOAT(54) and DOUBLE PRECISION Data
+[[float52_and_double_precision_data]]
+==== FLOAT(52) and DOUBLE PRECISION Data
 
-Avoid using large FLOAT(54) or DOUBLE PRECISION values as arguments to
+Avoid using large FLOAT(52) or DOUBLE PRECISION values as arguments to
 STDDEV. If SUM(x * x) exceeds the value of 1.15792089237316192e77 during the computation
 of STDDEV(x), a numeric overflow occurs.
 
@@ -9926,10 +9926,10 @@
 result table is empty, VARIANCE returns NULL.
 
 
-[[float54_and_double_precision_data]]
-==== FLOAT(54) and DOUBLE PRECISION Data
+[[float52_and_double_precision_data]]
+==== FLOAT(52) and DOUBLE PRECISION Data
 
-Avoid using large FLOAT(54) or DOUBLE PRECISION values as arguments to
+Avoid using large FLOAT(52) or DOUBLE PRECISION values as arguments to
 VARIANCE. If SUM(x * x) exceeds the value of 1.15792089237316192e77 during
 the computation of VARIANCE(x), then a numeric overflow occurs.
 
diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc
index 2704107..7e8bd63 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc
@@ -324,15 +324,15 @@
 

 [cols="14%,14%,24%,24%,24%",options="header"]

 |===

-| Category | Type | SQL Designation | Description | Size or Range^1^

-.8+| Character String Data Type .3+| Fixed-length character | CHAR[ACTER]          | Fixed-length character data            | 1 to 200000 characters^2^ ^8^

-| NCHAR                | Fixed-length character data in predefined national character set | 1 to 200000 bytes^3^ ^7^ ^9^

-| NATIONAL CHAR[ACTER] | Fixed-length character data in predefined national character set | 1 to 200000 bytes^3^ ^7^ ^9^

-.5+| Variable-length character | VARCHAR                      | Variable-length ASCII character string | 1 to 200000 characters^4^ ^8^

-| VARCHAR2                     | Variable-length ASCII character string | 1 to 200000 characters^4^ ^8^

-| CHAR[ACTER] VARYING          | Variable-length ASCII character string | 1 to 200000 characters^4^ ^8^

-| NCHAR VARYING                | Variable-length ASCII character string | 1 to 200000 bytes^4^ ^7^ ^9^

-| NATIONAL CHAR[ACTER] VARYING | Variable-length ASCII character string | 1 to 200000 characters^4^ ^7^ ^8^

+^| *Category* ^| *Type* ^| *SQL Designation* ^| *Description* ^| *Size or Range*^1^

+.8+| Character String Data Type .3+| Fixed-length character | CHAR[ACTER]          | Fixed-length character data            | 1 to 16,777,216 bytes ^2^

+| NCHAR                | Fixed-length character data in predefined national character set | 1 to 16,777,216 bytes^2^ ^3^ 

+| NATIONAL CHAR[ACTER] | Fixed-length character data in predefined national character set | 1 to 16,777,216 bytes^2^ ^3^

+.5+| Variable-length character | VARCHAR                      | Variable-length ASCII character string | 1 to 16,777,216 bytes^2^ ^4^

+| VARCHAR2                     | Variable-length ASCII character string | 1 to 16,777,216 bytes^2^ ^4^

+| CHAR[ACTER] VARYING          | Variable-length ASCII character string | 1 to 16,777,216 bytes^2^ ^4^

+| NCHAR VARYING                | Variable-length ASCII character string | 1 to 16,777,216 bytes^2^ ^3^ ^4^

+| NATIONAL CHAR[ACTER] VARYING | Variable-length ASCII character string | 1 to 16,777,216 bytes^2^ ^3^ ^4^

 .6+| Datetime Data Types .6+| Date-Time | | Point in time, using the Gregorian calendar and a 24 hour clock system. The five supported designations are listed below.

 | YEAR 0001-9999 +

 MONTH 1-12 +

@@ -372,7 +372,7 @@
 .2+| LOB Data Types .2+| LOB | BLOB | Binary Large Object .2+| 10G – no limit + 

 Currently the limit defaults to 10G. This limit can be configured as needed using the CQD `LOB_MAX_SIZE`.

 | CLOB | Character Large Object 

-.10+| Numeric Data Types .5+| Numeric | NUMERIC (1,_scale_) to + NUMERIC (128,_scale_) | Binary number with optional scale; signed or unsigned for 1 to 9 digits

+.10+| Numeric Data Types .5+| Numeric^6^ ^7^ | NUMERIC (1,_scale_) to + NUMERIC (128,_scale_) | Binary number with optional scale; signed or unsigned for 1 to 9 digits

 | 1 to 128 digits; +

 stored: +

 1 to 4 digits in 2 bytes +

@@ -383,34 +383,33 @@
 | SMALLINT                      | Binary integer; signed or unsigned    | 0 to 65535 unsigned, -32768 to +32767 signed; stored in 2 bytes

 | INTEGER                       | Binary integer; signed or unsigned    | 0 to 4294967295 unsigned, -2147483648 to +2147483647 signed; stored in 4 bytes

 | LARGEINT                      | Binary integer; signed only           | -2^63^ to +(2^63^)-1; stored in 8 bytes

-|Numeric (extended numeric precision) | NUMERIC (precision 19 to 128)  | Binary integer; signed or unsigned    | Stored as multiple chunks of 16-bit integers, with a minimum storage

+|Numeric (extended numeric precision)^7^ | NUMERIC (precision 19 to 128)  | Binary integer; signed or unsigned    | Stored as multiple chunks of 16-bit integers, with a minimum storage

 length of 8 bytes.

-.3+| Floating point number | FLOAT[(_precision_)] | Floating point number; precision designates from 1 through 52 bits of precision | +/- 2.2250738585072014e-308 through +/-1.7976931348623157e+308; stored in 8 bytes

+.3+| Floating point number^7^ | FLOAT[(_precision_)] | Floating point number (64 bits); precision designates from 1 through 52 bits of precision | +/- 2.2250738585072014e-308 through +/-1.7976931348623157e+308; stored in 8 bytes

 | REAL                  | Floating point number (32 bits)        | +/- 1.17549435e-38 through +/ 3.40282347e+38; stored in 4 bytes

 | DOUBLE PRECISION      | Floating-point numbers (64 bits) with 1 through 52 bits of precision (52 bits of binary precision and 1 bits of exponent) | +/- 2.2250738585072014e-308 through +/-1.7976931348623157e+308; stored in 8 bytes

-| Decimal number        | DECIMAL (1,_scale_) to DECIMAL (18,_scale_)     | Decimal number with optional scale; stored as ASCII characters; signed or unsigned for 1 to 9 digits; signed required for 10 or more digits

+| Decimal number^6^        | DECIMAL (1,_scale_) to DECIMAL (18,_scale_)     | Decimal number with optional scale; stored as ASCII characters; signed or unsigned for 1 to 9 digits; signed required for 10 or more digits

 | 1 to 18 digits. Byte length equals the number of digits. Sign is stored as the first bit of the leftmost byte.

 |===

 

-* _scale_ is the number of digits to the right of the decimal.

-* _precision_ specifies the allowed number of decimal digits.

+TIP:

 

-

-1.  The size of a column that allows null values is 2 bytes larger than the size for the defined data type.

-2.  The maximum row size is 32708 bytes, but the actual row size is less than that because of bytes used by

-null indicators, varchar column length indicators, and actual data encoding.

-3.  Storage size is the same as that required by CHAR data type but store only half as many characters depending

-on character set selection.

-4.  Storage size is reduced by 4 bytes for storage of the varying character length.

-5.  The maximum number of digits in an INTERVAL value is 18, including the digits in all INTERVAL fields of the value.

+1. The size of a column that allows null values is 2 bytes larger than the size for the defined data type.

+2. The maximum number of characters depends on the character set. 

++

+[cols="2*",options="header"]

+|===

+^| *Character Set* ^|	*Maximum Number of Characters* 

+| For 8-bit character sets such as *ISO88591*	    | Equal to the maximum storage size in bytes, that is 16,777,216, which is divided 16,777,216 by 1

+| For 16-bit character sets such as *UCS2*	      | Half the maximum storage size in bytes, that is 8,388,608, which is divided 16,777,216 by 2

+| For 32-bit character sets such as *UTF8*        | One fourth the maximum storage size in bytes, that is 4,194,304, which is divided 16,777,216 by 4

+|===

+3. NCHAR or NATIONAL CHAR implicitly assumes that the character set is UCS2, whether the character set was specified at installation time to be ISO88591 or UTF8, and the character set (UCS2) cannot be specified or altered. This is true for both CREATE and ALTER statement.

+4. Storage size is reduced by 4 bytes for storage of the varying character length field.

+5. The maximum number of digits in an INTERVAL value is 18, including the digits in all INTERVAL fields of the value.

 Any INTERVAL field that is a starting field can have up to 18 digits minus the number of other digits in the INTERVAL value.

-6.  The maximum is 32707 if the national character set was specified at installation time to be ISO88591.

-The maximum is 16353 if the national character set was specified at installation time as UTF8.

-7.  The maximum is 32703 if the national character set was specified at installation time to be ISO88591.

-The maximum is 16351 if the national character set was specified at installation time as UTF8.

-8.  It defaults to 200000 characters and can be declared explicitly by using the TRAF_MAX_CHARACTER_COL_LENGTH CQD.

-9.  It defaults to 200000 bytes and can be declared explicitly by using the TRAF_MAX_CHARACTER_COL_LENGTH CQD.

-

+6. _scale_ is the number of digits to the right of the decimal.

+7. _precision_ specifies the allowed number of decimal digits.

 

 <<<

 [[comparable_and_compatible_data_types]]

@@ -1053,12 +1052,12 @@
 +

 specifies an approximate numeric column. The column stores

 floating-point numbers and

-designates from 1 through 54 bits of _precision_.

+designates from 1 through 52 bits of _precision_.

 The range is from +/- 2.2250738585072014e-308 through +/-1.7976931348623157e+308 stored in 8 bytes.

 +

 An IEEE FLOAT _precision_ data type is stored as an IEEE DOUBLE, that is, in 8 bytes, with the specified precision.

 +

-The default _precision_ is 54.

+The default _precision_ is 52.

 

 * `REAL`

 +

diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc
index 9abd7a7..cc6d17f 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc
@@ -390,25 +390,27 @@
 

 column-definition is:

    column-name data-type

-      ([DEFAULT default]

-         [[constraint constraint-name] column-constraint])

+      [[DEFAULT default]

+         [[constraint constraint-name] column-constraint]]

 

 data-type is:

-     char[acter] [(length)[characters]]

-         [CHARACTER SET char-set-name]

-         [UPSHIFT] [[not] casespecific]

-   | char[acter] varying (length)

-         [character set char-set-name]

-         [upshift] [[not] casespecific]

-   | varchar (length) [character set char-set-name]

-         [upshift] [[not] casespecific]

-   | varchar2 (length) [character set char-set-name]

-         [upshift] [[not] casespecific]         

+     char[acter] [(length [characters])]

+                 [CHARACTER SET char-set-name]

+                 [UPSHIFT] [[NOT] CASESPECIFIC]

+   | char[acter] varying (length [characters])

+                         [CHARACTER SET char-set-name]

+                         [UPSHIFT] [[NOT] CASESPECIFIC]

+   | varchar (length [characters]) 

+             [CHARACTER SET char-set-name]

+             [UPSHIFT] [[NOT] CASESPECIFIC]

+   | varchar2 (length [characters]) 

+              [CHARACTER SET char-set-name]

+              [UPSHIFT] [[NOT] CASESPECIFIC]         

+   | nchar [(length [characters])]

+           [UPSHIFT] [[NOT] CASESPECIFIC] 

+   | nchar varying (length [characters]) 

+                   [UPSHIFT] [[NOT] CASESPECIFIC]

    | numeric [(precision [,scale])] [signed|unsigned]

-   | nchar [(length) [character set char-set-name]

-         [upshift] [[not] casespecific]

-   | nchar varying(length) [character set char-set-name]

-         [upshift] [[not] casespecific]

    | smallint [signed|unsigned]

    | int[eger] [signed|unsigned]

    | largeint

@@ -428,7 +430,7 @@
    | null

    | currentdate

    | currenttime

-   | currenttimestamp }

+   | currenttimestamp 

 

 column-constraint is:

      not null

@@ -756,6 +758,88 @@
 ALTER COLUMN vend_id RENAME TO cstm_id;

 ```

 

+* NATIONAL CHAR (or NCHAR) is a short-hand for CHARACTER SET UCS2, so it is not possible to alter the CHARACTER SET when using NCHAR, 

+as the following example shows.

+

++

+NOTE: NCHAR or NATIONAL CHAR implicitly assumes that the character set is *UCS2*, 

+whether the character set was specified at installation time to be ISO88591 or UTF8, 

+and the character set (*UCS2*) of NCHAR or NATIONAL CHAR *cannot be specified* or *altered*. 

+This is true for both *ALTER* and *CREATE* statement.

+

++

+```

+SQL>CREATE TABLE test1 (c1 nchar);

+

+--- SQL operation complete.

+

+

+SQL>SHOWDDL test1;

+ 

+CREATE TABLE TRAFODION.SEABASE.TEST1

+  ( 

+    C1                               CHAR(1) CHARACTER SET UCS2 COLLATE DEFAULT

+      DEFAULT NULL NOT SERIALIZED

+  )

+ ATTRIBUTES ALIGNED FORMAT 

+;

+ 

+-- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON TRAFODION.SEABASE.TEST1 TO DB__ROOT WITH GRANT OPTION;

+

+--- SQL operation complete.

+

+

+SQL>ALTER TABLE test1 ALTER COLUMN c1 NCHAR CHARACTER SET ISO88591;

+

+*** ERROR[15001] A syntax error occurred at or before: 

+alter table test1 alter column c1 nchar character set iso88591;

+                                              ^ (47 characters from start of SQL statement) [2018-07-13 10:24:12]

+```

+

+* This example shows how to alter the data type of NCHAR column _c1_.

+

++

+```

+SQL>CREATE TABLE test1 (c1 nchar);

+

+--- SQL operation complete.

+

+

+SQL>SHOWDDL test1;

+

+CREATE TABLE TRAFODION.SEABASE.TEST1

+  (

+    C1                               CHAR(1) CHARACTER SET UCS2 COLLATE DEFAULT

+      DEFAULT NULL NOT SERIALIZED

+  )

+ ATTRIBUTES ALIGNED FORMAT

+;

+

+-- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON TRAFODION.SEABASE.TEST1 TO DB__ROOT WITH GRANT OPTION;

+

+--- SQL operation complete.

+

+

+SQL>ALTER TABLE test1 ALTER COLUMN c1 varchar(10) CHARACTER SET ISO88591;

+

+--- SQL operation complete.

+

+

+SQL>SHOWDDL test1;

+

+CREATE TABLE TRAFODION.SEABASE.TEST1

+  ( 

+    C1                               VARCHAR(10) CHARACTER SET ISO88591 COLLATE

+      DEFAULT DEFAULT NULL NOT SERIALIZED /*altered_col*/

+  )

+ ATTRIBUTES ALIGNED FORMAT 

+;

+ 

+-- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON TRAFODION.SEABASE.TEST1 TO DB__ROOT WITH GRANT OPTION;

+

+--- SQL operation complete.

+```

+

 * The following table _orders_ has two non-unique indexes 

 (_index_orders1_ and _index_orders2_) and 

 two unique indexes (_unique_index_orders1_ and _unique_index_orders2_).

@@ -2910,9 +2994,9 @@
 START WITH        1

 INCREMENT BY      1

 MAXVALUE          10000   

-NOCYCLE

+NO CYCLE

 CACHE             20  

-UNSIGNED SMALLINT

+SMALLINT UNSIGNED 

 ```

 

 The first reference to `seqnum(empolyee_seq, next)` will return 10000, and the second reference will return 10001. Each subsequent reference will return a value 1 greater than the previous value.

@@ -2964,17 +3048,21 @@
 ```

 data-type is:

     char[acter] [(length [characters])]

-          [character set char-set-name]

-          [upshift] [[not]casespecific]

+                [character set char-set-name]

+                [upshift] [[not]casespecific]

   | char[acter] varying (length [characters])

-          [character set char-set-name]

+                        [character set char-set-name]

+                        [upshift] [[not]casespecific]

+  | varchar (length [characters]) 

+            [character set char-set-name]

+            [upshift] [[not]casespecific]

+  | varchar2 (length [characters]) 

+             [character set char-set-name]

+             [upshift] [[not]casespecific]          

+  | nchar [(length [characters])]

           [upshift] [[not]casespecific]

-  | varchar (length) [character set char-set-name]

-          [upshift] [[not]casespecific]

-  | varchar2 (length) [character set char-set-name]

-          [upshift] [[not]casespecific]          

-  | nchar (length) [characters] [upshift] [[not]casespecific]

-  | nchar varying(length [characters]) [upshift] [[not] casespecific]

+  | nchar varying (length [characters]) 

+                  [upshift] [[not] casespecific]

   | numeric [(precision [,scale])] [signed|unsigned]

   | smallint [signed|unsigned]

   | int[eger] [signed|unsigned]

@@ -3712,6 +3800,23 @@
 --- SQL operation complete.

 ```

 

+* NATIONAL CHAR (or NCHAR) is a short-hand for CHARACTER SET UCS2. 

+So it is not possible to specify a CHARACTER SET clause when using NCHAR, 

+as the following example shows.

++

+NOTE: NCHAR or NATIONAL CHAR implicitly assumes that the character set is *UCS2*, 

+whether the character set was specified at installation time to be ISO88591 or UTF8, 

+and the character set (UCS2) of NCHAR or NATIONAL CHAR *cannot be specified* or *altered*. 

+This is true for both *CREATE* and *ALTER* statement.

++

+```

+SQL>CREATE TABLE test1 (c1 NCHAR(10) CHARACTER SET USC2);

+

+*** ERROR[15001] A syntax error occurred at or before: 

+create table test1 (c1 nchar(10) character set usc2);

+                                       ^ (40 characters from start of SQL statement) [2018-07-13 04:02:39]

+```

+

 <<<

 [[create_table_examples_create_table_as]]

 ==== Examples of CREATE TABLE AS

@@ -4257,23 +4362,47 @@
 ```

 Searched DELETE is:

 

-DELETE FROM table

-

-    [WHERE search-condition ]

-       [[for] access-option access]

+DELETE 

+[WITH NO ROLLBACK] ["["FIRST N"]"]

+FROM table-name

+[WHERE search-condition ]

+[[for] access-option access]

 

 access-option is:

-    read committed

+read committed

 ```

 

 [[delete_syntax]]

 === Syntax Description of DELETE

 

-* `_table_`

+* `_table-name_`

 +

 names the user table or view from which to delete rows. _table_ must be a base table or an updatable view. To refer to a

 table or view, use the ANSI logical name. See <<database_object_names,Database Object Names>>.

 

+* `WITH NO ROLLBACK`

++

+performs a non-transactional delete.

++

+A non-transactional delete is one that happens outside a transaction. It means that if the 

+statement is interrupted, any deletes that have been done are still permanent.

++

+NOTE: This option is only supported if there is no index on the table.

+

+* `FIRST _N_`

++

+specified that _N_ rows are to be deleted (assuming the table has at least _N_ rows and that

+the qualification criteria specified in the WHERE clause, if any, would select at least _N_ rows).

++

+You must enclose `First _N_` in square bracket ([ ]).

+The quotation marks (" ") around each square brackt in the syntax diagram indicate that 

+the bracket is a required character that you must type as shown (for example, `[FIRST 5]`).

+Do not include quotation marks in the FIRST clause.

++

+NOTE: When using this option without the `WITH NO ROLLBACK` option, and if you have a large 

+_N_ (tens of thousands), break up _N_ into smaller numbers and execute the DELETE statement 

+repeatedly for better performance.

+

 * `WHERE _search-condition_`

 +

 specifies a search condition that selects rows to delete. Within the search condition, any columns being compared are

@@ -4286,7 +4415,7 @@
 specifies the access option required for data used to evaluate the search condition.

 See <<data_consistency_and_access_options,Data Consistency and Access Options>>.

 

-** `READ `COMMITTED

+** `READ COMMITTED`

 +

 specifies that any data used to evaluate the search condition must come from committed  rows.

 +

@@ -4360,6 +4489,45 @@
 delete from table1 where a in (select a from table1 where b > 200)

 ```

 

+* This example executes a non-transactional delete of first 1000 rows that satisfy the

+WHERE condition.

++

+```

+DELETE WITH NO ROLLBACK [FIRST 1000] 

+FROM test 

+WHERE id<30;

+```

+

+* This example shows that the option `WITH NO ROLLBACK` is only supported if there is no

+index on the table.

++

+```

+SQL>DELETE WITH NO ROLLBACK FROM test;

+

+*** ERROR[3232] INSERT, UPDATE, or DELETE of table TRAFODION.SEABASE.TEST with dependent Index : TRAFODION.SEABASE.INDEX_TEST is not allowed when NO ROLLBACK transaction setting is in effect. [2018-05-30 05:42:47]

+

+SQL>SHOWDDL test;

+

+CREATE TABLE TRAFODION.SEABASE.TEST

+  ( 

+    C1                               INT DEFAULT NULL NOT SERIALIZED

+  , C2                               INT DEFAULT NULL NOT SERIALIZED

+  )

+ ATTRIBUTES ALIGNED FORMAT 

+;

+

+CREATE INDEX INDEX_TEST ON TRAFODION.SEABASE.TEST

+  ( 

+    C1 ASC

+  )

+ ATTRIBUTES ALIGNED FORMAT 

+;

+ 

+-- GRANT SELECT, INSERT, DELETE, UPDATE, REFERENCES ON TRAFODION.SEABASE.TEST TO DB__ROOT WITH GRANT OPTION;

+

+--- SQL operation complete.

+```

+

 <<<

 [[drop_function_statement]]

 == DROP FUNCTION Statement

@@ -4377,7 +4545,7 @@
 [[drop_function_syntax]]

 === Syntax Description of DROP FUNCTION

 

-* `_[[catalog-name.]schema-name.]function-name`

+* `_[[catalog-name.]schema-name.]function-name_`

 +

 specifies the ANSI logical name of the function, where each part of the name is a valid sql identifier with a maximum of

 128 characters. specify the name of a function that has already been registered in the schema. if you do not fully qualify

@@ -4615,9 +4783,9 @@
 +

 is an existing role name. The role cannot be dropped if any of the following are true:

 

-* Any privileges are granted to the role.

-* The role is granted to any users.

-* The role owns any schemas.

+** Any privileges are granted to the role.

+** The role is granted to any users.

+** The role owns any schemas.

 

 [[drop_role_considerations]]

 === Considerations for DROP ROLE

@@ -5228,21 +5396,37 @@
 GET option

 

 option is:

-    COMPONENT PRIVILEGES ON component-name [FOR auth-name]

+    CATALOGS

+  | COMPONENT PRIVILEGES ON component-name [FOR auth-name]

   | COMPONENTS

   | FUNCTIONS FOR LIBRARY [[catalog-name.]schema-name.]library-name

   | FUNCTIONS [IN SCHEMA [catalog-name.]schema-name]

+  | HBASE REGISTERED TABLES IN CATALOG TRAFODION

+  | HIVE EXTERNAL TABLES IN CATALOG TRAFODION

+  | HIVE REGISTERED {OBJECTS | SCHEMAS | TABLES | VIEWS} IN CATALOG TRAFODION 

+  | INDEXES [IN SCHEMA schema-name]

+  | INDEXES [ON TABLE table-name]

   | LIBRARIES [IN SCHEMA [catalog-name.]schema-name]

   | PROCEDURES FOR LIBRARY [[catalog-name.]schema-name.]library-name

   | PROCEDURES [IN SCHEMA [catalog-name.]schema-name]

   | ROLES [FOR USER database-username]

+  | SEQUENCES [IN CATALOG catalog-name]

+  | SEQUENCES [IN SCHEMA schema-name}]

   | SCHEMAS [IN CATALOG catalog-name]

   | SCHEMAS FOR [USER | ROLE] authorization-id

+  | TABLES [IN CATALOG catalog-name]

   | TABLES [IN SCHEMA [catalog-name.]schema-name]

+  | TABLES [IN VIEW view-name]

   | USERS [FOR ROLE role-name]

+  | VIEWS [IN CATALOG catalog-name]

   | VIEWS [IN SCHEMA [catalog-name.]schema-name]

+  | VIEWS [IN VIEW view-name]

+  | VIEWS [ON VIEW view-name]

   | VIEWS ON TABLE [[catalog-name.]schema-name.]table-name

-  | PRIVILEGES FOR {USER | ROLE} authorization-id

+  | PRIVILEGES FOR {USER database-username | ROLE role-name}

+  | PRIVILEGES ON SEQUENCE sequence-name

+  | PRIVILEGES ON TABLE table-name

+  | PRIVILEGES ON VIEW view-name

 ```

 

 [[get_syntax]]

@@ -5332,6 +5516,10 @@
 +

 displays the names of all the tables in the specified schema.

 

+* `TABLES [IN VIEW view-name]`

++

+returns tables that referenced by the view _view-name_.

+

 * `USERS`

 +

 displays a list of all the registered database users.

@@ -5351,9 +5539,19 @@
 +

 displays the names of all the views in the specified schema. For the _catalog-name_, you can specify only trafodion.

 

+* `VIEWS [IN VIEW _view-name_]`

++

+returns views that referenced by the view _view-name_.

+

+* `VIEWS [ON VIEW _view-name_]`

++

+returns views that reference the view _view-name_.

+

 * `VIEWS ON TABLE _[[catalog-name.]schema-name.]table-name_`

 +

-displays the names of all the views that were created for the specified table. If you do not qualify the table name with

+returns views that reference the table _table-name_.

++

+If you do not qualify the table name with

 catalog and schema names, get uses the catalog and schema of the current session. For the _catalog-name_, you can specify

 only trafodion.

 

@@ -5433,6 +5631,116 @@
 GET VIEWS ON TABLE T;

 ```

 

+* This example makes comparisons among `GET VIEWS [IN VIEW _view-name_]`, `GET VIEWS [ON VIEW _view-name_]`, `GET VIEWS [ON TABLE _table-name_]`

+and `GET TABLES [IN VIEW _view-name_]`.

++

+Creates the table _t1_.

+

++

+```

+SQL>CREATE TABLE t1 (c1 int);

+

+--- SQL operation complete.

+```

+

++

+Creates the view _v1_ based on the table _t1_.

+

++

+```

+SQL>CREATE VIEW v1 AS SELECT * FROM t1;

+

+--- SQL operation complete.

+```

+

++

+Creates the view _v2_ based on the view _v1_.

+

++

+```

+SQL>CREATE VIEW v2 AS SELECT * FROM v1;

+

+--- SQL operation complete.

+```

+

++

+This statement returns nothing as no views are referenced by _v1_.

+

++

+```

+SQL>GET VIEWS IN VIEW v1;

+

+--- SQL operation complete.

+```

+

++

+This statement returns _v1_ as _v1_ is referenced by _v2_.

+

++

+```

+SQL>GET VIEWS IN VIEW v2;

+

+TRAFODION.SEABASE.V1

+

+--- SQL operation complete.

+```

+

++

+This statement returns _v2_ as _v2_ references _v1_.

+

++

+```

+SQL>GET VIEWS ON VIEW v1;

+

+TRAFODION.SEABASE.V2

+

+--- SQL operation complete.

+```

+

++

+This statement returns nothing as no views reference _v2_.

+

++

+```

+SQL>GET VIEWS ON VIEW v2;

+

+--- SQL operation complete.

+```

+

++

+This statements returns _v1_ as _v1_ references _t1_. 

+

++

+```

+SQL>GET VIEWS ON TABLE t1;

+

+TRAFODION.SEABASE.V1

+

+--- SQL operation complete.

+```

+

++

+This statement returns _t1_ as _t1_ is referenced by _v1_.

+

++

+```

+SQL>GET TABLES IN VIEW v1;

+

+TRAFODION.SEABASE.T1

+

+--- SQL operation complete.

+```

+

++

+This statement returns nothing as no tables are referenced by _v2_.

+

++

+```

+SQL>GET TABLES IN VIEW v2;

+

+--- SQL operation complete.

+```

+

 * This GET statement displays the names of the libraries in the catalog and schema of the current session, which happens to be

 TRAFODION.SEABASE:

 +

@@ -6429,7 +6737,7 @@
 +

 names the user table or view in which to insert rows. _table_ must be a base table or an updatable view.

 

-* `_(target-col-list)_`

+* `_target-col-list_`

 +

 names the columns in the table or view in which to insert values. The data type of each target column must be 

 compatible with the data type of its corresponding source value. Within the list, each target column must

@@ -6441,8 +6749,8 @@
 +

 If you do not specify _target-col-list_, row values from the source table are inserted into all columns in _table_. 

 The order of the column values in the source table must be the same order as that of the columns specified in the 

-CREATE TABLE for _table_. (This order is the same as that of the columns listed in the result table of SHOWDDL

-_table_.)

+CREATE TABLE for _table_. (This order is the same as that of the columns listed in the result table of `SHOWDDL

+table-name`.)

 

 * `_insert-source_`

 +

@@ -6689,9 +6997,9 @@
 === Syntax Description of INVOKE

 

 * `_table-name_`

-_

++

 specifies the name of a table, view, or index for which to generate a record description. 

-See <<database_object_names,Database Object Names>>.

+For more information, see <<database_object_names,Database Object Names>>.

 

 [[invoke_considerations]]

 === Considerations for INVOKE

@@ -7175,12 +7483,11 @@
 [cols="20%,80%"]

 |===

 | DELETE                   | Revokes the ability to use the DELETE statement.

-| EXECUTE                  | Revokes the ability to execute a stored procedure using a CALL statement or revokes the ability

+| EXECUTE                  | Revokes the ability to execute a stored procedure using a CALL statement or revokes the ability to execute a user-defined function (UDF).

 | INSERT     [columm-list] | Revokes the ability to use the INSERT statement.

 | REFERENCES [column-list] | Revokes the ability to create constraints that reference the object.

 | SELECT     [column-list] | Revokes the ability to use the SELECT statement.

 | UPDATE     [column-list] | Revokes the ability to use the UPDATE statement.

-to execute a user-defined function (UDF).

 | USAGE                    | For libraries, revokes the ability to access a library using the 

 CREATE PROCEDURE or CREATE FUNCTION statement.

 For sequence generators, revokes the ability to access a sequence in a SQL query.

@@ -7257,44 +7564,51 @@
 REVOKE SELECT (part_no, part_name), DELETE ON TABLE invent.partloc FROM jsmith, clerks;

 ```

 

-* To revoke a user’s SELECT privileges on a table:

+* To revoke a user’s SELECT privileges on a table.

++

+User administrator grants the SELECT privilege to _JSMITH_.

 +

 ```

--- User administrator grants the SELECT privilege to JSMITH:

 GRANT SELECT ON TABLE invent.partloc TO jsmith WITH GRANT OPTION;

-

--- JSMITH grants the SELECT privilege to AJONES:

+```

++

+_JSMITH_ grants the SELECT privilege to _AJONES_.

++

+```

 GRANT SELECT ON TABLE invent.partloc TO ajones;

-

--- If the user administrator attempts to revoke the SELECT

--- privilege from JSMITH, this would fail because

--- of the privilege granted to AJONES based on the

--- privilege granted to JSMITH.

--- To successfully revoke the SELECT privilege from

--- JSMITH, the SELECT privilege granted to AJONES

--- must be revoked first. For this example:

--- 1. JSMITH revokes the SELECT privilege granted to AJONES:

+```

++

+If the user administrator attempts to revoke the SELECT privilege from _JSMITH_, this would fail because of 

+the privilege granted to _AJONES_ based on the privilege granted to _JSMITH_. To successfully revoke the SELECT privilege from _JSMITH_, the SELECT privilege granted to _AJONES_ 

+must be revoked first. 

++

+For this example:

++

+_JSMITH_ revokes the SELECT privilege granted to _AJONES_.

++

+```

 REVOKE SELECT ON TABLE invent.partloc FROM ajones;

-

--- 2. User administrator revokes the SELECT privilege on the

--- table from JSMITH:

+```

++

+User administrator revokes the SELECT privilege on the table from _JSMITH_, the REVOKE operation succeeds.

++

+```

 REVOKE SELECT ON TABLE invent.partloc FROM jsmith RESTRICT;

-

--- The REVOKE operation succeeds.

--- An easier way to make the REVOKE operation successful is

--- to use the CASCADE option:

+```

++

+An easier way to make the REVOKE operation successful is to use the `CASCADE option`.

++

+The REVOKE operation succeeds because the `CASCADE option` causes all specified privileges, and all privileges that

+were granted based upon the specified privileges, to be removed.

++

+```

 REVOKE SELECT ON TABLE invent.partloc FROM jsmith CASCADE;

-

--- The REVOKE operation succeeds because the CASCADE option

--- causes all specified privileges, and all privileges that

--- were granted based upon the specified privileges, to be

--- removed.

 ```

 

-* Administration in the shipping department decides that the CLERKS role should no longer be able to grant

-privileges on the invent.partloc table. Fred has recently moved to another department, so JSMITH revokes

-the SELECT privilege on the invent.partloc table from Fred, who was granted the privilege by CLERKS. Then,

-JSMITH revokes the grant option from CLERKS:

+* Administration in the shipping department decides that the _CLERKS_ role should no longer be able to grant

+privileges on the _invent.partloc_ table. _Fred_ has recently moved to another department, so _JSMITH_ revokes

+the SELECT privilege on the _invent.partloc_ table from _Fred_, who was granted the privilege by _CLERKS_. Then,

+_JSMITH_ revokes the grant option from _CLERKS_:

 +

 ```

 REVOKE SELECT on table invent.partloc FROM fred GRANTED BY clerks;

@@ -7800,10 +8114,10 @@
 <<<

 **** `_col-expr_ [[AS] _name_]`

 +

-specifies a derived column determined by the evaluation of an sql value expression in the list. any column referred to in a value

-expression is from the row in the old table exposed by the delete. the old table refers to column values before the delete operation.

+specifies a derived column determined by the evaluation of an sql value expression in the list. Any column referred to in a value

+expression is from the row in the old table exposed by the delete. The old table refers to column values before the delete operation.

 +

-By using the as clause, you can associate a derived column, _col-expr_, with a _name_. _name_ is an SQL identifier. See

+By using the `AS clause`, you can associate a derived column, _col-expr_, with a _name_. _name_ is an SQL identifier. See

 <<identifiers,Identifier>>.

 

 *** `[AS] _corr_ [(_col-expr-list_)]`

@@ -7869,22 +8183,22 @@
 A _joined-table_ can be specified as:

 +

 ```

-_table-ref_ [_join-type_] JOIN _table-ref join-spec_

-| _table-ref_ NATURAL [_join-type_] JOIN _table-ref_

-| _table-ref_ CROSS JOIN _table-ref_

-| (_joined-table_)

+table-ref [join-type] JOIN table-ref join-spec

+| table-ref NATURAL [join-type] JOIN table-ref

+| table-ref CROSS JOIN table-ref

+| (joined-table)

 ```

 

 <<<

-*** `_join-type_ is: INNER | LEFT [OUTER] | RIGHT [OUTER] | FULL [OUTER]`

+*** `_join-type_` is: 

 +

-is a joined table. You specify the _join-type_ by using the CROSS, INNER, OUTER, LEFT, RIGHT, and FULL keywords.

+`INNER | LEFT [OUTER] | RIGHT [OUTER] | FULL [OUTER]`

++

+is a joined table. You specify the `_join-type_` by using the CROSS, INNER, OUTER, LEFT, RIGHT, and FULL keywords.

 If you omit the optional OUTER keyword and use LEFT, RIGHT, or FULL in a join, {project-name} SQL assumes the join is

 an outer join.

-+

-If you specify a CROSS join as the _join-type_, you cannot specify a NATURAL join or a

 

-*** `_join-spec_.`

+*** `_join-spec_`

 +

 If you specify an INNER, LEFT, RIGHT, or FULL join as the _join-type_ and you do not specify a NATURAL join, you

 must use an ON clause as the _join-spec_, as follows: subqueries are not allowed in the join predicate of FULL OUTER JOIN.

@@ -9842,23 +10156,23 @@
 * `_table_`

 +

 names the user table in which to insert or update rows. _table_ must be

-a base table. (_target-col-list_)

+a base table. 

+

+*`_target-col-list_`

 +

 names the columns in the table in which to insert or update values. The

-data type of each target

-+

-column must be compatible with the data type of its corresponding source

+data type of each target column must be compatible with the data type of its corresponding source

 value. Within the list, each target column must have the same position

 as its associated source value, whose position is determined by the

 columns in the table derived from the evaluation of the query expression

-(_query-expr_).

+(`_query-expr_`).

 +

 If you do not specify all of the columns in the target _table_ in the

-_target-col-list_, column default values are inserted into or updated

+`_target-col-list_`, column default values are inserted into or updated

 in the columns that do not appear in the list. See

 <<column_default_settings,Column Default Settings>>.

 +

-If you do not specify _target-col-list_, row values from the source

+If you do not specify `_target-col-list_`, row values from the source

 table are inserted into or updated in all columns in table. The order of

 the column values in the source table must be the same order as that of

 the columns specified in the CREATE TABLE for _table_. (This order is

diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_utilities.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_utilities.adoc
index 5bcde53..1de9b3a 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/sql_utilities.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/sql_utilities.adoc
@@ -46,7 +46,7 @@
 files using a client-based tool, such as the {project-name} Command Interface

 (TrafCI). To install and configure a client application that enables you

 to connect to and issue SQL utilities, see the

-{docs-url}/client_installation/index.html[_{project-name} Client Installation Guide_].

+http://trafodion.apache.org/docs/client_install/index.html[Trafodion Client Installation Guide].

 

 <<<

 [[cleanup_statement]]

@@ -414,8 +414,10 @@
   | NO POPULATE INDEXES

   | NO DUPLICATE CHECK

   | NO OUTPUT

+  | NO RECOVERY

   | INDEX TABLE ONLY

   | REBUILD INDEXES

+  | UPSERT USING LOAD

 ```

 

 [[load_syntax]]

@@ -513,6 +515,10 @@
 the LOAD statement prints status messages listing the steps that the

 Bulk Loader is executing.

 

+** `NO RECOVERY`

++

+specifies that the Bulk Loader not use HBase snapshots for recovery. By default, the Bulk Loader handles recovery using the HBase snapshots mechanism.

+

 ** `INDEX TABLE ONLY`

 +

 specifies that the target table, which is an index, be populated with

@@ -530,6 +536,12 @@
 using LOAD WITH REBUILD INDEXES, and the elapsed time of the former is less than the latter 

 if this CQD is turned ON.

 

+** `UPSERT USING LOAD`

++

+specifies that data is inserted into target tables using rowset inserts without transactions.

++

+In this case, Trafodion uses regular HBase interface (Put) rather than HBase Bulk Loader when inserting multiple rows at a time.

+

 <<<

 [[load_considerations]]

 === Considerations for LOAD

@@ -1724,8 +1736,8 @@
 [[purgedata_syntax]]

 === Syntax Description of PURGEDATA

 

-_object_

-

+* _object_

++

 is the name of the table from which to purge the data. See

 <<"database object names","Database Object Names">>.

 

diff --git a/docs/src/site/markdown/index.md b/docs/src/site/markdown/index.md
index 6e99b42..04ca45d 100644
--- a/docs/src/site/markdown/index.md
+++ b/docs/src/site/markdown/index.md
@@ -42,15 +42,16 @@
 
 
 <table><tr><td>
-  <p><h5>Apache Trafodion is now a Top Level Project!</h5></p>
-  <p>Check out the <a href="http://globenewswire.com/news-release/2018/01/10/1286517/0/en/The-Apache-Software-Foundation-Announces-Apache-Trafodion-as-a-Top-Level-Project.html">NewsWire</a> article for the official announcement.</p>
-  <p>See also this nice <a href="https://thenewstack.io/sql-hadoop-database-trafodion-bridges-transactions-analysis-divide/">article</a> where Trafodion's own Suresh Subbiah spreads the word on Trafodion's features.</p>
-  <p><h5>We're working on release 2.2!</h5></p> 
+  <p><h5>We're working on release 2.3!</h5></p> 
   <p>Check out the <a href="https://cwiki.apache.org/confluence/display/TRAFODION/Roadmap">Roadmap</a> page for planned content.</p>
-  <p><h5>Apache Trafodion 2.1.0-incubating was released on May 1, 2017</h5></p> 
+  <p><h5>Apache Trafodion 2.2.0, our first release as a Top Level Project, was released on March 12, 2018.</h5></p> 
   <p>Check it out on the <a href="http://trafodion.apache.org/download.html">Download</a> page.</p>
-  <p><h5>Want to disucss Trafodion in Chinese? Join the Trafodion discussion on Tencent QQ!</h5></p> 
-  <p><a href="http://im.qq.com/">QQ</a> Group ID: 176011868.</p>
+  <p><h5>Apache Trafodion is now a Top Level Project!</h5></p>
+  <p>See the <a href="http://globenewswire.com/news-release/2018/01/10/1286517/0/en/The-Apache-Software-Foundation-Announces-Apache-Trafodion-as-a-Top-Level-Project.html">NewsWire</a> article for the official announcement.</p>
+  <p>See also this nice <a href="https://thenewstack.io/sql-hadoop-database-trafodion-bridges-transactions-analysis-divide/">article</a> where Trafodion's own Suresh Subbiah spreads the word on Trafodion's features.</p>
+  <p><h5>Apache Trafodion 2.1.0-incubating was released on May 1, 2017.</h5></p>  
+  <p><h5>Want to discuss Trafodion in Chinese? Join the Trafodion discussion on Tencent QQ!</h5></p> 
+  <p><a href="http://im.qq.com/">QQ</a> Group ID: 233105278.</p>
 </td></tr></table>
 
 <!-- 20160524 GTA Need more logos before using this part.
diff --git a/docs/src/site/site.xml b/docs/src/site/site.xml
index 5ccff3c..08d40fc 100644
--- a/docs/src/site/site.xml
+++ b/docs/src/site/site.xml
@@ -228,7 +228,7 @@
       <item href="http://www.apache.org/events/current-event.html" name="Events"/>
       <item href="logo.html" name="Logo"/>
       <item href="mail-lists.html" name="Mailing Lists"/>
-      <item href="http://im.qq.com" name="QQ (Group ID:176011868)"/>
+      <item href="http://im.qq.com" name="QQ (Group ID: 233105278)"/>
       <item href="http:divider" name=""/>
       <item href="source-repository.html" name="Source Repository"/>
       <item href="issue-tracking.html" name="Issue Tracking"/>
diff --git a/pom.xml b/pom.xml
index 838a3db..bc4364c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,7 +59,7 @@
 
   <issueManagement>
     <system>JIRA</system>
-    <url>http://issues.apache.org/jira/browse/TRAFODION</url>
+    <url>https://issues.apache.org/jira/browse/TRAFODION</url>
   </issueManagement>
 
   <scm>
diff --git a/win-odbc64/Common/TransportBase.h b/win-odbc64/Common/TransportBase.h
index 4b24fa0..0ec7e60 100644
--- a/win-odbc64/Common/TransportBase.h
+++ b/win-odbc64/Common/TransportBase.h
@@ -134,6 +134,8 @@
 	SRVR_API_SQLFASTEXECDIRECT,					//OK WMS

 	SRVR_API_SQLFASTFETCH_PERF,					//OK WMS

 	SRVR_API_GETSEGMENTS,						//OK WMS

+    SRVR_API_EXTRACTLOB,                        //OK LOB

+    SRVR_API_UPDATELOB,                         //OK LOB

 	SRVR_API_LASTAPI								//Add new APIs before this

 

 };

diff --git a/win-odbc64/Common/marshalingdrvr_drvr.cpp b/win-odbc64/Common/marshalingdrvr_drvr.cpp
index 4cffe0e..01bcc59 100644
--- a/win-odbc64/Common/marshalingdrvr_drvr.cpp
+++ b/win-odbc64/Common/marshalingdrvr_drvr.cpp
@@ -2743,7 +2743,130 @@
 

 } /* odbc_SQLDrvr_Execute_param_pst_() */

 

+CEE_status

+odbc_SQLDrvr_ExtractLob_param_pst_(

+    /* In    */ CInterface * pSystem

+  , /* In    */ IDL_char * & buffer

+  , /* In    */ long        & message_length

+  , /* In    */ IDL_long     extractType

+  , /* In    */ IDL_string   lobHandle

+  , /* In    */ IDL_long     lobHandleLen

+  , /* In    */ IDL_long     lobHandleCharset

+  , /* In    */ IDL_long     extractlen

+ )

+{

+    IDL_char  *curptr = NULL;

+    IDL_long  wlength = 0;

+    IDL_long  charSet = 0;

 

+    //extractType

+    wlength += sizeof(IDL_short);

+

+    //lobHandleLen

+    wlength += sizeof(IDL_long);

+    if (lobHandle != NULL)

+    {

+        wlength += lobHandleLen;

+        wlength += sizeof(IDL_long);

+    }

+

+    wlength += sizeof(IDL_long);

+

+    message_length = wlength;

+    buffer = pSystem->w_allocate(message_length);

+    if (buffer == NULL)

+    {

+        return CEE_ALLOCFAIL;

+    }

+    curptr = buffer;

+

+    if (pSystem->swap() == SWAP_YES)

+    {

+        LONG_swap(&extractType);

+        LONG_swap(&lobHandleLen);

+        LONG_swap(&charSet);

+        LONG_swap(&extractlen);

+    }

+

+    IDL_long_copy(&extractType, curptr);

+

+    IDL_long_copy(&lobHandleLen, curptr);

+    if (lobHandle != NULL)

+    {

+        IDL_charArray_copy(lobHandle, curptr);

+        IDL_long_copy(&charSet, curptr);

+    }

+

+    IDL_long_copy(&extractlen, curptr);

+

+    return CEE_SUCCESS;

+}

+

+CEE_status

+odbc_SQLDrvr_UpdateLob_param_pst_(

+    /* In    */ CInterface * pSystem

+  , /* In    */ IDL_char * & buffer

+  , /* In    */ long        & message_length

+  , /* In    */ IDL_long     updataType

+  , /* In    */ IDL_string   lobHandle

+  , /* In    */ IDL_long     lobHandleLen

+  , /* In    */ IDL_long     lobHandleCharset

+  , /* In    */ IDL_long_long     totalLength

+  , /* In    */ IDL_long_long     offset

+  , /* In    */ BYTE *        data

+  , /* In    */ IDL_long_long pos

+  , /* In    */ IDL_long_long length

+)

+{

+    IDL_char  *curptr = NULL;

+    IDL_long   wlength = 0;

+    IDL_long   lobHandleLength = 0;

+

+    wlength += sizeof(IDL_long);

+

+    wlength += sizeof(lobHandleLength);

+    if (lobHandle != NULL)

+    {

+        lobHandleLength = strlen(lobHandle) + 1;

+        wlength += lobHandleLength;

+        wlength += sizeof(lobHandleCharset);

+    }

+

+    wlength += sizeof(IDL_long_long) * 3;

+    wlength += length;

+

+    message_length = wlength;

+    buffer = pSystem->w_allocate(message_length);

+    if (buffer == NULL)

+    {

+        return CEE_ALLOCFAIL;

+    }

+

+    curptr = buffer;

+

+    if (pSystem->swap() == SWAP_YES)

+    {

+        LONGLONG_swap(&totalLength);

+        LONGLONG_swap(&offset);

+        LONGLONG_swap(&length);

+    }

+

+    IDL_long_copy(&updataType, curptr);

+    IDL_long_copy(&lobHandleLength, curptr);

+    if (lobHandle != NULL)

+    {

+        IDL_charArray_copy(lobHandle, curptr);

+        IDL_long_copy(&lobHandleCharset, curptr);

+    }

+

+    IDL_long_long_copy(&totalLength, curptr);

+    IDL_long_long_copy(&offset, curptr);

+    IDL_long_long_copy(&length, curptr);

+

+    IDL_byteArray_copy(data, length, curptr);

+

+    return CEE_SUCCESS;

+}

 /************************************************************************************************************

  *                                                                                                          *

  * Keeping these functions around for the collapsed driver - get rid of these when it is not needed anymore *

diff --git a/win-odbc64/Common/marshalingdrvr_drvr.h b/win-odbc64/Common/marshalingdrvr_drvr.h
index 8163852..d3c7578 100644
--- a/win-odbc64/Common/marshalingdrvr_drvr.h
+++ b/win-odbc64/Common/marshalingdrvr_drvr.h
@@ -195,6 +195,33 @@
 	    , /* In    */ IDL_unsigned_short transactionOpt

 );

 

+CEE_status

+odbc_SQLDrvr_ExtractLob_param_pst_(

+    /* In    */ CInterface * pSystem

+  , /* In    */ IDL_char * & buffer

+  , /* In    */ long        & message_length

+  , /* In    */ IDL_long     extractType

+  , /* In    */ IDL_string   lobHandle

+  , /* In    */ IDL_long     lobHandleLen

+  , /* In    */ IDL_long     lobHandleCharset

+  , /* In    */ IDL_long     extractlen

+);

+

+CEE_status

+odbc_SQLDrvr_UpdateLob_param_pst_(

+    /* In    */ CInterface * pSystem

+  , /* In    */ IDL_char * & buffer

+  , /* In    */ long        & message_length

+  , /* In    */ IDL_long     updataType

+  , /* In    */ IDL_string   lobHandle

+  , /* In    */ IDL_long     lobHandleLen

+  , /* In    */ IDL_long     lobHandleCharset

+  , /* In    */ IDL_long_long     totalLength

+  , /* In    */ IDL_long_long     offset

+  , /* In    */ BYTE *        data

+  , /* In    */ IDL_long_long pos

+  , /* In    */ IDL_long_long length

+);

 /************************************************************************************************************

  *                                                                                                          *

  * Keeping these functions around for the collapsed driver - get rid of these when it is not needed anymore *

diff --git a/win-odbc64/Install/win64_installer/installer.iss b/win-odbc64/Install/win64_installer/installer.iss
index 2a44a93..45fae07 100644
--- a/win-odbc64/Install/win64_installer/installer.iss
+++ b/win-odbc64/Install/win64_installer/installer.iss
@@ -71,7 +71,7 @@
 Root: HKLM; SubKey: Software\ODBC\ODBCINST.INI\{#MyDriverName}; ValueType: dword; ValueName: UsageCount; ValueData: $00000001 ;Flags: uninsdeletekey
 Root: HKLM; SubKey: Software\ODBC\ODBCINST.INI\{#MyDriverName}; ValueType: string; ValueName: Driver; ValueData: {sys}\trfodbc1.dll ;Flags: uninsdeletekey
 Root: HKLM; SubKey: Software\ODBC\ODBCINST.INI\{#MyDriverName}; ValueType: string; ValueName: Setup; ValueData: {sys}\trfoadm1.dll ;Flags: uninsdeletekey
-Root: HKLM; SubKey: Software\ODBC\ODBCINST.INI\{#MyDriverName}; ValueType: string; ValueName: CertificateDir; ValueData: SYSTEM_DEFAULT ;Flags: uninsdeletekey
+Root: HKLM; SubKey: Software\ODBC\ODBCINST.INI\{#MyDriverName}; ValueType: string; ValueName: CertificateDir; ValueData: "{code:getCerDir}" ;Flags: uninsdeletekey
 Root: HKLM; SubKey: Software\ODBC\ODBCINST.INI\{#MyDriverName}; ValueType: string; ValueName: CPTimeout; ValueData: 60 ;Flags: uninsdeletekey
 
 [UninstallDelete]
@@ -93,7 +93,18 @@
   INSTALLSTATE_DEFAULT = 5;      // The product is installed for the current user.
 
   VC_2013_REDIST_X64_MIN = '{A749D8E6-B613-3BE3-8F5F-045C84EBA29B}';
-  VC_2013_REDIST_X64_ADD = '{929FBD26-9020-399B-9A7A-751D61F0B942}';
+  VC_2013_REDIST_X64_ADD = '{929FBD26-9020-399B-9A7A-751D61F0B942}';

+

+var

+  CerDirEdit: TNewEdit;

+  CerDirButton: TButton;

+  CerDirLabel: TLabel;

+  CerDirDesLabel: TLabel;

+

+function getCerDir(Param: String): string;

+begin

+  Result := CerDirEdit.Text;

+end;
 
 function MsiQueryProductState(szProduct: string): INSTALLSTATE;
   external 'MsiQueryProductState{#AW}@msi.dll stdcall';
@@ -221,3 +232,52 @@
   end;
 
 end;
+

+procedure ChoseCerDirClick(Sender: TObject);

+var

+  choicedDIR:String;

+begin

+  if BrowseForFolder(ExpandConstant('choose a Certificate Directory'),choicedDIR,True) then

+    CerDirEdit.Text := choicedDIR;

+end;

+

+procedure CreateAddonPage;

+begin

+

+end;

+

+procedure InitializeWizard();

+begin

+  CerDirDesLabel := TLabel.Create(WizardForm);

+  CerDirDesLabel.Parent := WizardForm.SelectDirPage;

+  CerDirDesLabel.Left := ScaleX(0);

+  CerDirDesLabel.Top := ScaleY(100);

+  CerDirDesLabel.Width := ScaleX(75);

+  CerDirDesLabel.Height := ScaleY(21);

+  CerDirDesLabel.Caption := ExpandConstant('Certificate directory location');

+

+  CerDirEdit := TNewEdit.Create(WizardForm);

+  CerDirEdit.Parent := WizardForm.SelectDirPage;

+  CerDirEdit.Left := ScaleX(0);

+  CerDirEdit.Top := ScaleY(125);

+  CerDirEdit.Width := ScaleX(333);

+  CerDirEdit.Height := ScaleY(29);

+  CerDirEdit.Text := 'SYSTEM_DEFAULT';

+

+  CerDirButton := TButton.Create(WizardForm);

+  CerDirButton.Parent := WizardForm.SelectDirPage;

+  CerDirButton.Left := ScaleX(342);

+  CerDirButton.Top := ScaleY(125);

+  CerDirButton.Width := ScaleX(75);

+  CerDirButton.Height := ScaleY(21);

+  CerDirButton.Caption := ExpandConstant('Browse... ');

+  CerDirButton.OnClick := @ChoseCerDirClick;

+

+  CerDirLabel := TLabel.Create(WizardForm);

+  CerDirLabel.Parent := WizardForm.SelectDirPage;

+  CerDirLabel.Left := ScaleX(0);

+  CerDirLabel.Top := ScaleY(150);

+  CerDirLabel.Width := ScaleX(75);

+  CerDirLabel.Height := ScaleY(21);

+  CerDirLabel.Caption := ExpandConstant('SYSTEM_DEFAULT means current users document');

+end;
\ No newline at end of file
diff --git a/win-odbc64/Krypton/generated_incs/odbc_cl.h b/win-odbc64/Krypton/generated_incs/odbc_cl.h
index 04f28c9..0835de6 100644
--- a/win-odbc64/Krypton/generated_incs/odbc_cl.h
+++ b/win-odbc64/Krypton/generated_incs/odbc_cl.h
@@ -2408,6 +2408,58 @@
   , /* Out   */ ERROR_DESC_LIST_def *sqlWarning

   );

 

+/***************************************

+* Operation 'odbc_SQLsrvr_ExtractLob'

+* *************************************/

+

+/*

+* Exception number constants for

+* operation 'odbc_SQLsrvr_ExtractLob'

+*/

+#define odbc_SQLSvc_ExtractLob_ParamError_exn_          1

+#define odbc_SQLSvc_ExtractLob_InvalidConnection_exn_   2

+#define odbc_SQLSvc_ExtractLob_SQLError_exn_            3

+#define odbc_SQLSvc_ExtractLob_SQLInvalidhandle_exn_    4

+#define obdc_SQLSvc_ExtractLob_AllocLOBDataError_exn_   5

+

+/*

+* Exception struct for

+* Operation "odbc_SQLSrvr_ExtractLob"

+*/

+struct odbc_SQLsvc_ExtractLob_exc_ {

+    IDL_long exception_nr;

+    IDL_long exception_detail;

+    union {

+        odbc_SQLSvc_ParamError ParamError;

+        odbc_SQLSvc_SQLError SQLError;

+    } u;

+};

+

+/***************************************

+* Operation 'odbc_SQLsvc_UpdateLob'

+***************************************/

+/*

+* Exceptoin number constants for

+* operation 'odbc_SQLSvc_UpdateLob'

+*/

+#define odbc_SQLSvc_UpdateLob_ParamError_exn_        1

+#define odbc_SQLSvc_UpdateLob_InvalidConnect_exn_    2

+#define odbc_SQLSvc_UpdateLob_SQLError_exn_          3

+#define odbc_SQLSvc_UpdateLob_SQLInvalidhandle_exn_  4

+

+/*

+* Exception struct for

+* Operation "odbc_SQLSvc_UpdateLob"

+*/

+struct odbc_SQLSvc_UpdateLob_exc_ {

+    IDL_long exception_nr;

+    IDL_long exception_detail;

+    union {

+        odbc_SQLSvc_ParamError ParamError;

+        odbc_SQLSvc_SQLError   SQLError;

+    } u;

+};

+

 /*

  * CIN description of interface 'odbc_SQLSvc'

  */

diff --git a/win-odbc64/odbcclient/drvr35/Interface/odbcs_drvr.cpp b/win-odbc64/odbcclient/drvr35/Interface/odbcs_drvr.cpp
index 8228734..a8e11f2 100644
--- a/win-odbc64/odbcclient/drvr35/Interface/odbcs_drvr.cpp
+++ b/win-odbc64/odbcclient/drvr35/Interface/odbcs_drvr.cpp
@@ -2356,6 +2356,233 @@
 } // odbc_SQLDrvr_Execute_pst_()

 

 

+extern "C" CEE_status

+odbc_SQLDrvr_ExtractLOB_pst_(

+    /* In    */ CEE_tag_def tag_

+ , /* In    */ IDL_short extractType

+ , /* In    */ IDL_string  lobHandle

+ , /* In    */ IDL_long    lobHandleLen

+ , /* In    */ IDL_long  &extractLen

+ , /* Out   */ struct odbc_SQLsvc_ExtractLob_exc_ *exception_

+ , /* Out   */ BYTE *& extractData

+)

+{

+    bool sts;

+

+    CEE_status retcode;

+    IDL_long   wlength, rlength;

+    IDL_char   *wbuffer, *rbuffer;

+

+    IDL_long sqlWarningOrErrorLength = 0;

+    IDL_char   *curptr;

+    IDL_long   msg_total_len = 0;

+

+    IDL_long   lobHandleCharset = 1;

+

+    SRVR_CALL_CONTEXT *srvrCallContext = (SRVR_CALL_CONTEXT *)tag_;

+    CStmt * pStatement = (CStmt *)srvrCallContext->sqlHandle;

+    CConnect *pConnection = pStatement->getConnectHandle();

+

+    retcode = odbc_SQLDrvr_ExtractLob_param_pst_(

+        pConnection->m_srvrTCPIPSystem

+        , wbuffer

+        , wlength

+        , extractType

+        , lobHandle

+        , lobHandleLen

+        , lobHandleCharset

+        , extractLen

+        );

+

+    sts = OpenIO(pConnection->m_srvrTCPIPSystem, srvrCallContext->SQLSvc_ObjRef);

+    if (sts == false)

+        return MAP_SRVR_ERRORS(pConnection);

+

+    sts = DoIO(pConnection->m_srvrTCPIPSystem, wbuffer, wlength, rbuffer, rlength, pConnection, pStatement);

+    if (sts == false)

+        return MAP_SRVR_ERRORS(pConnection);

+

+    // process output parameters

+

+    char swap = pConnection->m_srvrTCPIPSystem->swap();

+    msg_total_len = 0;

+    curptr = rbuffer;

+

+    //

+    //   exception_

+    //

+

+    IDL_long ExceptionLength;

+

+    //

+    //   exception_ ->exception_nr

+    //

+    exception_->exception_nr = *(IDL_long*)(curptr + msg_total_len);

+    msg_total_len += sizeof(exception_->exception_nr);

+    LONG_swap(&exception_->exception_nr, swap);

+

+    //

+    //   exception_ ->exception_detail

+    //

+    exception_->exception_detail = *(IDL_long*)(curptr + msg_total_len);

+    msg_total_len += sizeof(exception_->exception_detail);

+    LONG_swap(&exception_->exception_detail, swap);

+

+    switch (exception_->exception_nr)

+    {

+    case odbc_SQLSvc_ExtractLob_ParamError_exn_:

+        ExceptionLength = *(IDL_long *)(curptr + msg_total_len);

+        msg_total_len += sizeof(ExceptionLength);

+        LONG_swap(&ExceptionLength);

+

+        if (ExceptionLength > 0)

+        {

+            exception_->u.ParamError.ParamDesc = (IDL_char *)(curptr + msg_total_len);

+            msg_total_len += ExceptionLength;

+        }

+        break;

+

+    case odbc_SQLSvc_ExtractLob_SQLError_exn_:

+        retcode = copy_ERROR_DESC_LIST(&exception_->u.SQLError.errorList, curptr, msg_total_len, swap);

+        if (retcode != CEE_SUCCESS)

+            return retcode;

+        break;

+

+    case odbc_SQLSvc_ExtractLob_InvalidConnection_exn_:

+    case odbc_SQLSvc_ExtractLob_SQLInvalidhandle_exn_:

+        break;

+    default:

+        break;

+    }

+    extractType = *(IDL_short *)(curptr + msg_total_len);

+    msg_total_len += sizeof(IDL_short);

+    SHORT_swap(&extractType, swap);

+

+    switch (extractType)

+    {

+    case 0:

+        extractLen = *(IDL_long_long *)(curptr + msg_total_len);

+        break;

+    case 1:

+        extractLen = *(IDL_long_long *)(curptr + msg_total_len);

+        msg_total_len += sizeof(IDL_long_long);

+        extractData = (BYTE *)(curptr + msg_total_len);

+    default:

+        break;

+    }

+

+    return CEE_SUCCESS;

+}

+

+

+extern "C" CEE_status

+odbc_SQLDrvr_UpdateLob_pst_(

+    /* In    */ CEE_tag_def tag_

+  , /* In    */ IDL_long  updataType

+  , /* In    */ IDL_string  lobHandle

+  , /* In    */ IDL_long    lobHandleLen

+  , /* In    */ IDL_long_long  totalLength

+  , /* In    */ IDL_long_long  offset

+  , /* In    */ IDL_long_long  pos

+  , /* In    */ IDL_long_long  length

+  , /* In    */ BYTE *        &data

+  , /* Out   */ struct odbc_SQLSvc_UpdateLob_exc_ *exception_

+)

+{

+    bool sts;

+

+    CEE_status retcode;

+    IDL_long   wlength, rlength;

+    IDL_char   *wbuffer, *rbuffer;

+

+    IDL_long sqlWarningOrErrorLength = 0;

+    IDL_char   *curptr;

+    IDL_long   msg_total_len = 0;

+

+    IDL_long   lobHandleCharset = 1;

+

+    SRVR_CALL_CONTEXT *srvrCallContext = (SRVR_CALL_CONTEXT *)tag_;

+    CStmt * pStatement = (CStmt *)srvrCallContext->sqlHandle;

+    CConnect *pConnection = pStatement->getConnectHandle();

+

+    pConnection->m_srvrTCPIPSystem->odbcAPI = SRVR_API_UPDATELOB;

+    pConnection->m_srvrTCPIPSystem->dialogueId = srvrCallContext->dialogueId;

+    pConnection->m_srvrTCPIPSystem->dwTimeout = srvrCallContext->statementTimeout;

+

+    retcode = odbc_SQLDrvr_UpdateLob_param_pst_(

+        pConnection->m_srvrTCPIPSystem

+        , wbuffer

+        , wlength

+        , updataType

+        , lobHandle

+        , lobHandleLen

+        , lobHandleCharset

+        , totalLength

+        , offset

+        , data

+        , pos

+        , length

+        );

+

+    sts = OpenIO(pConnection->m_srvrTCPIPSystem, srvrCallContext->SQLSvc_ObjRef);

+    if (sts == false)

+        return MAP_SRVR_ERRORS(pConnection);

+

+    sts = DoIO(pConnection->m_srvrTCPIPSystem, wbuffer, wlength, rbuffer, rlength, pConnection, pStatement);

+    if (sts == false)

+        return MAP_SRVR_ERRORS(pConnection);

+

+    char swap = pConnection->m_srvrTCPIPSystem->swap();

+    msg_total_len = 0;

+    curptr = rbuffer;

+

+    //

+    //   exception_

+    //

+

+    IDL_long ExceptionLength;

+

+    //

+    //   exception_ ->exception_nr

+    //

+    exception_->exception_nr = *(IDL_long*)(curptr + msg_total_len);

+    msg_total_len += sizeof(exception_->exception_nr);

+    LONG_swap(&exception_->exception_nr, swap);

+

+    //

+    //   exception_ ->exception_detail

+    //

+    exception_->exception_detail = *(IDL_long*)(curptr + msg_total_len);

+    msg_total_len += sizeof(exception_->exception_detail);

+    LONG_swap(&exception_->exception_detail, swap);

+

+    switch (exception_->exception_nr)

+    {

+    case odbc_SQLSvc_UpdateLob_ParamError_exn_:

+        ExceptionLength += *(IDL_long *)(curptr + msg_total_len);

+        msg_total_len += sizeof(ExceptionLength);

+        LONG_swap(&ExceptionLength);

+        if (ExceptionLength > 0)

+        {

+            exception_->u.ParamError.ParamDesc = (IDL_char *)(curptr + msg_total_len);

+            msg_total_len += ExceptionLength;

+        }

+        break;

+    case odbc_SQLSvc_UpdateLob_InvalidConnect_exn_:

+        retcode = copy_ERROR_DESC_LIST(&exception_->u.SQLError.errorList, curptr, msg_total_len, swap);

+        if (retcode != CEE_SUCCESS)

+            return retcode;

+    case odbc_SQLSvc_UpdateLob_SQLError_exn_:

+    case odbc_SQLSvc_UpdateLob_SQLInvalidhandle_exn_:

+        break;

+

+    default:

+        break;

+    }

+

+    return CEE_SUCCESS;

+}

+

 //-----------------------------------------------------------------

 

 CEE_status MAP_SRVR_ERRORS(CConnect *pConnection)

diff --git a/win-odbc64/odbcclient/drvr35/Interface/odbcs_drvr.h b/win-odbc64/odbcclient/drvr35/Interface/odbcs_drvr.h
index 7b044f9..c5a1a4f 100644
--- a/win-odbc64/odbcclient/drvr35/Interface/odbcs_drvr.h
+++ b/win-odbc64/odbcclient/drvr35/Interface/odbcs_drvr.h
@@ -138,4 +138,28 @@
   , /* Out   */ ERROR_DESC_LIST_def *sqlWarning

   );

 

+extern "C" CEE_status

+odbc_SQLDrvr_ExtractLOB_pst_(

+    /* In    */ CEE_tag_def tag_

+  , /* In    */ IDL_short extractType

+  , /* In    */ IDL_string  lobHandle

+  , /* In    */ IDL_long    lobHandleLen

+  , /* In    */ IDL_long  &extractLen

+  , /* Out   */ struct odbc_SQLsvc_ExtractLob_exc_ *exception_

+  , /* Out   */ BYTE *&extractData

+);

+

+extern "C" CEE_status

+odbc_SQLDrvr_UpdateLob_pst_(

+    /* In    */ CEE_tag_def tag_

+  , /* In    */ IDL_long  updataType

+  , /* In    */ IDL_string  lobHandle

+  , /* In    */ IDL_long    lobHandleLen

+  , /* In    */ IDL_long_long  totalLength

+  , /* In    */ IDL_long_long  offset

+  , /* In    */ IDL_long_long  pos

+  , /* In    */ IDL_long_long  length

+  , /* In    */ BYTE *        &data

+  , /* Out   */ struct odbc_SQLSvc_UpdateLob_exc_ *exception_

+);

 #endif /* ODBCS_DRVR_H */

diff --git a/win-odbc64/odbcclient/drvr35/cconnect.cpp b/win-odbc64/odbcclient/drvr35/cconnect.cpp
index 32102c9..e09ac3e 100644
--- a/win-odbc64/odbcclient/drvr35/cconnect.cpp
+++ b/win-odbc64/odbcclient/drvr35/cconnect.cpp
@@ -56,6 +56,9 @@
 	InitializeCriticalSection(&m_CSTransmision);

 	m_IgnoreCancel = false; 

 	m_StartNode = -1;

+

+    lobHandleSave = NULL;

+    lobHandleLenSave = 0;

 }

 

 CConnect::~CConnect()

@@ -611,6 +614,7 @@
 	// populate the inContext

 	inContext.location[0] = '\0';

 	inContext.userRole[0] = '\0';

+    inContext.sessionName[0] = '\0';

 

 	if (m_DSValue.m_DSServerDSName[0] != 0)

 		strcpy(inContext.datasource, m_DSValue.m_DSServerDSName);

diff --git a/win-odbc64/odbcclient/drvr35/cconnect.h b/win-odbc64/odbcclient/drvr35/cconnect.h
index 4bfe1df..39df0ed 100644
--- a/win-odbc64/odbcclient/drvr35/cconnect.h
+++ b/win-odbc64/odbcclient/drvr35/cconnect.h
@@ -277,6 +277,10 @@
 	SQLUINTEGER		m_SecurityMode;
 	bool			m_RetryEncryption;
 
+    //hold the lob handle from last select for insert >16m
+    IDL_string      lobHandleSave;
+    IDL_long        lobHandleLenSave;
+
 	void reset(bool clearE=true);
 	friend class	CStmt;
 	friend class	CDesc;
diff --git a/win-odbc64/odbcclient/drvr35/cdesc.cpp b/win-odbc64/odbcclient/drvr35/cdesc.cpp
index 73b6326..443529a 100644
--- a/win-odbc64/odbcclient/drvr35/cdesc.cpp
+++ b/win-odbc64/odbcclient/drvr35/cdesc.cpp
@@ -503,6 +503,13 @@
 		m_DescLength = 6 + m_DescDatetimeIntervalPrecision;

 		m_DescPrecision = 0;

 		break;

+    case TYPE_BLOB:

+    case TYPE_CLOB:

+        strcpy((char*)m_DescLiteralPrefix, "'");

+        strcpy((char*)m_DescLiteralSuffix, "'");

+        m_DescLength = SQLItemDesc->maxLen;

+        m_DescPrecision = m_DescLength;

+        break;

 	default:

 		return IDS_HY_021;

 	}

@@ -598,6 +605,10 @@
 //		m_SQLOctetLength = SQLItemDesc->maxLen+3;

 //		m_DescSearchable = SQL_PRED_SEARCHABLE;

 //		break;

+    case SQLTYPECODE_BLOB:

+    case SQLTYPECODE_CLOB:

+        m_SQLOctetLength = SQLItemDesc->maxLen + 4;

+        break;

 	default:

 		m_SQLOctetLength = SQLItemDesc->maxLen;

 		m_DescSearchable = SQL_PRED_BASIC;

@@ -645,6 +656,8 @@
 	case SQL_LONGVARCHAR:

 	case SQL_WCHAR:

 	case SQL_WVARCHAR:

+    case TYPE_BLOB:

+    case TYPE_CLOB:

 		m_DescDatetimeIntervalPrecision = m_DescLength;

 		break;

 	case SQL_INTERVAL_SECOND:

@@ -2819,7 +2832,9 @@
 				{

 					descRecPtr->m_SQLCharset=IRDDescRecPtr->m_SQLCharset;

 					descRecPtr->setTranslateOption(descRecPtr->m_DescConciseType);

-					retCode = ConvertSQLToC(m_ODBCAppVersion,

+                    retCode = ConvertSQLToC(m_ConnectHandle,

+                                            m_InputHandle,

+                                            m_ODBCAppVersion,

 											DataLang,

 											SQLDataType,

 											IRDDescRecPtr->m_ODBCDataType,

@@ -3210,7 +3225,8 @@
 				{

 					descRecPtr->m_SQLCharset=IRDDescRecPtr->m_SQLCharset;

 					descRecPtr->setTranslateOption(descRecPtr->m_DescConciseType);

-					retCode = ConvertSQLToC(//pStatement->getODBCAppVersion(),

+                    retCode = ConvertSQLToC(m_ConnectHandle,

+                                            m_InputHandle,

 											m_ODBCAppVersion,

 											DataLang,

 											SQLDataType,

@@ -3342,7 +3358,9 @@
 	else

 	{

 		descRecPtr->setTranslateOption(TargetType);

-		retCode = ConvertSQLToC(m_ODBCAppVersion,

+        retCode = ConvertSQLToC(m_ConnectHandle,

+                                m_InputHandle,

+                                m_ODBCAppVersion,

 								DataLang,

 								SQLValue->dataType,

 								descRecPtr->m_ODBCDataType,

diff --git a/win-odbc64/odbcclient/drvr35/cstmt.cpp b/win-odbc64/odbcclient/drvr35/cstmt.cpp
index 3dce053..67c453d 100644
--- a/win-odbc64/odbcclient/drvr35/cstmt.cpp
+++ b/win-odbc64/odbcclient/drvr35/cstmt.cpp
@@ -1063,6 +1063,15 @@
             else

                 m_StmtType = TYPE_UNKNOWN;

         }

+        else if (_strnicmp(token, "LOBUPDATE", 9) == 0)

+        {

+            if (m_SrvrCallContext.u.extractLobParams.lobHandle == NULL)

+            {

+                return SQL_ERROR;

+            }

+            m_CurrentOdbcAPI = SRVR_API_UPDATELOB;

+            return SQL_NEED_DATA;

+        }

 

         else

         {

@@ -3039,6 +3048,28 @@
     BOOL		SkipProcess = FALSE;

     SQLRETURN	rc;

 

+    //insert >16m lob

+    if (m_CurrentOdbcAPI == SRVR_API_UPDATELOB)

+    {

+        if (m_ConnectHandle->lobHandleLenSave == 0)

+            return SQL_ERROR;

+

+        if (m_StmtState == STMT_PARAM_DATA_NOT_CALLED)

+        {

+            m_CurrentParamStatus = SQL_WAITING_FOR_DATA;

+            return SQL_NEED_DATA;

+        }

+        else

+        {

+            rc = UpdateLob(0, m_ConnectHandle->lobHandleSave, m_ConnectHandle->lobHandleLenSave, 0, 0, 0, m_DataAtExecData.dataValue._length, (BYTE *)m_DataAtExecData.dataValue._buffer);

+            m_ConnectHandle->lobHandleLenSave == 0;

+            free(m_ConnectHandle->lobHandleSave);

+            m_ConnectHandle->lobHandleSave = NULL;

+            return rc;

+        }

+

+    }

+

     m_CurrentOdbcAPI = SQL_API_SQLPARAMDATA;

     if (m_AsyncEnable == SQL_ASYNC_ENABLE_ON)

     {

@@ -3123,6 +3154,47 @@
     SQLINTEGER		StrLen;

     SQLSMALLINT		ParameterType;

 

+    if (m_CurrentOdbcAPI == SRVR_API_UPDATELOB)

+    {

+        if (m_CurrentParamStatus == SQL_WAITING_FOR_DATA)

+        {

+            if (m_DataAtExecData.dataValue._buffer != NULL)

+            {

+                delete m_DataAtExecData.dataValue._buffer;

+                m_DataAtExecData.dataValue._buffer = NULL;

+                m_DataAtExecData.dataValue._length = 0;

+            }

+            m_CurrentParamStatus = SQL_RECEIVING_DATA;

+        }

+        else

+        {

+            OctetLength = m_DataAtExecData.dataValue._length;

+        }

+

+        if (StrLen_or_Ind == SQL_NTS)

+            StrLen = strlen((const char *)DataPtr);

+        else

+            StrLen = StrLen_or_Ind;

+

+        OctetLength += StrLen;

+        AllocDataPtr = new BYTE[OctetLength];

+

+        if (m_DataAtExecData.dataValue._buffer != NULL)

+        {

+            memcpy((unsigned char *)AllocDataPtr, (unsigned char*)m_DataAtExecData.dataValue._buffer, m_DataAtExecData.dataValue._length);

+            delete m_DataAtExecData.dataValue._buffer;

+            m_DataAtExecData.dataValue._buffer = NULL;

+        }

+

+        m_DataAtExecData.dataValue._buffer = (unsigned char *)AllocDataPtr;

+        memcpy(m_DataAtExecData.dataValue._buffer + m_DataAtExecData.dataValue._length, DataPtr, StrLen);

+

+        m_DataAtExecData.dataValue._length = OctetLength;

+        m_StmtState = STMT_PUT_DATA_CALLED;

+

+        return rc;

+    }

+

     m_CurrentOdbcAPI = SQL_API_SQLPUTDATA;

     clearError();

     if (m_CurrentParam == -1)

@@ -3505,6 +3577,12 @@
                     memOffSet += SQLMaxLength + 2;

                 }

                 break;

+            case SQLTYPECODE_BLOB:

+            case SQLTYPECODE_CLOB:

+                memOffSet = ((memOffSet + 2 - 1) >> 1) << 1;

+                VarOffSet = memOffSet;

+                memOffSet += SQLMaxLength + 2;

+                break;

             case SQLTYPECODE_INTERVAL:

                 VarOffSet = memOffSet;

                 memOffSet += SQLMaxLength;

@@ -4879,3 +4957,234 @@
     totalLength = ((totalLength + 4 - 1) >> 2) << 2;

     return *(long*)(&m_outputDataValue._buffer[totalLength + columnOffset]);

 }

+

+SQLRETURN CStmt::SendExtractLob(IDL_short extractType,

+    IDL_string lobHandle,

+    IDL_long   lobHandleLen,

+    IDL_long &extractLen,

+    BYTE * &extractData)

+{

+    SQLRETURN         rc = SQL_SUCCESS;

+

+    m_SrvrCallContext.odbcAPI = SRVR_API_EXTRACTLOB;

+    m_SrvrCallContext.sqlHandle = this;

+    m_SrvrCallContext.SQLSvc_ObjRef = m_ConnectHandle->getSrvrObjRef();

+    m_SrvrCallContext.ASSvc_ObjRef = NULL;

+    m_SrvrCallContext.eventHandle = m_StmtEvent;

+    m_SrvrCallContext.dialogueId = m_ConnectHandle->getDialogueId();

+    m_SrvrCallContext.connectionTimeout = m_ConnectHandle->getConnectionTimeout();

+    m_SrvrCallContext.u.fetchParams.queryTimeout = m_QueryTimeout;

+    m_SrvrCallContext.u.extractLobParams.extractType = extractType;

+    m_SrvrCallContext.u.extractLobParams.lobHandle = lobHandle;

+    m_SrvrCallContext.u.extractLobParams.lobHandleLen = lobHandleLen;

+    m_SrvrCallContext.u.extractLobParams.extractLen = extractLen;

+    m_SrvrCallContext.u.extractLobParams.extractData = extractData;

+

+    if (m_AsyncEnable == SQL_ASYNC_ENABLE_ON)

+    {

+        if ((m_AsyncThread = (HANDLE)_beginthreadex(NULL, 0, ThreadControlProc,

+            &m_SrvrCallContext, CREATE_SUSPENDED, &m_ThreadAddr)) == 0)

+        {

+            setNTError(m_ConnectHandle->getErrorMsgLang(), "SendExtractLob - _beginthreadex()");

+            rc = SQL_ERROR;

+        }

+        ResumeThread(m_AsyncThread);

+        rc = SQL_STILL_EXECUTING;

+        Sleep(0);

+    }

+    else

+    {

+        if ((m_SyncThread = (HANDLE)_beginthreadex(NULL, 0, ThreadControlProc,

+            &m_SrvrCallContext, CREATE_SUSPENDED, &m_ThreadAddr)) == 0)

+        {

+            setNTError(m_ConnectHandle->getErrorMsgLang(), "SendExtractLob - _beginthreadex()");

+            rc = SQL_ERROR;

+        }

+        else

+        {

+            ResumeThread(m_SyncThread);

+            WaitForSingleObject(m_SyncThread, INFINITE);

+            GetExitCodeThread(m_SyncThread, &m_ThreadStatus);

+            rc = m_ThreadStatus;

+            CloseHandle(m_SyncThread);

+            m_SyncThread = NULL;

+        }

+    }

+

+    if (rc == SQL_SUCCESS)

+    {

+        extractLen = m_SrvrCallContext.u.extractLobParams.extractLen;

+        extractData = m_SrvrCallContext.u.extractLobParams.extractData;

+

+        if (m_ConnectHandle->lobHandleSave != NULL)

+            free(m_ConnectHandle->lobHandleSave);

+

+        m_ConnectHandle->lobHandleSave = (IDL_string)malloc(lobHandleLen);

+        memcpy(m_ConnectHandle->lobHandleSave, lobHandle, lobHandleLen);

+        m_ConnectHandle->lobHandleLenSave = lobHandleLen;

+    }

+

+    return rc;

+}

+

+SQLRETURN CStmt::ExtractLob(IDL_short extractType,

+    IDL_string lobHandle,

+    IDL_long   lobHandleLen,

+    IDL_long   &extractLen,

+    BYTE * &extractData)

+{

+    SQLRETURN   rc = SQL_SUCCESS;

+    BOOL		SkipProcess = FALSE;

+

+    m_CurrentOdbcAPI = SRVR_API_EXTRACTLOB;

+    if (m_AsyncEnable == SQL_ASYNC_ENABLE_ON)

+    {

+        if (m_AsyncThread != NULL)

+        {

+            if (GetExitCodeThread(m_AsyncThread, &m_ThreadStatus))

+            {

+                if (m_ThreadStatus == STILL_ACTIVE)

+                    rc = SQL_STILL_EXECUTING;

+                else

+                {

+                    CloseHandle(m_AsyncThread);

+                    m_AsyncThread = NULL;

+                    if (m_AsyncCanceled == TRUE)

+                        rc = SQL_ERROR;

+                    else

+                        rc = m_ThreadStatus;

+                }

+            }

+            else

+            {

+                CloseHandle(m_AsyncThread);

+                m_AsyncThread = NULL;

+                setNTError(m_ConnectHandle->getErrorMsgLang(), "Fetch - GetExitCodeThread()");

+                rc = SQL_ERROR;

+            }

+        }

+        else

+        {

+            if (m_ThreadStatus == SQL_STILL_EXECUTING)

+                SkipProcess = TRUE;

+            rc = SendExtractLob(extractType, lobHandle, lobHandleLen, extractLen, extractData);

+        }

+    }

+    else

+        rc = SendExtractLob(extractType, lobHandle, lobHandleLen, extractLen, extractData);

+

+    return rc;

+}

+

+SQLRETURN CStmt::SendUpdateLob(IDL_long updateType,

+    IDL_string lobHandle,

+    IDL_long   lobHandleLen,

+    IDL_long_long totalLength,

+    IDL_long_long offset,

+    IDL_long_long pos,

+    IDL_long_long length,

+    BYTE *        data)

+{

+    SQLRETURN         rc = SQL_SUCCESS;

+

+    m_SrvrCallContext.odbcAPI = SRVR_API_UPDATELOB;

+    m_SrvrCallContext.sqlHandle = this;

+    m_SrvrCallContext.SQLSvc_ObjRef = m_ConnectHandle->getSrvrObjRef();

+    m_SrvrCallContext.ASSvc_ObjRef = NULL;

+    m_SrvrCallContext.eventHandle = m_StmtEvent;

+    m_SrvrCallContext.dialogueId = m_ConnectHandle->getDialogueId();

+    m_SrvrCallContext.connectionTimeout = m_ConnectHandle->getConnectionTimeout();

+    m_SrvrCallContext.u.fetchParams.queryTimeout = m_QueryTimeout;

+    m_SrvrCallContext.u.updateLobParams.updateType = updateType;

+    m_SrvrCallContext.u.updateLobParams.lobHandle = lobHandle;

+    m_SrvrCallContext.u.updateLobParams.lobHandleLen = lobHandleLen;

+    m_SrvrCallContext.u.updateLobParams.totalLength = totalLength;

+    m_SrvrCallContext.u.updateLobParams.offset = offset;

+    m_SrvrCallContext.u.updateLobParams.pos = pos;

+    m_SrvrCallContext.u.updateLobParams.length = length;

+    m_SrvrCallContext.u.updateLobParams.data = data;

+

+    if (m_AsyncEnable == SQL_ASYNC_ENABLE_ON)

+    {

+        if ((m_AsyncThread = (HANDLE)_beginthreadex(NULL, 0, ThreadControlProc,

+            &m_SrvrCallContext, CREATE_SUSPENDED, &m_ThreadAddr)) == 0)

+        {

+            setNTError(m_ConnectHandle->getErrorMsgLang(), "SendExtractLob - _beginthreadex()");

+            rc = SQL_ERROR;

+        }

+        ResumeThread(m_AsyncThread);

+        rc = SQL_STILL_EXECUTING;

+        Sleep(0);

+    }

+    else

+    {

+        if ((m_SyncThread = (HANDLE)_beginthreadex(NULL, 0, ThreadControlProc,

+            &m_SrvrCallContext, CREATE_SUSPENDED, &m_ThreadAddr)) == 0)

+        {

+            setNTError(m_ConnectHandle->getErrorMsgLang(), "SendExtractLob - _beginthreadex()");

+            rc = SQL_ERROR;

+        }

+        else

+        {

+            ResumeThread(m_SyncThread);

+            WaitForSingleObject(m_SyncThread, INFINITE);

+            GetExitCodeThread(m_SyncThread, &m_ThreadStatus);

+            rc = m_ThreadStatus;

+            CloseHandle(m_SyncThread);

+            m_SyncThread = NULL;

+        }

+    }

+

+    return rc;

+}

+

+SQLRETURN CStmt::UpdateLob(IDL_long updateType,

+    IDL_string lobHandle,

+    IDL_long   lobHandleLen,

+    IDL_long_long totalLength,

+    IDL_long_long offset,

+    IDL_long_long pos,

+    IDL_long_long length,

+    BYTE *        data)

+{

+    SQLRETURN   rc = SQL_SUCCESS;

+    BOOL		SkipProcess = FALSE;

+

+    if (m_AsyncEnable == SQL_ASYNC_ENABLE_ON)

+    {

+        if (m_AsyncThread != NULL)

+        {

+            if (GetExitCodeThread(m_AsyncThread, &m_ThreadStatus))

+            {

+                if (m_ThreadStatus == STILL_ACTIVE)

+                    rc = SQL_STILL_EXECUTING;

+                else

+                {

+                    CloseHandle(m_AsyncThread);

+                    m_AsyncThread = NULL;

+                    if (m_AsyncCanceled == TRUE)

+                        rc = SQL_ERROR;

+                    else

+                        rc = m_ThreadStatus;

+                }

+            }

+            else

+            {

+                CloseHandle(m_AsyncThread);

+                m_AsyncThread = NULL;

+                setNTError(m_ConnectHandle->getErrorMsgLang(), "Fetch - GetExitCodeThread()");

+                rc = SQL_ERROR;

+            }

+        }

+        else

+        {

+            if (m_ThreadStatus == SQL_STILL_EXECUTING)

+                SkipProcess = TRUE;

+            rc = SendUpdateLob(updateType, lobHandle, lobHandleLen, totalLength, offset, pos, length, data);

+        }

+    }

+    else

+        rc = SendUpdateLob(updateType, lobHandle, lobHandleLen, totalLength, offset, pos, length, data);

+

+    return rc;

+}

diff --git a/win-odbc64/odbcclient/drvr35/cstmt.h b/win-odbc64/odbcclient/drvr35/cstmt.h
index 5bb2d20..98d4ea4 100644
--- a/win-odbc64/odbcclient/drvr35/cstmt.h
+++ b/win-odbc64/odbcclient/drvr35/cstmt.h
@@ -245,6 +245,33 @@
 	SQLRETURN SetPos(SQLUSMALLINT	RowNumber,

 			SQLUSMALLINT    Operation,

 			SQLUSMALLINT    LockType);

+    SQLRETURN CStmt::SendExtractLob(IDL_short extractType,

+		IDL_string lobHandle,

+		IDL_long lobHandleLen,

+		IDL_long &extractLen,

+		BYTE *& extractData);

+

+    SQLRETURN ExtractLob(IDL_short extractType,

+        IDL_string lobHandle,

+        IDL_long   lobHandleLen,

+        IDL_long &extractLen,

+        BYTE * &extractData);

+    SQLRETURN SendUpdateLob(IDL_long updateType,

+        IDL_string lobHandle,

+        IDL_long   lobHandleLen,

+        IDL_long_long totalLength,

+        IDL_long_long offset,

+        IDL_long_long pos,

+        IDL_long_long length,

+        BYTE *        data);

+    SQLRETURN UpdateLob(IDL_long updateType,

+        IDL_string lobHandle,

+        IDL_long   lobHandleLen,

+        IDL_long_long totalLength,

+        IDL_long_long offset,

+        IDL_long_long pos,

+        IDL_long_long length,

+        BYTE *        data);

 

 	SQLRETURN setDescRec(const SQLItemDescList_def *IPDDescList, const SQLItemDescList_def *IRDDescList);

 	inline BOOL getHeartBeatEnable() {return m_ConnectHandle->getHeartBeatEnable();};

diff --git a/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp b/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
index d62ea29..1d338b6 100644
--- a/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
+++ b/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
@@ -275,6 +275,18 @@
 

 	if (errorMsg)

 		*errorMsg = '\0';

+

+    if (SQLDataType == SQLTYPECODE_BLOB || SQLDataType == SQLTYPECODE_CLOB)

+    {

+        SQLINTEGER lob_len;

+        if (srcLength == SQL_NTS)

+            lob_len = strlen((const char *)srcDataPtr);

+        else

+            lob_len = srcLength;

+        memcpy((char *)targetDataPtr, &lob_len, sizeof(lob_len));

+        memcpy((char *)targetDataPtr + 4, (const char *)srcDataPtr, targetLength > srcLength ? srcLength : targetLength);

+        return SQL_SUCCESS;

+    }

 	

 	//if (targetPrecision < 19)

     if (((SQLDataType == SQLTYPECODE_NUMERIC) && (targetPrecision <= 18)) ||

diff --git a/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj b/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj
index 0194e10..8613089 100755
--- a/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj
+++ b/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj
@@ -296,6 +296,7 @@
     <ClCompile Include="drvrglobal.cpp" />

     <ClCompile Include="drvrnet.cpp" />

     <ClCompile Include="..\..\Common\ExpConvMxcs.cpp" />

+    <ClCompile Include="lob.cpp" />

     <ClCompile Include="netcommon.cpp" />

     <ClCompile Include="netconnect.cpp" />

     <ClCompile Include="netstmt.cpp" />

@@ -351,6 +352,7 @@
     <ClInclude Include="drvrnet.h" />

     <ClInclude Include="..\..\Common\DrvrSrvr.h" />

     <ClInclude Include="..\..\Common\OdbcMsg.h" />

+    <ClInclude Include="lob.h" />

     <ClInclude Include="resource.h" />

     <ClInclude Include="sqlconnect.h" />

     <ClInclude Include="sqldesc.h" />

@@ -382,4 +384,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

   <ImportGroup Label="ExtensionTargets">

   </ImportGroup>

-</Project>

+</Project>
\ No newline at end of file
diff --git a/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj.filters b/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj.filters
index b7d1b70..40f4850 100644
--- a/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj.filters
+++ b/win-odbc64/odbcclient/drvr35/drvr35_os.vcxproj.filters
@@ -164,6 +164,9 @@
     <ClCompile Include="..\..\Common\Compression.cpp">

       <Filter>Interface Files</Filter>

     </ClCompile>

+    <ClCompile Include="lob.cpp">

+      <Filter>Source Files</Filter>

+    </ClCompile>

   </ItemGroup>

   <ItemGroup>

     <ResourceCompile Include="drvr35.rc">

@@ -300,6 +303,9 @@
     <ClInclude Include="..\..\Common\Compression.h">

       <Filter>Interface Header Files</Filter>

     </ClInclude>

+    <ClInclude Include="lob.h">

+      <Filter>Header Files</Filter>

+    </ClInclude>

   </ItemGroup>

   <ItemGroup>

     <CustomBuildStep Include="drvr35.def">

diff --git a/win-odbc64/odbcclient/drvr35/drvrglobal.cpp b/win-odbc64/odbcclient/drvr35/drvrglobal.cpp
index 730eb11..7f3950f 100755
--- a/win-odbc64/odbcclient/drvr35/drvrglobal.cpp
+++ b/win-odbc64/odbcclient/drvr35/drvrglobal.cpp
@@ -30,6 +30,7 @@
 #include "DiagFunctions.h" 

 #include <errno.h>

 #include "StaticLocking.h"

+#include "DrvrSrvr.h"

 

 // Declare the global variable

 

@@ -48,7 +49,9 @@
 DATATYPE_TABLE gSQLDatatypeMap[] = 

 {

 //   conciseType,					verboseType,		datetimeIntervalCode,		columnSizeAttr,		decimalDigitsAttr,	displaySizeAttr,	octetLength,					defaultType,					typeName		

-	{SQL_CHAR,						SQL_CHAR,			0,							SQL_DESC_LENGTH,	0,					SQL_DESC_LENGTH,	SQL_DESC_LENGTH,				SQL_C_CHAR,						"CHAR"},

+    {TYPE_BLOB,                     SQL_CHAR,           0,                          SQL_DESC_LENGTH,    0,                  SQL_DESC_LENGTH,    SQL_DESC_LENGTH,                SQL_C_CHAR,                         "BLOB" },

+    {TYPE_CLOB,                     SQL_CHAR,           0,                          SQL_DESC_LENGTH,    0,                  SQL_DESC_LENGTH,    SQL_DESC_LENGTH,                SQL_C_CHAR,                         "CLOB" },

+    {SQL_CHAR,						SQL_CHAR,			0,							SQL_DESC_LENGTH,	0,					SQL_DESC_LENGTH,	SQL_DESC_LENGTH,				SQL_C_CHAR,						"CHAR"},

 	{SQL_VARCHAR,					SQL_VARCHAR,		0,							SQL_DESC_LENGTH,	0,					SQL_DESC_LENGTH,	SQL_DESC_LENGTH,				SQL_C_CHAR,						"VARCHAR"},

 	{SQL_LONGVARCHAR,				SQL_LONGVARCHAR,	0,							SQL_DESC_LENGTH,	0,					SQL_DESC_LENGTH,	SQL_DESC_LENGTH,				SQL_C_CHAR,						"LONG VARCHAR"},

 	{SQL_DECIMAL,					SQL_DECIMAL,		0,							SQL_DESC_PRECISION,	SQL_DESC_SCALE,		SQL_DESC_PRECISION, SQL_DESC_PRECISION,				SQL_C_CHAR,						"DECIMAL"},

diff --git a/win-odbc64/odbcclient/drvr35/drvrnet.cpp b/win-odbc64/odbcclient/drvr35/drvrnet.cpp
index 05d2f59..99bc0ec 100644
--- a/win-odbc64/odbcclient/drvr35/drvrnet.cpp
+++ b/win-odbc64/odbcclient/drvr35/drvrnet.cpp
@@ -77,6 +77,8 @@
 	case SQL_API_SQLCOLUMNPRIVILEGES:

 	case SQL_API_SQLTABLEPRIVILEGES:

 	case SQL_API_SQLFOREIGNKEYS:

+    case SRVR_API_EXTRACTLOB:

+    case SRVR_API_UPDATELOB:

 		pStatement = (CStmt*)srvrCallContext->sqlHandle;

 		pConnection = pStatement->getConnectHandle();

 		break;

@@ -134,6 +136,16 @@
 			rc = SQLFETCH_(srvrCallContext);

 			break;

 

+        case SRVR_API_EXTRACTLOB:

+            pConnection->m_srvrTCPIPSystem->odbcAPI = SRVR_API_EXTRACTLOB;

+            rc = EXTRACTLOB(srvrCallContext);

+            break;

+

+        case SRVR_API_UPDATELOB:

+            pConnection->m_srvrTCPIPSystem->odbcAPI = SRVR_API_UPDATELOB;

+            rc = UPDATELOB(srvrCallContext);

+            break;

+

 		case SQL_API_SQLFREESTMT:

 			rc = FREESTATEMENT(srvrCallContext);

 			break;

diff --git a/win-odbc64/odbcclient/drvr35/drvrnet.h b/win-odbc64/odbcclient/drvr35/drvrnet.h
index 04c0ca9..fa14cda 100644
--- a/win-odbc64/odbcclient/drvr35/drvrnet.h
+++ b/win-odbc64/odbcclient/drvr35/drvrnet.h
@@ -119,6 +119,25 @@
 			SQLUINTEGER				valueNum;

 			SQLPOINTER				valueStr;

 		} setConnectParams;

+        struct EXTRACTLOB_PARAMS

+        {

+            IDL_short               extractType;

+            IDL_string              lobHandle;

+            IDL_long                lobHandleLen;

+            IDL_long                extractLen;

+            BYTE *                  extractData;

+        } extractLobParams;

+        struct UPDATELOB_PARAMS

+        {

+            IDL_long                updateType;

+            IDL_string              lobHandle;

+            IDL_long                lobHandleLen;

+            IDL_long_long           totalLength;

+            IDL_long_long           offset;

+            IDL_long_long           pos;

+            IDL_long_long           length;

+            BYTE *                  data;

+        } updateLobParams;

 		SQLSMALLINT					completionType;

 	} u;

 

@@ -145,6 +164,8 @@
 extern "C" SQLRETURN SQLPREPARE_(SRVR_CALL_CONTEXT *srvrCallContext);

 extern "C" SQLRETURN SQLFETCH_(SRVR_CALL_CONTEXT *srvrCallContext);

 extern "C" SQLRETURN SQLEXECUTE_(SRVR_CALL_CONTEXT *srvrCallContext);

+extern "C" SQLRETURN EXTRACTLOB(SRVR_CALL_CONTEXT *srvrCallContext);

+extern "C" SQLRETURN UPDATELOB(SRVR_CALL_CONTEXT *srvrCallContext);

 

 extern "C" SQLRETURN checkNetStmt(SRVR_CALL_CONTEXT *srvrCallContext,CEE_status sts, char* procname);

 

diff --git a/win-odbc64/odbcclient/drvr35/lob.cpp b/win-odbc64/odbcclient/drvr35/lob.cpp
new file mode 100644
index 0000000..ef620b0
--- /dev/null
+++ b/win-odbc64/odbcclient/drvr35/lob.cpp
@@ -0,0 +1,88 @@
+/**********************************************************************

+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+********************************************************************/

+/**************************************************************************

+**************************************************************************/

+//

+//

+

+#include "lob.h"

+#include "cconnect.h"

+#include "cstmt.h"

+

+namespace ODBC {

+    IDL_long getLobLength(CConnect *m_ConnectHandle, SQLHANDLE InputHandle, IDL_string lobHandle, IDL_long lobHandleLen)

+    {

+        SQLHSTMT hstmt;

+        m_ConnectHandle->AllocHandle(SQL_HANDLE_STMT, InputHandle, &hstmt);

+

+        IDL_long totalLength;

+        BYTE * data;

+        CStmt *pStatement = (CStmt *)hstmt;

+        pStatement->ExtractLob(0,

+            lobHandle, lobHandleLen, totalLength, data);

+        pStatement->Close(SQL_CLOSE);

+        return totalLength;

+    }

+

+    bool getLobData(CConnect *m_ConnectHandle, SQLHANDLE InputHandle, IDL_string lobHandle, IDL_long lobHandleLen, SQLPOINTER target, IDL_long &length)

+    {

+        SQLHSTMT hstmt;

+        m_ConnectHandle->AllocHandle(SQL_HANDLE_STMT, InputHandle, &hstmt);

+

+        IDL_long totalLength = 0;

+        BYTE * data;

+        CStmt *pStatement = (CStmt *)hstmt;

+        IDL_long extractLen = length;

+

+        IDL_string lobHandleTemp = (IDL_string)malloc(lobHandleLen + 1);

+        memset(lobHandleTemp, 0, lobHandleLen + 1);

+        memcpy(lobHandleTemp, lobHandle, lobHandleLen);

+

+        if (pStatement->ExtractLob(1,

+            lobHandleTemp, lobHandleLen + 1, extractLen, data) != SQL_SUCCESS)

+        {

+            pStatement->Close(SQL_CLOSE);

+            free(lobHandleTemp);

+            lobHandleTemp = NULL;

+

+            return false;

+        }

+

+        if (length > extractLen)

+        {

+            memcpy(target, data, extractLen);

+            length = extractLen;

+        }

+        else

+        {

+            length = 0;

+        }

+

+        pStatement->Close(SQL_CLOSE);

+        free(lobHandleTemp);

+        lobHandleTemp = NULL;

+

+        return true;

+    }

+

+}
\ No newline at end of file
diff --git a/win-odbc64/odbcclient/drvr35/lob.h b/win-odbc64/odbcclient/drvr35/lob.h
new file mode 100644
index 0000000..1b65522
--- /dev/null
+++ b/win-odbc64/odbcclient/drvr35/lob.h
@@ -0,0 +1,38 @@
+/**********************************************************************

+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+********************************************************************/

+/**************************************************************************

+**************************************************************************/

+//

+//

+

+#ifndef _LOB_DEFINED

+#define _LOB_DEFINED

+#include "cconnect.h"

+namespace ODBC {

+    bool getLobData(CConnect *m_ConnectHandle, SQLHANDLE InputHandle, IDL_string lobHandle, IDL_long lobHandleLen, SQLPOINTER target, IDL_long &length);

+

+    IDL_long getLobLength(CConnect *m_ConnectHandle, SQLHANDLE InputHandle, IDL_string lobHandle, IDL_long lobHandleLen);

+

+};

+

+#endif
\ No newline at end of file
diff --git a/win-odbc64/odbcclient/drvr35/netstmt.cpp b/win-odbc64/odbcclient/drvr35/netstmt.cpp
index 38e09c4..0168916 100644
--- a/win-odbc64/odbcclient/drvr35/netstmt.cpp
+++ b/win-odbc64/odbcclient/drvr35/netstmt.cpp
@@ -1159,3 +1159,98 @@
 

 } /* SQLEXECUTE_() */

 

+

+SQLRETURN EXTRACTLOB(SRVR_CALL_CONTEXT *srvrCallContext)

+{

+    CEE_status    sts;

+    SQLRETURN     rc = SQL_SUCCESS;

+

+    struct odbc_SQLsvc_ExtractLob_exc_ exception_ = { 0, 0, 0 };

+    BYTE   *sqlWarningOrError = 0;

+

+    CStmt   * pStatement = (CStmt *)srvrCallContext->sqlHandle;

+

+    sts = odbc_SQLDrvr_ExtractLOB_pst_(

+        srvrCallContext,

+        srvrCallContext->u.extractLobParams.extractType,

+        srvrCallContext->u.extractLobParams.lobHandle,

+        srvrCallContext->u.extractLobParams.lobHandleLen,

+        srvrCallContext->u.extractLobParams.extractLen,

+        &exception_,

+        srvrCallContext->u.extractLobParams.extractData

+        );

+

+    pStatement->setExceptionErrors(exception_.exception_nr, exception_.exception_detail);

+    switch (exception_.exception_nr)

+    {

+    case CEE_SUCCESS:

+        break;

+    case odbc_SQLSvc_ExtractLob_SQLError_exn_:

+        pStatement->setDiagRec(&exception_.u.SQLError);

+        break;

+    case odbc_SQLSvc_ExtractLob_InvalidConnection_exn_:

+        pStatement->setDiagRec(SERVER_ERROR, IDS_08_S01);

+        break;

+    case odbc_SQLSvc_ExtractLob_ParamError_exn_:

+        pStatement->setDiagRec(SERVER_ERROR, IDS_HY_C00, exception_.exception_nr,

+            exception_.u.ParamError.ParamDesc, NULL,

+            SQL_ROW_NUMBER_UNKNOWN, SQL_COLUMN_NUMBER_UNKNOWN, 1, pStatement->getSrvrIdentity());

+        break;

+    case odbc_SQLSvc_ExtractLob_SQLInvalidhandle_exn_:

+        break;

+    default:

+        pStatement->sendCDInfo(exception_.exception_nr);

+        pStatement->setDiagRec(exception_.exception_nr, "EXTRACTLOB", pStatement->getSrvrIdentity());

+        break;

+    }

+    return rc;

+}

+

+SQLRETURN UPDATELOB(SRVR_CALL_CONTEXT *srvrCallContext)

+{

+    CEE_status    sts;

+    SQLRETURN     rc = SQL_SUCCESS;

+

+    struct odbc_SQLSvc_UpdateLob_exc_ exception_ = { 0, 0, 0 };

+    BYTE   *sqlWarningOrError = 0;

+

+    CStmt   * pStatement = (CStmt *)srvrCallContext->sqlHandle;

+

+    sts = odbc_SQLDrvr_UpdateLob_pst_(

+        srvrCallContext,

+        srvrCallContext->u.updateLobParams.updateType,

+        srvrCallContext->u.updateLobParams.lobHandle,

+        srvrCallContext->u.updateLobParams.lobHandleLen,

+        srvrCallContext->u.updateLobParams.totalLength,

+        srvrCallContext->u.updateLobParams.offset,

+        srvrCallContext->u.updateLobParams.pos,

+        srvrCallContext->u.updateLobParams.length,

+        srvrCallContext->u.updateLobParams.data,

+        &exception_

+        );

+

+    pStatement->setExceptionErrors(exception_.exception_nr, exception_.exception_detail);

+    switch (exception_.exception_nr)

+    {

+    case CEE_SUCCESS:

+        break;

+    case odbc_SQLSvc_UpdateLob_SQLError_exn_:

+        pStatement->setDiagRec(&exception_.u.SQLError);

+        break;

+    case odbc_SQLSvc_UpdateLob_InvalidConnect_exn_:

+        pStatement->setDiagRec(SERVER_ERROR, IDS_08_S01);

+        break;

+    case odbc_SQLSvc_UpdateLob_ParamError_exn_:

+        pStatement->setDiagRec(SERVER_ERROR, IDS_HY_C00, exception_.exception_nr,

+            exception_.u.ParamError.ParamDesc, NULL,

+            SQL_ROW_NUMBER_UNKNOWN, SQL_COLUMN_NUMBER_UNKNOWN, 1, pStatement->getSrvrIdentity());

+        break;

+    case odbc_SQLSvc_UpdateLob_SQLInvalidhandle_exn_:

+        break;

+    default:

+        pStatement->sendCDInfo(exception_.exception_nr);

+        pStatement->setDiagRec(exception_.exception_nr, "UPDATELOB", pStatement->getSrvrIdentity());

+        break;

+    }

+    return rc;

+}

diff --git a/win-odbc64/odbcclient/drvr35/sqltocconv.cpp b/win-odbc64/odbcclient/drvr35/sqltocconv.cpp
index e597135..062cca3 100755
--- a/win-odbc64/odbcclient/drvr35/sqltocconv.cpp
+++ b/win-odbc64/odbcclient/drvr35/sqltocconv.cpp
@@ -32,6 +32,7 @@
 #include "nskieee.h"

 #include "DiagFunctions.h"

 #include "csconvert.h" 

+#include "lob.h"

 #include <errno.h>

 

 #define MAXCHARLEN 32768 //32K

@@ -153,7 +154,9 @@
 // totalReturnedLength is a Input/Output parameter

 // *totalReturnedLength = Offset in Input

 // srcLength includes NULL for SQL_CHAR Type, hence srcLength is srcLength-1 for SQL_CHAR fields

-unsigned long ODBC::ConvertSQLToC(SQLINTEGER	ODBCAppVersion,

+unsigned long ODBC::ConvertSQLToC(CConnect *m_ConnectHandle,

+                            SQLHANDLE   InputHandle,

+                            SQLINTEGER	ODBCAppVersion,

 							DWORD		DataLangId,

 							SQLSMALLINT	SQLDataType,

 							SQLSMALLINT	ODBCDataType,

@@ -373,6 +376,29 @@
 	if (srcDataPtr == NULL)

 		return IDS_HY_000;

 

+    if (SQLDataType == SQLTYPECODE_BLOB || SQLDataType == SQLTYPECODE_CLOB)

+    {

+        if (srcPrecision >= 0xFFFFFFF)

+        {

+            DataLen = *(int *)srcDataPtr;

+            DataPtr = (char *)srcDataPtr + 4;

+        }

+        else

+        {

+            DataLen = *(USHORT *)srcDataPtr;

+            DataPtr = (char *)srcDataPtr + 2;

+        }

+

+        IDL_long dataRead = targetLength;

+        if (getLobData(m_ConnectHandle, InputHandle, (IDL_string)DataPtr, DataLen, targetDataPtr, dataRead) != true)

+            return SQL_ERROR;

+

+        if (targetStrLenPtr != NULL)

+            *targetStrLenPtr = dataRead;

+

+        if (dataRead <= 0) return SQL_NO_DATA;

+        return SQL_SUCCESS;

+    }

 	

 //	if(charsetSupport)

 		LangId = LANG_NEUTRAL;

diff --git a/win-odbc64/odbcclient/drvr35/sqltocconv.h b/win-odbc64/odbcclient/drvr35/sqltocconv.h
index 00d4eaf..6ef1fe2 100644
--- a/win-odbc64/odbcclient/drvr35/sqltocconv.h
+++ b/win-odbc64/odbcclient/drvr35/sqltocconv.h
@@ -33,7 +33,9 @@
 

 namespace ODBC {

 

-unsigned long ConvertSQLToC(SQLINTEGER	ODBCAppVersion,

+unsigned long ConvertSQLToC(CConnect *ConnectHandle,

+                            SQLHANDLE InputHandle,

+                            SQLINTEGER	ODBCAppVersion,

 							DWORD		DataLangId,

 							SQLSMALLINT	SQLDataType,

 							SQLSMALLINT	ODBCDataType,

diff --git a/win-odbc64/sql/cli/sqlcli.h b/win-odbc64/sql/cli/sqlcli.h
index fc964fb..478c3fb 100644
--- a/win-odbc64/sql/cli/sqlcli.h
+++ b/win-odbc64/sql/cli/sqlcli.h
@@ -418,6 +418,10 @@
     /* SQL/MP stype VARCHAR with length prefix: Tandem Extension */

     SQLTYPECODE_VARCHAR_WITH_LENGTH = -601,

 

+    /* BLOB TYPE */

+    SQLTYPECODE_BLOB = -602,

+    SQLTYPECODE_CLOB = -603,

+

     /* LONG VARCHAR/ODBC CHARACTER VARYING */

     SQLTYPECODE_VARCHAR_LONG  = -1,		/* ## NEGATIVE??? */