You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2016/06/21 15:37:32 UTC

[4/6] incubator-trafodion git commit: Merge branch 'master' of github.com:apache/incubator-trafodion into index_issue

Merge branch 'master' of github.com:apache/incubator-trafodion into index_issue

Conflicts:
	core/sql/bin/SqlciErrors.txt


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

Branch: refs/heads/master
Commit: c351da3a6dc2815456424d21f1adb51e798104d2
Parents: abb96bb b02ce72
Author: selvaganesang <se...@esgyn.com>
Authored: Tue Jun 21 07:03:02 2016 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Tue Jun 21 07:03:02 2016 +0000

----------------------------------------------------------------------
 .../main/java/org/trafodion/jdbc/t4/Bytes.java  |   5 +
 .../trafodion/jdbc/t4/InterfaceResultSet.java   |  18 +
 .../trafodion/jdbc/t4/InterfaceStatement.java   |  25 +
 .../java/org/trafodion/jdbc/t4/TrafT4Desc.java  |   4 +-
 .../jdbc/t4/TrafT4PreparedStatement.java        |   2 +-
 .../java/org/trafodion/jdbc/t4/Utility.java     |  12 +-
 .../odbc/src/odbc/nsksrvrcore/sqlinterface.cpp  |  65 ++-
 core/sql/bin/SqlciErrors.txt                    |   1 +
 core/sql/cli/CliExpExchange.cpp                 |  29 +-
 core/sql/cli/Descriptor.cpp                     |   8 +-
 core/sql/cli/sqlcli.h                           |   4 +
 core/sql/comexe/ComTdb.cpp                      |  59 +--
 core/sql/comexe/ComTdb.h                        |  25 +-
 core/sql/comexe/ComTdbExeUtil.cpp               | 137 ++++-
 core/sql/comexe/ComTdbExeUtil.h                 | 123 +++--
 core/sql/common/BaseTypes.cpp                   |  60 ++-
 core/sql/common/ComSmallDefs.h                  |  10 +
 core/sql/common/NAType.cpp                      |  10 +-
 core/sql/common/NumericType.cpp                 | 153 +++++-
 core/sql/common/NumericType.h                   | 195 ++++---
 core/sql/common/SQLTypeDefs.h                   |   5 +
 core/sql/common/dfs2rec.h                       |   8 +-
 core/sql/executor/ExComTdb.cpp                  |   9 +-
 core/sql/executor/ExExeUtil.h                   |  61 ++-
 core/sql/executor/ExExeUtilMisc.cpp             |  68 ++-
 core/sql/executor/ExHbaseAccess.cpp             |  10 +-
 core/sql/executor/ExHbaseIUD.cpp                |   6 +-
 core/sql/exp/ExpErrorEnums.h                    |   4 +-
 core/sql/exp/ExpLOBaccess.cpp                   |  81 ++-
 core/sql/exp/ExpLOBaccess.h                     |   3 +-
 core/sql/exp/ExpPCodeClauseGen.cpp              |   2 -
 core/sql/exp/exp_arith.cpp                      |  99 +---
 core/sql/exp/exp_attrs.cpp                      |   4 +-
 core/sql/exp/exp_clause_derived.h               |  18 +-
 core/sql/exp/exp_comp.cpp                       |  80 +--
 core/sql/exp/exp_conv.cpp                       | 529 +++++++++++++++----
 core/sql/exp/exp_fixup.cpp                      |  44 +-
 core/sql/exp/exp_function.cpp                   | 165 +-----
 core/sql/exp/exp_math_func.cpp                  | 107 +---
 core/sql/generator/GenPreCode.cpp               |  88 ++-
 core/sql/generator/GenRelExeUtil.cpp            | 112 +++-
 core/sql/langman/LmJavaType.cpp                 |  21 +-
 core/sql/langman/LmJavaType.h                   |   1 +
 core/sql/langman/LmResultSetJava.cpp            |  56 +-
 core/sql/langman/LmRoutineCSql.cpp              |  27 +
 core/sql/optimizer/BindRelExpr.cpp              | 104 +---
 core/sql/optimizer/EncodedValue.cpp             |  10 +-
 core/sql/optimizer/ItemExpr.cpp                 |  10 +-
 core/sql/optimizer/ItemFunc.h                   |  36 +-
 core/sql/optimizer/NAColumn.cpp                 |  50 +-
 core/sql/optimizer/NATable.cpp                  |  57 +-
 core/sql/optimizer/OptPhysRelExpr.cpp           |  31 +-
 core/sql/optimizer/OptRange.cpp                 |   2 -
 core/sql/optimizer/RelExeUtil.cpp               | 203 ++++---
 core/sql/optimizer/RelExeUtil.h                 |  94 ++--
 core/sql/optimizer/ValueDesc.cpp                |  66 +--
 core/sql/parser/ParKeyWords.cpp                 |   3 -
 core/sql/parser/StmtDDLAlterLibrary.h           |  14 +
 core/sql/parser/sqlparser.y                     |  92 ++--
 core/sql/regress/core/EXPECTED116               |  76 ++-
 core/sql/regress/core/TEST116                   |  24 +-
 core/sql/regress/executor/EXPECTED022.SB        | 246 ++++++---
 core/sql/regress/executor/TEST022               |  54 +-
 core/sql/regress/hive/EXPECTED005               | 101 +++-
 core/sql/regress/hive/TEST005                   |  59 ++-
 core/sql/regress/hive/tbl_bad.data              |   2 +-
 core/sql/regress/hive/tbl_type.data             |   2 +-
 core/sql/regress/seabase/EXPECTED003            | 425 +++++++++++++++
 core/sql/regress/seabase/TEST003                | 138 +++++
 core/sql/regress/udr/EXPECTED001                |  22 +-
 core/sql/regress/udr/EXPECTED100.SB             |  53 +-
 core/sql/regress/udr/TEST001                    |   5 +
 core/sql/regress/udr/TEST100                    |  13 +
 core/sql/regress/udr/t100.java                  |   4 +
 core/sql/sqlci/Formatter.cpp                    |  14 +-
 core/sql/sqlci/Param.cpp                        |   4 +-
 core/sql/sqlci/SqlciEnv.cpp                     |  28 +-
 core/sql/sqlci/SqlciEnv.h                       |   2 +-
 core/sql/sqlci/sqlci_lex.ll                     |   1 +
 core/sql/sqlci/sqlci_yacc.y                     |   2 +
 core/sql/sqlcomp/CmpSeabaseDDL.h                |  11 +
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp        |  62 ++-
 core/sql/sqlcomp/CmpSeabaseDDLindex.cpp         |  50 +-
 core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp       | 137 ++++-
 core/sql/sqlcomp/DefaultConstants.h             |  28 +-
 core/sql/sqlcomp/nadefaults.cpp                 |  22 +-
 core/sql/ustat/hs_cli.cpp                       |  42 +-
 core/sql/ustat/hs_faststats.cpp                 |   6 +
 core/sql/ustat/hs_globals.cpp                   | 121 +++--
 89 files changed, 3370 insertions(+), 1709 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c351da3a/core/sql/bin/SqlciErrors.txt
----------------------------------------------------------------------
diff --cc core/sql/bin/SqlciErrors.txt
index 867f6b7,0f19d9e..3527854
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@@ -1492,7 -1492,7 +1492,8 @@@ $1~String1 ----------------------------
  8031 HY018 99999 BEGINNER INFRM LOGONLY Server declined cancel request for query ID $0~String0. $1~String1.
  8032 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Explain information for the provided query id is not available in repository.
  8033 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Explain information is too large to be stored in repository.
 -8034 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Truncation of hive table failed. $0~String0
 +8034 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Column $0~String0 of object $1~string0 does not have a default clause but it is missing in database. This indicates inconsistent data.
++8035 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Truncation of hive table failed. $0~String0
  8100 ZZZZZ 99999 BEGINNER MINOR LOGONLY Define $1~string0 does not exist
  8101 23000 99999 BEGINNER MAJOR DBADMIN The operation is prevented by check constraint $0~ConstraintName on table $1~TableName.
  8102 23000 99999 BEGINNER MAJOR DBADMIN The operation is prevented by a unique constraint.

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c351da3a/core/sql/executor/ExHbaseAccess.cpp
----------------------------------------------------------------------
diff --cc core/sql/executor/ExHbaseAccess.cpp
index e51d89f,3072b6c..9a37e27
--- a/core/sql/executor/ExHbaseAccess.cpp
+++ b/core/sql/executor/ExHbaseAccess.cpp
@@@ -1153,32 -1153,6 +1153,32 @@@ Lng32 ExHbaseAccessTcb::createSQRowFrom
               ex_assert(FALSE, "Attr not found -2");
  	  
  	  char * defVal = attr->getDefaultValue();
 +          if (! defVal)
 +            {
 +              char * colVal = (char*)
 +                hbaseAccessTdb().listOfFetchedColNames()->get(idx);
 +
 +              Text colFam, colName;
 +              extractColFamilyAndName(colVal, colFam, colName);
 +
 +              Int64 v = 0;
 +              if (colName.length() == sizeof(char))
 +                v = *(char*)colName.data();
-               else if (colName.length() == sizeof(unsigned short))
++              else if (colName.length() == sizeof(UInt16))
 +                v = *(UInt16*)colName.data();
-               else if (colName.length() == sizeof(Lng32))
++              else if (colName.length() == sizeof(ULng32))
 +                v = *(ULng32*)colName.data();
 +
-               char buf[10];
++              char buf[20];
 +              str_sprintf(buf, "%Ld", v);
 +              ComDiagsArea * diagsArea = NULL;
 +              ExRaiseSqlError(getHeap(), &diagsArea,
-                               (ExeErrorCode)(8034),
-                               NULL, NULL, NULL, NULL, buf);
++                              (ExeErrorCode)(EXE_DEFAULT_VALUE_INCONSISTENT_ERROR),
++                              NULL, NULL, NULL, NULL, buf, hbaseAccessTdb().getTableName());
 +              pentry_down->setDiagsArea(diagsArea);
 +              return -1;
 +            }
 +
  	  char * defValPtr = defVal;
  	  short nullVal = 0;
  	  if (attr->getNullFlag())

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c351da3a/core/sql/exp/ExpErrorEnums.h
----------------------------------------------------------------------
diff --cc core/sql/exp/ExpErrorEnums.h
index 987fe7e,bed50de..6215598
--- a/core/sql/exp/ExpErrorEnums.h
+++ b/core/sql/exp/ExpErrorEnums.h
@@@ -75,8 -75,10 +75,10 @@@ enum ExeErrorCod
    EXE_CANCEL_NOT_AUTHORIZED             = 8029,
    EXE_CANCEL_NOT_POSSIBLE               = 8031,
  
-   EXE_NO_QID_EXPLAIN_INFO                   = 8032,
+   EXE_NO_QID_EXPLAIN_INFO               = 8032,
    EXE_EXPLAIN_PLAN_TOO_LARGE            = 8033,
 -
 -  EXE_HIVE_TRUNCATE_ERROR               = 8034,
++  EXE_DEFAULT_VALUE_INCONSISTENT_ERROR  = 8034,
++  EXE_HIVE_TRUNCATE_ERROR               = 8035,
  
    // ---------------------------------------------------------------------
    // Data integrity errors

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c351da3a/core/sql/generator/GenPreCode.cpp
----------------------------------------------------------------------
diff --cc core/sql/generator/GenPreCode.cpp
index b01df3e,723be31..e8f5163
--- a/core/sql/generator/GenPreCode.cpp
+++ b/core/sql/generator/GenPreCode.cpp
@@@ -2823,33 -2824,44 +2823,34 @@@ short DDLExpr::ddlXnsInfo(NABoolean &is
         (ddlNode->getOperatorType() == DDL_ALTER_TABLE_DROP_COLUMN) ||
         (ddlNode->getOperatorType() == DDL_ALTER_TABLE_ALTER_COLUMN_DATATYPE) ||
         (ddlNode->getOperatorType() == DDL_DROP_TABLE)))
 -    {
 -      // transaction will be started and commited in called methods.
 -      xnCanBeStarted = FALSE;
 -    }
 -
 -  isDDLxn = FALSE;
 -  if ((ddlXns()) || 
 -      ((ddlNode && ddlNode->castToStmtDDLNode() &&
 -        ddlNode->castToStmtDDLNode()->ddlXns())))
 -    isDDLxn = TRUE;
 -
 -  // ddl transactions are on.
 -  // Following commands currently require transactions be started and
 -  // committed in the called methods.
 -  if ((ddlXns()) &&
 -      (
 -           (purgedataHbase()) ||
 -           (upgradeRepos())
 -       )
 -      )
 -    {
 -      // transaction will be started and commited in called methods.
 -      xnCanBeStarted = FALSE;
 -    }
 -
 -  // ddl transactions are on.
 -  // Cleanup and alter commands requires transactions to be started and commited
 -  // in the called method.
 -  if ((ddlNode && ddlNode->castToStmtDDLNode() &&
 -       ddlNode->castToStmtDDLNode()->ddlXns()) &&
 -      ((ddlNode->getOperatorType() == DDL_CLEANUP_OBJECTS) ||
 -       (ddlNode->getOperatorType() == DDL_ALTER_TABLE_DROP_COLUMN) ||
 -       (ddlNode->getOperatorType() == DDL_ALTER_TABLE_ALTER_COLUMN_DATATYPE)))
 -    {
 -      // transaction will be started and commited in called methods.
 -      xnCanBeStarted = FALSE;
 -    }
 -
 +     {
 +        // transaction will be started and commited in called methods.
 +        xnCanBeStarted = FALSE;
 +     }
 +     isDDLxn = FALSE;
 +  }
 +  else  // When the DDL transaction is turned on
 +  {
 +     isDDLxn = FALSE;
 +     if (ddlNode && ddlNode->castToStmtDDLNode() &&
 +        ddlNode->castToStmtDDLNode()->ddlXns())
 +     isDDLxn = TRUE;
 +
 +     if (purgedataHbase() || upgradeRepos())
 +        // transaction will be started and commited in called methods.
 +        xnCanBeStarted = FALSE;
 +     if ((ddlNode && ddlNode->castToStmtDDLNode() &&
 +          ddlNode->castToStmtDDLNode()->ddlXns()) &&
 +            ((ddlNode->getOperatorType() == DDL_CLEANUP_OBJECTS) ||
 +             (ddlNode->getOperatorType() == DDL_ALTER_TABLE_DROP_COLUMN) ||
 +             (ddlNode->getOperatorType() == DDL_CREATE_INDEX) ||
++             (ddlNode->getOperatorType() == DDL_POPULATE_INDEX) ||
 +             (ddlNode->getOperatorType() == DDL_ALTER_TABLE_ALTER_COLUMN_DATATYPE)))
 +     {
 +        // transaction will be started and commited in called methods.
 +        xnCanBeStarted = FALSE;
 +     }
 +  } 
    return 0;
  }
  

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c351da3a/core/sql/regress/core/EXPECTED116
----------------------------------------------------------------------
diff --cc core/sql/regress/core/EXPECTED116
index b3e1201,8e6f410..3932ba7
--- a/core/sql/regress/core/EXPECTED116
+++ b/core/sql/regress/core/EXPECTED116
@@@ -341,7 -341,7 +341,7 @@@ A1           C1           B
  >>invoke t116t1;
  
  -- Definition of Trafodion table TRAFODION.SCH.T116T1
- -- Definition current  Sat Jun 18 04:40:10 2016
 --- Definition current  Tue Mar 22 18:13:32 2016
++-- Definition current  Tue Jun 21 06:53:37 2016
  
    (
      SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -359,7 -359,7 +359,7 @@@
  >>invoke t116t1;
  
  -- Definition of Trafodion table TRAFODION.SCH.T116T1
- -- Definition current  Sat Jun 18 04:40:10 2016
 --- Definition current  Tue Mar 22 18:13:32 2016
++-- Definition current  Tue Jun 21 06:53:37 2016
  
    (
      SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -374,7 -374,7 +374,7 @@@
  >>invoke t116v1;
  
  -- Definition of Trafodion view TRAFODION.SCH.T116V1
- -- Definition current  Sat Jun 18 04:40:10 2016
 --- Definition current  Tue Mar 22 18:13:33 2016
++-- Definition current  Tue Jun 21 06:53:38 2016
  
    (
      A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -391,7 -391,7 +391,7 @@@
  >>invoke t116t1;
  
  -- Definition of Trafodion table TRAFODION.SCH.T116T1
- -- Definition current  Sat Jun 18 04:40:15 2016
 --- Definition current  Tue Mar 22 18:13:40 2016
++-- Definition current  Tue Jun 21 06:53:42 2016
  
    (
      SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -406,7 -406,7 +406,7 @@@
  >>invoke t116v1;
  
  -- Definition of Trafodion view TRAFODION.SCH.T116V1
- -- Definition current  Sat Jun 18 04:40:15 2016
 --- Definition current  Tue Mar 22 18:13:41 2016
++-- Definition current  Tue Jun 21 06:53:43 2016
  
    (
      A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -423,7 -423,7 +423,7 @@@
  >>invoke t116t1;
  
  -- Definition of Trafodion table TRAFODION.SCH.T116T1
- -- Definition current  Sat Jun 18 04:40:18 2016
 --- Definition current  Tue Mar 22 18:13:44 2016
++-- Definition current  Tue Jun 21 06:53:46 2016
  
    (
      SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -438,7 -438,7 +438,7 @@@
  >>invoke t116v1;
  
  -- Definition of Trafodion view TRAFODION.SCH.T116V1
- -- Definition current  Sat Jun 18 04:40:18 2016
 --- Definition current  Tue Mar 22 18:13:45 2016
++-- Definition current  Tue Jun 21 06:53:46 2016
  
    (
      A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -456,7 -456,7 +456,7 @@@
  >>invoke t116t1;
  
  -- Definition of Trafodion table TRAFODION.SCH.T116T1
- -- Definition current  Sat Jun 18 04:40:18 2016
 --- Definition current  Tue Mar 22 18:13:45 2016
++-- Definition current  Tue Jun 21 06:53:46 2016
  
    (
      SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -471,7 -471,7 +471,7 @@@
  >>invoke t116v1;
  
  -- Definition of Trafodion view TRAFODION.SCH.T116V1
- -- Definition current  Sat Jun 18 04:40:18 2016
 --- Definition current  Tue Mar 22 18:13:45 2016
++-- Definition current  Tue Jun 21 06:53:46 2016
  
    (
      A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -488,7 -488,7 +488,7 @@@
  >>invoke t116t1;
  
  -- Definition of Trafodion table TRAFODION.SCH.T116T1
- -- Definition current  Sat Jun 18 04:40:23 2016
 --- Definition current  Tue Mar 22 18:13:52 2016
++-- Definition current  Tue Jun 21 06:53:53 2016
  
    (
      SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -503,7 -503,7 +503,7 @@@
  >>invoke t116v1;
  
  -- Definition of Trafodion view TRAFODION.SCH.T116V1
- -- Definition current  Sat Jun 18 04:40:23 2016
 --- Definition current  Tue Mar 22 18:13:52 2016
++-- Definition current  Tue Jun 21 06:53:53 2016
  
    (
      A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -521,7 -521,7 +521,7 @@@
  >>invoke t116t1;
  
  -- Definition of Trafodion table TRAFODION.SCH.T116T1
- -- Definition current  Sat Jun 18 04:40:27 2016
 --- Definition current  Tue Mar 22 18:13:57 2016
++-- Definition current  Tue Jun 21 06:53:58 2016
  
    (
      SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -536,7 -536,7 +536,7 @@@
  >>invoke t116v1;
  
  -- Definition of Trafodion view TRAFODION.SCH.T116V1
- -- Definition current  Sat Jun 18 04:40:27 2016
 --- Definition current  Tue Mar 22 18:13:58 2016
++-- Definition current  Tue Jun 21 06:53:58 2016
  
    (
      A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -583,6 -583,6 +583,7 @@@ Copyright (c) 2015-2016 Apache Softwar
  *** ERROR[8605] Committing a transaction which has not started.
  
  --- SQL operation failed with errors.
++>>
  >>exit;
  
  End of MXCI Session
@@@ -594,7 -594,7 +595,7 @@@
  >>invoke t116t1;
  
  -- Definition of Trafodion table TRAFODION.SCH.T116T1
- -- Definition current  Sat Jun 18 04:40:40 2016
 --- Definition current  Tue Mar 22 18:14:15 2016
++-- Definition current  Tue Jun 21 06:54:14 2016
  
    (
      SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -709,7 -709,7 +710,7 @@@ T116T
  >>invoke t116t2;
  
  -- Definition of Trafodion table TRAFODION.T116SCH1.T116T2
- -- Definition current  Sat Jun 18 04:41:56 2016
 --- Definition current  Tue Mar 22 18:15:37 2016
++-- Definition current  Tue Jun 21 06:55:12 2016
  
    (
      SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -734,7 -734,7 +735,7 @@@
  >>invoke t116t2;
  
  -- Definition of Trafodion table TRAFODION.T116SCH1.T116T2
- -- Definition current  Sat Jun 18 04:41:59 2016
 --- Definition current  Tue Mar 22 18:15:41 2016
++-- Definition current  Tue Jun 21 06:55:17 2016
  
    (
      SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@@ -761,58 -761,5 +762,93 @@@
  >>rollback work;
  
  --- SQL operation complete.
 +>>set transaction autocommit on;
 +
 +--- SQL operation complete.
 +>>
 +>>-- index creation checking
 +>>-- index creation is done with multiple transactions
 +>>-- to avoid populating the index within the transaction
- >>drop table if exists t116t5;
- 
- --- SQL operation complete.
 +>>create table t116t5 (c1 int not null primary key, c2 int, c3 int) ;
 +
 +--- SQL operation complete.
 +>>insert into t116t5 values (1,1,1), (2,2,2), (3,3,2);
 +
 +--- 3 row(s) inserted.
 +>>-- create index - Second attempt should fail 
 +>>create index t116t5_i1 on t116t5(c2);
 +
 +--- SQL operation complete.
 +>>create index t116t5_i1 on t116t5(c2);
 +
 +*** ERROR[1390] Object TRAFODION.T116SCH1.T116T5_I1 already exists in Trafodion.
 +
 +--- SQL operation failed with errors.
 +>>set parserflags 1;
 +
 +--- SQL operation complete.
 +>>select count(*) from table(index_table t116t5_i1);
 +
 +(EXPR)              
 +--------------------
 +
 +                   3
 +
 +--- 1 row(s) selected.
 +>>-- create unique index - Both attempts should fail with the same error
 +>>create unique index t116t5_i2 on t116t5(c3);
 +
 +*** ERROR[8110] Duplicate rows detected.
 +
 +*** ERROR[1053] Unique index TRAFODION.T116SCH1.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
 +
 +--- SQL operation failed with errors.
 +>>create unique index t116t5_i2 on t116t5(c3);
 +
 +*** ERROR[8110] Duplicate rows detected.
 +
 +*** ERROR[1053] Unique index TRAFODION.T116SCH1.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
 +
 +--- SQL operation failed with errors.
- >>drop table t116t5 ;
++>>-- create unique index with no populate
++>>create unique index t116t5_i2 on t116t5(c3) no populate;
++
++--- SQL operation complete.
++>>-- Both attempts should fail with the same error
++>>populate index t116t5_i2 on t116t5;
++
++*** ERROR[8110] Duplicate rows detected.
++
++*** ERROR[1053] Unique index TRAFODION.T116SCH1.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
++
++--- SQL operation failed with errors.
++>>populate index t116t5_i2 on t116t5;
++
++*** ERROR[8110] Duplicate rows detected.
++
++*** ERROR[1053] Unique index TRAFODION.T116SCH1.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
++
++--- SQL operation failed with errors.
++>>
++>>obey TEST116(clean_up);
++>>drop table t116t1;
++
++--- SQL operation complete.
++>>drop table t116t2;
++
++--- SQL operation complete.
++>>drop table t116t3;
++
++*** ERROR[1389] Object TRAFODION.T116SCH1.T116T3 does not exist in Trafodion.
++
++--- SQL operation failed with errors.
++>>drop table t116t4;
++
++*** ERROR[1389] Object TRAFODION.T116SCH1.T116T4 does not exist in Trafodion.
++
++--- SQL operation failed with errors.
++>>drop table t116t5;
 +
 +--- SQL operation complete.
+ >>
  >>log;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c351da3a/core/sql/regress/core/TEST116
----------------------------------------------------------------------
diff --cc core/sql/regress/core/TEST116
index 5380d71,0755b7d..d326463
--- a/core/sql/regress/core/TEST116
+++ b/core/sql/regress/core/TEST116
@@@ -29,12 -29,11 +29,7 @@@
  
  
  ?section main
--drop table t116t1;
--drop table t116t2;
--drop table t116t3;
--drop table t116t3;
- drop table t116t4;
- drop table t116t5;
 -
++obey TEST116(clean_up);
  
  log LOG116 clear;
  control query default DDL_TRANSACTIONS 'ON';
@@@ -215,23 -214,7 +210,28 @@@ purgedata t116t2
  alter table t116t2 alter column a largeint;
  cleanup table t116t2;
  rollback work;
 -
 +set transaction autocommit on;
 +
 +-- index creation checking
 +-- index creation is done with multiple transactions
 +-- to avoid populating the index within the transaction
- drop table if exists t116t5;
 +create table t116t5 (c1 int not null primary key, c2 int, c3 int) ;
 +insert into t116t5 values (1,1,1), (2,2,2), (3,3,2);
 +-- create index - Second attempt should fail 
 +create index t116t5_i1 on t116t5(c2);
 +create index t116t5_i1 on t116t5(c2);
 +set parserflags 1;
 +select count(*) from table(index_table t116t5_i1);
 +-- create unique index - Both attempts should fail with the same error
 +create unique index t116t5_i2 on t116t5(c3);
 +create unique index t116t5_i2 on t116t5(c3);
- drop table t116t5 ;
++-- create unique index with no populate
++create unique index t116t5_i2 on t116t5(c3) no populate;
++-- Both attempts should fail with the same error
++populate index t116t5_i2 on t116t5;
++populate index t116t5_i2 on t116t5;
++
++obey TEST116(clean_up);
  log;
  exit;
  
@@@ -242,3 -225,3 +242,11 @@@ begin work
  -- should fail
  create table t116t1 (a int);
  commit work;
++
++?section clean_up
++drop table t116t1;
++drop table t116t2;
++drop table t116t3;
++drop table t116t4;
++drop table t116t5;
++

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c351da3a/core/sql/sqlcomp/CmpSeabaseDDL.h
----------------------------------------------------------------------
diff --cc core/sql/sqlcomp/CmpSeabaseDDL.h
index ada6a01,730dff1..910625b
--- a/core/sql/sqlcomp/CmpSeabaseDDL.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDL.h
@@@ -912,8 -912,8 +912,16 @@@ class CmpSeabaseDD
                                 const NAString &schName,
                                 const NAString &objName,
                                 const ComObjectType objectType,
 -                               NABoolean ddlXns);
 -  
 +                               NABoolean dontForceCleanup);
 +
++  void purgedataObjectAfterError(
++                               ExeCliInterface &cliInterface,
++                               const NAString &catName, 
++                               const NAString &schName,
++                               const NAString &objName,
++                               const ComObjectType objectType,
++                               NABoolean dontForceCleanup);
++
    short createSeabaseTable2(
                              ExeCliInterface &cliInterface,
                              StmtDDLCreateTable * createTableNode,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c351da3a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------
diff --cc core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
index 8461a21,dccb58d..d337c33
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
@@@ -5460,10 -5462,6 +5462,55 @@@ void CmpSeabaseDDL::cleanupObjectAfterE
    return;
  }
  
- // user created traf stored col fam is of the form:  #<1-byte-num>
- //  1-byte-num is character '2' through '9', or 'a' through 'x'.
- // This allows for 32 column families and
++void CmpSeabaseDDL::purgedataObjectAfterError(
++                                            ExeCliInterface &cliInterface,
++                                            const NAString &catName, 
++                                            const NAString &schName,
++                                            const NAString &objName,
++                                            const ComObjectType objectType,
++                                            NABoolean dontForceCleanup)
++{
++
++  //if ddlXns are being used, no need of additional cleanup.
++  //transactional rollback will take care of cleanup.
++  if (dontForceCleanup)
++    return;
++
++  PushAndSetSqlParserFlags savedParserFlags(INTERNAL_QUERY_FROM_EXEUTIL);
++    
++  Lng32 cliRC = 0;
++  char buf[1000];
++
++  // save current diags area
++  ComDiagsArea * tempDiags = ComDiagsArea::allocate(heap_);
++  tempDiags->mergeAfter(*CmpCommon::diags());
++  
++  CmpCommon::diags()->clear();
++  if (objectType == COM_BASE_TABLE_OBJECT)
++    str_sprintf(buf, "purgedata \"%s\".\"%s\".\"%s\" ",
++                catName.data(), schName.data(), objName.data());
++  else if (objectType == COM_INDEX_OBJECT)
++    str_sprintf(buf, "purgedata table(index_table \"%s\".\"%s\".\"%s\" ) ",
++                catName.data(), schName.data(), objName.data());
++  else 
++    ex_assert(0, "purgedata object is not supported");
++    
++  cliRC = cliInterface.executeImmediate(buf);
++  CmpCommon::diags()->clear();
++  CmpCommon::diags()->mergeAfter(*tempDiags);
++
++  if (cliRC < 0)
++    {
++      cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
++    }
++
++  tempDiags->clear();
++  tempDiags->deAllocate();
++
++  return;
++}
++
 +
  // user created traf stored col fam is of the form:  #<1-byte-num>
  //  1-byte-num is character '2' through '9', or 'a' through 'x'.
  // This allows for 32 column families and

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c351da3a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
----------------------------------------------------------------------
diff --cc core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
index 981e4f5,a70f8ef..b6bed23
--- a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
@@@ -1371,43 -1372,43 +1371,41 @@@ void CmpSeabaseDDL::populateSeabaseInde
  					    naf->uniqueIndex(),
  					    nafIndexName, tableName, selColList,
  	                                    useLoad))
--	    {
--	      // need to purgedata seabase index. TBD.
--	      
--	      //	      if (cmpDropSeabaseObject(createIndexNode->getIndexName(),
--	      //				     currCatName, currSchName, COM_INDEX_OBJECT_LIT))
--	      //			return;
--
--	      processReturn();
--
--              goto label_return;
--	    }
++	  {
++	    processReturn();
++            goto purgedata_return;
++	  }
        
--      if (updateObjectAuditAttr(&cliInterface, 
++          if (updateObjectAuditAttr(&cliInterface, 
  				catalogNamePart, schemaNamePart, objectNamePart,
  				TRUE, COM_INDEX_OBJECT_LIT))
--	{
--	  processReturn();
--	  
--          goto label_return;
--	}
--      
--      if (updateObjectValidDef(&cliInterface, 
++	  {
++	     processReturn();
++             goto purgedata_return;
++	  }
++
++          if (updateObjectValidDef(&cliInterface, 
  			       catalogNamePart, schemaNamePart, objectNamePart,
  			       COM_INDEX_OBJECT_LIT,
  			       "Y"))
--	{
--	  processReturn();
--
--          goto label_return;
--	}
--
++	  {
++	     processReturn();
++             goto purgedata_return;
++	  }
        }
      } // for
  
   label_return:
    processReturn();
--      
++  return;
++ purgedata_return:
++  updateObjectAuditAttr(&cliInterface, 
++                 catalogNamePart, schemaNamePart, objectNamePart,
++                 TRUE, COM_INDEX_OBJECT_LIT);
++  NABoolean dontForceCleanup = FALSE;
++  purgedataObjectAfterError(cliInterface,
++                               catalogNamePart, schemaNamePart, objectNamePart, COM_INDEX_OBJECT, dontForceCleanup);
++  processReturn();
    return;
  }