Return-Path: X-Original-To: apmail-trafodion-commits-archive@www.apache.org Delivered-To: apmail-trafodion-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 92B5710DBF for ; Tue, 8 Sep 2015 19:33:42 +0000 (UTC) Received: (qmail 50132 invoked by uid 500); 8 Sep 2015 19:33:36 -0000 Delivered-To: apmail-trafodion-commits-archive@trafodion.apache.org Received: (qmail 50101 invoked by uid 500); 8 Sep 2015 19:33:36 -0000 Mailing-List: contact commits-help@trafodion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: commits@trafodion.apache.org Delivered-To: mailing list commits@trafodion.apache.org Received: (qmail 50092 invoked by uid 99); 8 Sep 2015 19:33:36 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Sep 2015 19:33:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B9108E0388 for ; Tue, 8 Sep 2015 19:33:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id I76jXWHdZ0xM for ; Tue, 8 Sep 2015 19:33:28 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 064D020489 for ; Tue, 8 Sep 2015 19:33:28 +0000 (UTC) Received: (qmail 49892 invoked by uid 99); 8 Sep 2015 19:33:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Sep 2015 19:33:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B2C3AE0664; Tue, 8 Sep 2015 19:33:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sureshs@apache.org To: commits@trafodion.incubator.apache.org Date: Tue, 08 Sep 2015 19:33:28 -0000 Message-Id: <29809c90a34f460495bdffa2a0516567@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/4] incubator-trafodion git commit: JIRA TRAFODION-19 && TRAFODION-1483 JIRA TRAFODION-19 && TRAFODION-1483 JIRA TRAFODION-19: Made the following changes: Removed support for locklength from the parser Test and fix issues with create table variants Made recommended changes as mentioned in the initial delivery Rename some of the variable names to make them more informative Assume prefix length for HIVE and HBASE tables can be different and verify code works correctly Fix commented code to be correct and remove lines no longer needed Update error text for messages 1180 to include external table type Beefed up the new regression test (hive/TEST009) Check column list from hive descriptor with external table description and return an error if there is a mismatch Add an error if the user specifies a different target schema name than the source Allow someone with privileges to drop HIVE exernal schemas JIRA TRAFODION-1483: Added support for external HBase tables similar to Hive table support Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/2e0b1ddf Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/2e0b1ddf Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/2e0b1ddf Branch: refs/heads/master Commit: 2e0b1ddf10efbd09fe027ce3af00aef7ba821271 Parents: 40c2786 Author: Roberta Marton Authored: Fri Sep 4 17:09:32 2015 +0000 Committer: Roberta Marton Committed: Fri Sep 4 17:09:32 2015 +0000 ---------------------------------------------------------------------- core/sql/bin/SqlciErrors.txt | 6 +- core/sql/common/ComMisc.cpp | 66 +++- core/sql/common/ComMisc.h | 9 +- core/sql/common/ComObjectName.h | 29 +- core/sql/common/ComSmallDefs.h | 1 + core/sql/common/OperTypeEnum.h | 1 - core/sql/optimizer/BindRelExpr.cpp | 50 ++- core/sql/optimizer/BindWA.cpp | 2 +- core/sql/optimizer/BindWA.h | 15 +- core/sql/optimizer/NAFileSet.cpp | 2 - core/sql/optimizer/NAFileSet.h | 1 - core/sql/optimizer/NATable.cpp | 140 +++++---- core/sql/optimizer/ObjectNames.h | 15 +- core/sql/optimizer/RelExeUtil.cpp | 28 +- core/sql/parser/AllElemDDLFileAttr.h | 1 - core/sql/parser/ElemDDLFileAttr.cpp | 32 -- core/sql/parser/ElemDDLNode.cpp | 6 - core/sql/parser/ElemDDLNode.h | 2 - core/sql/parser/ParDDLFileAttrs.cpp | 84 ----- core/sql/parser/ParDDLFileAttrsAlterTable.h | 28 -- core/sql/parser/ParDDLFileAttrsCreateIndex.h | 28 -- core/sql/parser/ParKeyWords.cpp | 1 - core/sql/parser/StmtDDLAlter.cpp | 1 - core/sql/parser/StmtDDLCreate.cpp | 4 - core/sql/parser/StmtDDLDrop.cpp | 3 +- core/sql/parser/sqlparser.y | 13 - core/sql/regress/hive/EXPECTED009 | 311 ++++++++++++++++++- core/sql/regress/hive/TEST009 | 106 ++++++- .../hive/TEST009_create_hbase_objects.hbase | 55 ++++ core/sql/sqlcomp/CmpDDLCatErrorCodes.h | 2 +- core/sql/sqlcomp/CmpDescribe.cpp | 11 +- core/sql/sqlcomp/CmpSeabaseDDL.h | 10 +- core/sql/sqlcomp/CmpSeabaseDDLschema.cpp | 8 +- core/sql/sqlcomp/CmpSeabaseDDLtable.cpp | 242 ++++++++------- 34 files changed, 848 insertions(+), 465 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/bin/SqlciErrors.txt ---------------------------------------------------------------------- diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt index 5dac5a5..7a900f6 100644 --- a/core/sql/bin/SqlciErrors.txt +++ b/core/sql/bin/SqlciErrors.txt @@ -130,7 +130,7 @@ 1128 ZZZZZ 99999 ADVANCED CRTCL DIALOUT An invalid API request was encountered. Details: $0~String0. 1129 ZZZZZ 99999 BEGINNER MINOR DBADMIN This operation is not allowed on a vertically partitioned table. 1130 ZZZZZ 99999 BEGINNER MINOR DBADMIN The column requires a default value. -1131 ZZZZZ 99999 BEGINNER MINOR DBADMIN A column cannot be added to an entry-sequenced table. +1131 ZZZZZ 99999 BEGINNER MINOR DBADMIN There is an existing Trafodion external table, please drop it before dropping native table 0~TableName. 1132 ZZZZZ 99999 BEGINNER MINOR DBADMIN An added column cannot have DEFAULT NULL and NOT NULL values at the same time. 1133 ZZZZZ 99999 BEGINNER MINOR DBADMIN Only super ID can perform this operation. 1134 ZZZZZ 99999 BEGINNER MINOR DBADMIN A concurrent utility or DDL operation is being performed on object $0~TableName, its parent, or one of its dependencies. That operation must complete before the requested operation can run. @@ -179,7 +179,7 @@ 1177 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Internal error: trying to create an object with a qualified name type of $0~string0. This qualified name type is not supported. 1178 ZZZZZ 99999 ADVANCED MAJOR DIALOUT Internal error: unable to find catalog associated with uid $0~string0. This catalog is being accessed by role $1~string1. 1179 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Internal error: inconsistent object definition for $0~TableName found for object in name space $0~string0. Object owned by $1~string1. Unable to find object details in $2~string2; -1180 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Trying to create an external table $0~TableName with a different schema or table name than the source table $1~TableName. The external schema and table name must be the same as the source. +1180 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Trying to create an external $0~String0 table with a different schema or table name ($1~TableName) than the source table ($2~String1). The external schema and table name must be the same as the source. 1181 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Trying to create a schema with name $0~TableName to store the definition of a native HIVE or HBASE table and the name is too long. Maximum length supported is $0~Int0. 1182 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Error $0~NSKCode was returned by the file system on resource fork $1~String0. 1183 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Error $0~NSKCode was returned by the file system on metadata table $1~TableName (file name $2~String0). @@ -825,7 +825,7 @@ $1~String1 -------------------------------- 3075 42000 99999 BEGINNER MAJOR DBADMIN The [NO]COMPRESS clause is not allowed in the ALTER INDEX ... ATTRIBUTE(S) statement. 3076 42000 99999 BEGINNER MAJOR DBADMIN Duplicate DEALLOCATE clauses were specified. 3077 42000 99999 BEGINNER MAJOR DBADMIN The [NO]ICOMPRESS clause is not allowed in the ALTER INDEX ... ATTRIBUTE(S) statement. -3078 42000 99999 BEGINNER MAJOR DBADMIN The LOCKLENGTH clause is not allowed in the ALTER INDEX ... ATTRIBUTE(S) statement. +3078 ZZZZZ 99999 BEGINNER MAJOR DBADMIN The column list for $1~TableName does not match its external table representation defined as $0~String0. 3079 42000 99999 BEGINNER MAJOR DBADMIN Duplicate EXTENT/MAXEXTENTS clauses were specified. 3080 0A000 99999 BEGINNER MAJOR DBADMIN The $0~string0 clause is not supported. 3081 42000 99999 BEGINNER MAJOR DBADMIN Duplicate ALLOCATE clauses were specified. http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/common/ComMisc.cpp ---------------------------------------------------------------------- diff --git a/core/sql/common/ComMisc.cpp b/core/sql/common/ComMisc.cpp index 16bb69c..6882696 100644 --- a/core/sql/common/ComMisc.cpp +++ b/core/sql/common/ComMisc.cpp @@ -40,6 +40,7 @@ #include "ComASSERT.h" #include "ComMisc.h" #include "ComDistribution.h" // enumToLiteral, literalToEnum, literalAndEnumStruct +#include "CmpSeabaseDDL.h" // define the enum-to-literal function #define ComDefXLateE2L(E2L,eType,array) void E2L (const eType e, NAString &l) \ @@ -99,17 +100,74 @@ NABoolean ComIsTrafodionReservedSchemaName( return FALSE; } -// schema names of pattern "_HV ... _" and "_HB_ ... _" are reserved to store +// schema names of pattern "_HV_ ... _" and "_HB_ ... _" are reserved to store // external hive and hbase tables NABoolean ComIsTrafodionExternalSchemaName ( const NAString &schName) { Int32 len (schName.length()); + + // check for HIVE Int32 prefixLen = sizeof(HIVE_EXT_SCHEMA_PREFIX); if (len > prefixLen && - (schName(0,prefixLen-1) == HIVE_EXT_SCHEMA_PREFIX || - schName(0,prefixLen-1) == HBASE_EXT_SCHEMA_PREFIX) && - schName(len-1) == '_' ) + (schName(0,prefixLen-1) == HIVE_EXT_SCHEMA_PREFIX && + schName(len-1) == '_' )) return TRUE; + + // check for HBASE + prefixLen = sizeof(HBASE_EXT_SCHEMA_PREFIX); + if (len > prefixLen && + (schName(0,prefixLen-1) == HBASE_EXT_SCHEMA_PREFIX && + schName(len-1) == '_' )) + return TRUE; + return FALSE; } + +// ---------------------------------------------------------------------------- +// function: ComConvertNativeNameToTrafName +// +// this fuction converts the native HIVE or HBASE object name into its +// Trafodion external name format. +// +// params: +// catalogName - catalog name to identify HBASE or HIVE native table +// schemaName - external name of the HBASE or HIVE schema +// objectName - external name of the HBASE of HIVE table +// +// If it is not HIVE or HBASE, just return the qualified name +// ---------------------------------------------------------------------------- +NAString ComConvertNativeNameToTrafName ( + const NAString &catalogName, + const NAString &schemaName, + const NAString &objectName) +{ + // generate new schema name + NAString tempSchemaName; + if (catalogName == HIVE_SYSTEM_CATALOG) + tempSchemaName += HIVE_EXT_SCHEMA_PREFIX; + else if(catalogName == HBASE_SYSTEM_CATALOG) + tempSchemaName += HBASE_EXT_SCHEMA_PREFIX; + else + return catalogName + NAString(".") + + schemaName + NAString(".") + + objectName; + + ComAnsiNamePart externalAnsiName(schemaName, ComAnsiNamePart::EXTERNAL_FORMAT); + tempSchemaName += externalAnsiName.getInternalName(); + tempSchemaName.append ("_"); + + // Catalog name is "TRAFODION" + NAString convertedName (CmpSeabaseDDL::getSystemCatalogStatic()); + convertedName += "."; + + // append transformed schema name, convert internal name to external format + ComAnsiNamePart internalAnsiName(tempSchemaName, ComAnsiNamePart::INTERNAL_FORMAT); + convertedName += internalAnsiName.getExternalName(); + + // object name is appended without change + convertedName += NAString(".") + objectName; + + return convertedName; +} + http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/common/ComMisc.h ---------------------------------------------------------------------- diff --git a/core/sql/common/ComMisc.h b/core/sql/common/ComMisc.h index 7815e06..2a6f415 100644 --- a/core/sql/common/ComMisc.h +++ b/core/sql/common/ComMisc.h @@ -50,9 +50,14 @@ NABoolean ComIsTrafodionReservedSchema( const NAString &catName, const NAString &schName); -// schema names of pattern "_HV ... _" and "_HB_ ... _" are reserved to store +// schema names of pattern "_HV_ ... _" and "_HB_ ... _" are reserved to store // external hive and hbase tables NABoolean ComIsTrafodionExternalSchemaName ( - const NAString &schName); + const NAString &schName); + +NAString ComConvertNativeNameToTrafName ( + const NAString &catalogName, + const NAString &schemaName, + const NAString &objectName); #endif // COMMISC_H http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/common/ComObjectName.h ---------------------------------------------------------------------- diff --git a/core/sql/common/ComObjectName.h b/core/sql/common/ComObjectName.h index 10dedbe..1bbc09d 100644 --- a/core/sql/common/ComObjectName.h +++ b/core/sql/common/ComObjectName.h @@ -61,6 +61,7 @@ using namespace std; #include "ComAnsiNamePart.h" #include "ComRoutineActionNamePart.h" #include "ComSchemaName.h" +#include "ComMisc.h" // ----------------------------------------------------------------------- // forward declarations @@ -280,8 +281,8 @@ class ComObjectName : public NABasicObject void setIsVolatile(NABoolean v) { (v ? flags_ |= IS_VOLATILE : flags_ &= ~IS_VOLATILE);} - inline NABoolean isExternalHive(); - inline NABoolean isExternalHbase(); + inline NABoolean isExternalHive() const; + inline NABoolean isExternalHbase() const; protected: @@ -603,16 +604,12 @@ ComObjectName::isValid() const // returns TRUE if it is a HIVE schema // ---------------------------------------------------------------------------- NABoolean -ComObjectName::isExternalHive() +ComObjectName::isExternalHive() const { - if (schemaNamePart_.isEmpty()) - return FALSE; - NAString schemaName(schemaNamePart_.getInternalName()); - Int32 len (schemaName.length()); - if (len > sizeof(HIVE_EXT_SCHEMA_PREFIX)) - return (schemaName(0,sizeof(HIVE_EXT_SCHEMA_PREFIX)-1) == HIVE_EXT_SCHEMA_PREFIX && - schemaName(len-1) == '_'); + + if (ComIsTrafodionExternalSchemaName(schemaName)) + return (schemaName(0,sizeof(HIVE_EXT_SCHEMA_PREFIX)-1) == HIVE_EXT_SCHEMA_PREFIX); return FALSE; } @@ -625,16 +622,12 @@ ComObjectName::isExternalHive() // returns TRUE if it is a hbase schema // ---------------------------------------------------------------------------- NABoolean -ComObjectName::isExternalHbase() +ComObjectName::isExternalHbase() const { - if (schemaNamePart_.isEmpty()) - return FALSE; - NAString schemaName(schemaNamePart_.getInternalName()); - Int32 len (schemaName.length()); - if (len > sizeof(HBASE_EXT_SCHEMA_PREFIX)) - return (schemaName(0,sizeof(HBASE_EXT_SCHEMA_PREFIX)-1) == HBASE_EXT_SCHEMA_PREFIX && - schemaName(len-1) == '_'); + + if (ComIsTrafodionExternalSchemaName(schemaName)) + return (schemaName(0,sizeof(HBASE_EXT_SCHEMA_PREFIX)-1) == HBASE_EXT_SCHEMA_PREFIX); return FALSE; } http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/common/ComSmallDefs.h ---------------------------------------------------------------------- diff --git a/core/sql/common/ComSmallDefs.h b/core/sql/common/ComSmallDefs.h index 7fe3a73..028ca1b 100644 --- a/core/sql/common/ComSmallDefs.h +++ b/core/sql/common/ComSmallDefs.h @@ -1072,6 +1072,7 @@ enum ComRowFormat { COM_UNKNOWN_FORMAT_TYPE , COM_ALIGNED_FORMAT_TYPE , COM_HBASE_FORMAT_TYPE , COM_HIVE_EXTERNAL_FORMAT_TYPE + , COM_HBASE_EXTERNAL_FORMAT_TYPE }; #define COM_ROWFORMAT_LIT_LEN 2 http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/common/OperTypeEnum.h ---------------------------------------------------------------------- diff --git a/core/sql/common/OperTypeEnum.h b/core/sql/common/OperTypeEnum.h index 17eb793..d6bb8cf 100644 --- a/core/sql/common/OperTypeEnum.h +++ b/core/sql/common/OperTypeEnum.h @@ -1009,7 +1009,6 @@ enum OperatorTypeEnum { // of class ElemDDLFileAttr. ELM_FILE_ATTR_LIST, ELM_PARTN_ATTR_LIST, - ELM_FILE_ATTR_LOCK_LENGTH_ELEM, ELM_FILE_ATTR_MAX_SIZE_ELEM, ELM_FILE_ATTR_NO_LABEL_UPDATE_ELEM, ELM_FILE_ATTR_OWNER_ELEM, http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/optimizer/BindRelExpr.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp index 7cb7b05..2d400bb 100644 --- a/core/sql/optimizer/BindRelExpr.cpp +++ b/core/sql/optimizer/BindRelExpr.cpp @@ -1569,12 +1569,11 @@ NATable *BindWA::getNATable(CorrName& corrName, ((QualifiedName&)(table->getTableName())).setIsVolatile(TRUE); } - // For now, do not allow access through the Trafodion external name created for - // the HIVE object unless the inDDL flag is set. inDDL is set for drop - // table and SHOWDDL statements. - // TDB - may want to merge the Trafodion version with the HIVE version. - // TDB - similar operation may be needed for external HBase tables - if ((table) && (table->isExternalTable() && (! bindWA->inDDL()))) + // For now, don't allow access through the Trafodion external name created for + // native HIVE or HBASE objects unless the allowExternalTables flag is set. + // allowExternalTables is set for drop table and SHOWDDL statements. + // TDB - may want to merge the Trafodion version with the native version. + if ((table) && (table->isExternalTable() && (! bindWA->allowExternalTables()))) { *CmpCommon::diags() << DgSqlCode(-4258) << DgTableName(table->getTableName().getQualifiedNameAsAnsiString()); @@ -1582,18 +1581,45 @@ NATable *BindWA::getNATable(CorrName& corrName, bindWA->setErrStatus(); return NULL; } + + // If the table is a native table and has an associated external table, + // check to see if the external table structure still matches the native table + // If not, return an error + if ((table) && table->hasExternalTable()) + { + NAString adjustedName = ComConvertNativeNameToTrafName + (table->getTableName().getCatalogName(), + table->getTableName().getUnqualifiedSchemaNameAsAnsiString(), + table->getTableName().getUnqualifiedObjectNameAsAnsiString()); + + // Get a description of the associated Trafodion table + Int32 numNameParts = 3; + QualifiedName adjustedQualName(adjustedName,numNameParts,STMTHEAP, bindWA); + CorrName externalCorrName(adjustedQualName, STMTHEAP); + NATable *externalNATable = bindWA->getSchemaDB()->getNATableDB()-> + get(externalCorrName, bindWA, inTableDescStruct); + + // Should always have an external table, the hasExternalTable() flag indicates + // that it exists. + CMPASSERT(externalNATable); + // Compare column lists + // TBD - return what mismatches + if (!(table->getNAColumnArray() == externalNATable->getNAColumnArray())) + { + *CmpCommon::diags() << DgSqlCode(-3078) + << DgString0(adjustedName) + << DgTableName(table->getTableName().getQualifiedNameAsAnsiString()); + bindWA->setErrStatus(); + externalNATable->setRemoveFromCacheBNC(TRUE); + return NULL; + } + } HostVar *proto = corrName.getPrototype(); if (proto && proto->isPrototypeValid()) corrName.getPrototype()->bindNode(bindWA); - // Solution 10-040518-6149: When we bind the view as part of the compound - // create schema statement, we need to reset referenceCount_ of the base - // table to zero. Otherwise, error 1109 would be reported. - if ( bindWA->isCompoundCreateSchema() && bindWA->inViewDefinition() ) - table->resetReferenceCount(); - // This test is not "inAnyConstraint()" because we DO want to increment // the count for View With Check Option constraints. if (!getCurrentScope()->context()->inTableCheckConstraint() && http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/optimizer/BindWA.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/BindWA.cpp b/core/sql/optimizer/BindWA.cpp index 3d3a23d..ce83134 100644 --- a/core/sql/optimizer/BindWA.cpp +++ b/core/sql/optimizer/BindWA.cpp @@ -131,7 +131,7 @@ BindWA::BindWA(SchemaDB *schemaDB, CmpContext* cmpContext, NABoolean inDDL) // , inRIMaint_(FALSE) , inViewWithCheckOption_(NULL) , viewCount_(0) - , compoundCreateSchema_(FALSE) + , allowExternalTables_(FALSE) , errFlag_(FALSE) , uniqueNum_(0) , uniqueIudNum_(0) //++Triggers, http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/optimizer/BindWA.h ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/BindWA.h b/core/sql/optimizer/BindWA.h index 8894593..11b1fdd 100644 --- a/core/sql/optimizer/BindWA.h +++ b/core/sql/optimizer/BindWA.h @@ -1480,8 +1480,8 @@ public: short &viewCount() { return viewCount_; } - NABoolean isCompoundCreateSchema() const { return compoundCreateSchema_; } - void setCompoundCreateSchema(NABoolean t) { compoundCreateSchema_ = t; } + NABoolean allowExternalTables() const { return allowExternalTables_; } + void setAllowExternalTables(NABoolean t) { allowExternalTables_ = t; } LIST(OptSqlTableOpenInfo *) &getStoiList() { return stoiList_; } LIST(OptUdrOpenInfo *) &getUdrStoiList() { return udrStoiList_; } @@ -1818,15 +1818,10 @@ private: short viewCount_; // -------------------------------------------------------------------- - // Flag to indicate we are compiling a compound create schema statement. - // When we bind the view as part of the compound create schema statement, - // we need to reset referenceCount_ of the base table to zero. The - // base table is of class NATable. Otherwise, error 1109 would be - // reported. The referencCount_ is reset in BindWA:getNATable, - // BindRelExpr.cpp. This flag is introduced for this purpose to fix - // solution 10-040518-6149. + // Flag to indicate we are accessing an object which is defined in an + // external (native) hive or hbase. // -------------------------------------------------------------------- - NABoolean compoundCreateSchema_; + NABoolean allowExternalTables_; // points to a class used by RowSets code. HostArraysWA *hostArraysArea_; http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/optimizer/NAFileSet.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/NAFileSet.cpp b/core/sql/optimizer/NAFileSet.cpp index ee9e7a4..36a72e8 100644 --- a/core/sql/optimizer/NAFileSet.cpp +++ b/core/sql/optimizer/NAFileSet.cpp @@ -53,7 +53,6 @@ NAFileSet::NAFileSet(const QualifiedName & fileSetName, Lng32 numberOfFiles, Cardinality estimatedNumberOfRecords, Lng32 recordLength, - Lng32 lockLength, Lng32 blockSize, Int32 indexLevels, const NAColumnArray & allColumns, @@ -89,7 +88,6 @@ NAFileSet::NAFileSet(const QualifiedName & fileSetName, countOfFiles_(numberOfFiles), estimatedNumberOfRecords_(estimatedNumberOfRecords), recordLength_(recordLength), - lockLength_(lockLength), blockSize_(blockSize), indexLevels_(indexLevels), allColumns_(allColumns, h), http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/optimizer/NAFileSet.h ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/NAFileSet.h b/core/sql/optimizer/NAFileSet.h index d4ed3f2..5999a6a 100644 --- a/core/sql/optimizer/NAFileSet.h +++ b/core/sql/optimizer/NAFileSet.h @@ -93,7 +93,6 @@ public: Lng32 countOfFiles, Cardinality estimatedNumberOfRecords, Lng32 recordLength, - Lng32 lockLength, Lng32 blockSize, Int32 indexLevels, const NAColumnArray & allColumns, http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/optimizer/NATable.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/NATable.cpp b/core/sql/optimizer/NATable.cpp index 1074a0f..5a68aa8 100644 --- a/core/sql/optimizer/NATable.cpp +++ b/core/sql/optimizer/NATable.cpp @@ -3588,7 +3588,9 @@ NAType* getSQColTypeForHive(const char* hiveType, NAMemory* heap) TRUE, // allow NULL FALSE, // not upshifted FALSE, // not case-insensitive - CharInfo::getCharSetEnum(hiveCharset)); + CharInfo::getCharSetEnum(hiveCharset), + CharInfo::DefaultCollation, + CharInfo::IMPLICIT); } if ( !strcmp(hiveType, "float")) @@ -4341,8 +4343,7 @@ NABoolean createNAFileSets(desc_struct * table_desc /*IN*/, isSystemTable, numberOfFiles, MAXOF(table_desc->body.table_desc.rowcount,0), - indexes_desc->body.indexes_desc.record_length, - files_desc ? files_desc->body.files_desc.lockLength : 0, + indexes_desc->body.indexes_desc.record_length, blockSize, indexLevels, allColumns, @@ -4674,9 +4675,7 @@ NABoolean createNAFileSets(hive_tbl_desc* hvt_desc /*IN*/, // HIVE-TBD Cardinality(estimatedRC), - Lng32(estimatedRecordLength), - - 0, // lock length + Lng32(estimatedRecordLength), //hvt_desc->getBlockSize(), (Lng32)hiveHDFSTableStats->getEstimatedBlockSize(), @@ -4846,6 +4845,51 @@ ULng32 hashColPosList(const CollIndexSet &colSet) } +// ---------------------------------------------------------------------------- +// method: lookupObjectUid +// +// Calls DDL manager to get the object UID for the specified object +// +// params: +// qualName - name of object to lookup +// objectType - type of object +// +// returns: +// -1 -> error found trying to read metadata including object not found +// UID of found object +// +// the diags area contains details of any error detected +// +// *** recent change - move this function up in this file and move resetting +// of ComDiagsArea to the caller *** +// ---------------------------------------------------------------------------- +Int64 lookupObjectUid( const QualifiedName& qualName + , ComObjectType objectType + ) +{ + ExeCliInterface cliInterface(STMTHEAP); + Int64 objectUID = 0; + + CmpSeabaseDDL cmpSBD(STMTHEAP); + if (cmpSBD.switchCompiler(CmpContextInfo::CMPCONTEXT_TYPE_META)) + { + if (CmpCommon::diags()->getNumber(DgSqlCode::ERROR_) == 0) + *CmpCommon::diags() << DgSqlCode( -4400 ); + + return -1; + } + + objectUID = cmpSBD.getObjectUID(&cliInterface, + qualName.getCatalogName().data(), + qualName.getSchemaName().data(), + qualName.getObjectName().data(), + comObjectTypeLit(objectType)); + + cmpSBD.switchBackCompiler(); + + return objectUID; +} + // ----------------------------------------------------------------------- // NATable::NATable() constructor // ----------------------------------------------------------------------- @@ -5080,6 +5124,36 @@ NATable::NATable(BindWA *bindWA, schemaUID_ = uint32ArrayToInt64(table_desc->body.table_desc.schemaUID); objectUID_ = uint32ArrayToInt64(table_desc->body.table_desc.objectUID); + // Set the objectUID_ for hbase Cell and Row tables, if the table has + // been defined in Trafodion use this value, otherwise, set to 0 + if (isHbaseCell_ || isHbaseRow_) + { + NAString adjustedName = ComConvertNativeNameToTrafName + (corrName.getQualifiedNameObj().getCatalogName(), + corrName.getQualifiedNameObj().getUnqualifiedSchemaNameAsAnsiString(), + corrName.getQualifiedNameObj().getUnqualifiedObjectNameAsAnsiString()); + QualifiedName extObjName (adjustedName, 3, STMTHEAP); + + Lng32 diagsMark = CmpCommon::diags()->mark(); + objectUID_ = ::lookupObjectUid(extObjName, COM_BASE_TABLE_OBJECT); + + // If the objectUID is not found, then the table is not externally defined + // in Trafodion, set the objectUID to 0 + // If an unexpected error occurs, then return with the error + if (objectUID_ <= 0) + { + if (CmpCommon::diags()->contains(-1389)) + { + CmpCommon::diags()->rewind(diagsMark); + objectUID_ = 0; + } + else + return; + } + else + setHasExternalTable(TRUE); + } + if (table_desc->body.table_desc.owner) { Int32 userInfo (table_desc->body.table_desc.owner); @@ -5558,51 +5632,6 @@ NATable::NATable(BindWA *bindWA, #pragma warn(770) // warning elimination -// ---------------------------------------------------------------------------- -// method: lookupObjectUid -// -// Calls DDL manager to get the object UID for the specified object -// -// params: -// qualName - name of object to lookup -// objectType - type of object -// -// returns: -// -1 -> error found trying to read metadata including object not found -// UID of found object -// -// the diags area contains details of any error detected -// -// *** recent change - move this function up in this file and move resetting -// of ComDiagsArea to the caller *** -// ---------------------------------------------------------------------------- -Int64 lookupObjectUid( const QualifiedName& qualName - , ComObjectType objectType - ) -{ - ExeCliInterface cliInterface(STMTHEAP); - Int64 objectUID = 0; - - CmpSeabaseDDL cmpSBD(STMTHEAP); - if (cmpSBD.switchCompiler(CmpContextInfo::CMPCONTEXT_TYPE_META)) - { - if (CmpCommon::diags()->getNumber(DgSqlCode::ERROR_) == 0) - *CmpCommon::diags() << DgSqlCode( -4400 ); - - return -1; - } - - objectUID = cmpSBD.getObjectUID(&cliInterface, - qualName.getCatalogName().data(), - qualName.getSchemaName().data(), - qualName.getObjectName().data(), - comObjectTypeLit(objectType)); - - cmpSBD.switchBackCompiler(); - - return objectUID; -} - // Constructor for a Hive table NATable::NATable(BindWA *bindWA, const CorrName& corrName, @@ -5752,10 +5781,11 @@ NATable::NATable(BindWA *bindWA, // If the HIVE table has been registered in Trafodion, get the objectUID // from Trafodion, otherwise, set it to 0. // TBD - does getQualifiedNameObj handle delimited names correctly? - QualifiedName extObjName (corrName.getQualifiedNameObj().getObjectName(), - corrName.getQualifiedNameObj().getSchemaName(), - TRAFODION_SYSCAT_LIT, - STMTHEAP); + NAString adjustedName = ComConvertNativeNameToTrafName + ( corrName.getQualifiedNameObj().getCatalogName(), + corrName.getQualifiedNameObj().getSchemaName(), + corrName.getQualifiedNameObj().getObjectName()); + QualifiedName extObjName (adjustedName, 3, STMTHEAP); Lng32 diagsMark = CmpCommon::diags()->mark(); objectUID_ = ::lookupObjectUid(extObjName, COM_BASE_TABLE_OBJECT); http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/optimizer/ObjectNames.h ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/ObjectNames.h b/core/sql/optimizer/ObjectNames.h index 5889b18..d7f15cf 100644 --- a/core/sql/optimizer/ObjectNames.h +++ b/core/sql/optimizer/ObjectNames.h @@ -276,6 +276,9 @@ public: size_t *lenArray /* array[5] */) const; const NAString getQualifiedNameAsAnsiNTFilenameString() const; const NAString& getObjectName() const { return objectName_; } + const NAString getUnqualifiedObjectNameAsAnsiString() const + { return ToAnsiIdentifier(objectName_); } + ComAnsiNameSpace getObjectNameSpace() const { return objectNameSpace_; } @@ -690,12 +693,6 @@ public: flagbits_(0) { setIsExternal(ComIsTrafodionExternalSchemaName(schemaName)); - //Int32 len (schemaName.length()); - //Int32 prefixLen = sizeof(HIVE_EXT_SCHEMA_PREFIX); - //if (len > prefixLen) - // setIsExternal(schemaName(0,prefixLen-1) == HIVE_EXT_SCHEMA_PREFIX && - // schemaName(len-1) == '_' ); - setLocationName (locName) ; } @@ -715,12 +712,6 @@ public: flagbits_(0) { setIsExternal(ComIsTrafodionExternalSchemaName(qualName.getSchemaName())); - //Int32 len (qualName.getSchemaName().length()); - //Int32 prefixLen = sizeof(HIVE_EXT_SCHEMA_PREFIX); - //if (len > prefixLen) - // setIsExternal(qualName.getSchemaName()(0,prefixLen-1) == HIVE_EXT_SCHEMA_PREFIX && - // qualName.getSchemaName()(len-1) == '_'); - setLocationName (locName) ; } http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/optimizer/RelExeUtil.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/RelExeUtil.cpp b/core/sql/optimizer/RelExeUtil.cpp index 728b31f..55a5210 100644 --- a/core/sql/optimizer/RelExeUtil.cpp +++ b/core/sql/optimizer/RelExeUtil.cpp @@ -3814,23 +3814,21 @@ RelExpr * DDLExpr::bindNode(BindWA *bindWA) qualObjName_ = dropTableNode->getTableNameAsQualifiedName(); - // Hive tables can only be specified as external and must be created - // with the FOR clause - if (qualObjName_.isHive()) - { - if (dropTableNode->isExternal()) + // Drops of Hive and HBase external tables are allowed + if (qualObjName_.isHive() || (qualObjName_.isHbase())) { - isHbase_ = TRUE; - externalTable = TRUE; - } - else - { - *CmpCommon::diags() << DgSqlCode(-4222) << DgString0("DDL"); - bindWA->setErrStatus(); - return NULL; + if (dropTableNode->isExternal()) + { + isHbase_ = TRUE; + externalTable = TRUE; + } + else + { + *CmpCommon::diags() << DgSqlCode(-4222) << DgString0("DDL"); + bindWA->setErrStatus(); + return NULL; + } } - - } } else if (getExprNode()->castToElemDDLNode()->castToStmtDDLDropHbaseTable()) { http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/AllElemDDLFileAttr.h ---------------------------------------------------------------------- diff --git a/core/sql/parser/AllElemDDLFileAttr.h b/core/sql/parser/AllElemDDLFileAttr.h index 2b46148..84308f5 100644 --- a/core/sql/parser/AllElemDDLFileAttr.h +++ b/core/sql/parser/AllElemDDLFileAttr.h @@ -56,7 +56,6 @@ #include "ElemDDLFileAttrDeallocate.h" #include "ElemDDLFileAttrDCompress.h" #include "ElemDDLFileAttrICompress.h" -#include "ElemDDLFileAttrLockLength.h" #include "ElemDDLFileAttrPOS.h" #include "ElemDDLFileAttrMaxSize.h" #include "ElemDDLFileAttrRangeLog.h" http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/ElemDDLFileAttr.cpp ---------------------------------------------------------------------- diff --git a/core/sql/parser/ElemDDLFileAttr.cpp b/core/sql/parser/ElemDDLFileAttr.cpp index a76143e..b8bf860 100644 --- a/core/sql/parser/ElemDDLFileAttr.cpp +++ b/core/sql/parser/ElemDDLFileAttr.cpp @@ -758,38 +758,6 @@ NAString ElemDDLFileAttrICompress::getSyntax() const // ----------------------------------------------------------------------- -// methods for class ElemDDLFileAttrLockLength -// ----------------------------------------------------------------------- - -// virtual destructor -ElemDDLFileAttrLockLength::~ElemDDLFileAttrLockLength() -{ -} - -// cast -ElemDDLFileAttrLockLength * -ElemDDLFileAttrLockLength::castToElemDDLFileAttrLockLength() -{ - return this; -} - -// trace - -const NAString -ElemDDLFileAttrLockLength::getText() const -{ - return "ElemDDLFileAttrLockLength"; -} - -const NAString -ElemDDLFileAttrLockLength::displayLabel1() const -{ - char buffer[80]; - sprintf(buffer, "%d", getLockLength()); - return NAString("Lock length: ") + NAString(buffer); -} - -// ----------------------------------------------------------------------- // methods for class ElemDDLFileAttrRangeLog // ----------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/ElemDDLNode.cpp ---------------------------------------------------------------------- diff --git a/core/sql/parser/ElemDDLNode.cpp b/core/sql/parser/ElemDDLNode.cpp index 102f683..3e9b21b 100644 --- a/core/sql/parser/ElemDDLNode.cpp +++ b/core/sql/parser/ElemDDLNode.cpp @@ -381,12 +381,6 @@ ElemDDLNode::castToElemDDLPartnAttrList() return NULL; } -ElemDDLFileAttrLockLength * -ElemDDLNode::castToElemDDLFileAttrLockLength() -{ - return NULL; -} - ElemDDLFileAttrMaxSize * ElemDDLNode::castToElemDDLFileAttrMaxSize() { http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/ElemDDLNode.h ---------------------------------------------------------------------- diff --git a/core/sql/parser/ElemDDLNode.h b/core/sql/parser/ElemDDLNode.h index ad4932d..e1d540a 100644 --- a/core/sql/parser/ElemDDLNode.h +++ b/core/sql/parser/ElemDDLNode.h @@ -100,7 +100,6 @@ class ElemDDLFileAttrDeallocate; class ElemDDLFileAttrICompress; class ElemDDLFileAttrList; class ElemDDLPartnAttrList; -class ElemDDLFileAttrLockLength; class ElemDDLFileAttrMaxSize; class ElemDDLFileAttrExtents; class ElemDDLFileAttrMaxExtents; @@ -419,7 +418,6 @@ public: virtual ElemDDLFileAttrICompress * castToElemDDLFileAttrICompress(); virtual ElemDDLFileAttrList * castToElemDDLFileAttrList(); virtual ElemDDLPartnAttrList * castToElemDDLPartnAttrList(); - virtual ElemDDLFileAttrLockLength * castToElemDDLFileAttrLockLength(); virtual ElemDDLFileAttrMaxSize * castToElemDDLFileAttrMaxSize(); virtual ElemDDLFileAttrExtents * castToElemDDLFileAttrExtents(); virtual ElemDDLFileAttrMaxExtents * castToElemDDLFileAttrMaxExtents(); http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/ParDDLFileAttrs.cpp ---------------------------------------------------------------------- diff --git a/core/sql/parser/ParDDLFileAttrs.cpp b/core/sql/parser/ParDDLFileAttrs.cpp index 609dbb1..74a4b99 100644 --- a/core/sql/parser/ParDDLFileAttrs.cpp +++ b/core/sql/parser/ParDDLFileAttrs.cpp @@ -423,19 +423,6 @@ ParDDLFileAttrsAlterIndex::setFileAttr(ElemDDLFileAttr * pFileAttr) *SqlParser_Diags << DgSqlCode(-3077); break; - case ELM_FILE_ATTR_LOCK_LENGTH_ELEM : - // - // The grammar productions allow the locklength phrase - // to appear within an Alter Index ... Attribute(s) - // statement (syntactically). Enforces the restriction - // by using semantic actions. - // - - // LOCKLENGTH phrase not allowed in an Alter Index ... Attribute(s) - // statement. - *SqlParser_Diags << DgSqlCode(-3078); - break; - case ELM_FILE_ATTR_EXTENT_ELEM : // DOnt allow EXTENT in ALTER statements *SqlParser_Diags << DgSqlCode(-3194); @@ -729,10 +716,6 @@ ParDDLFileAttrsAlterTable::copy(const ParDDLFileAttrsAlterTable &rhs) // DEALLOCATE isDeallocateSpec_ = rhs.isDeallocateSpec_; - // LOCKLENGTH - isLockLengthSpec_ = rhs.isLockLengthSpec_; - lockLength_ = rhs.lockLength_; - // MAXSIZE isMaxSizeSpec_ = rhs.isMaxSizeSpec_; isMaxSizeUnbounded_ = rhs.isMaxSizeUnbounded_; @@ -820,13 +803,6 @@ ParDDLFileAttrsAlterTable::initializeDataMembers() // no other data members besides isDeallocateSpec_ // - // LOCKLENGTH - // - // The following data member has no meaning when the - // LockLength phrase does not appear. - // - lockLength_ = 0; - // MAXSIZE // // The following data members have no meanings when the @@ -899,9 +875,6 @@ ParDDLFileAttrsAlterTable::resetAllIsSpecDataMembers() // DEALLOCATE isDeallocateSpec_ = FALSE; - // LOCKLENGTH - isLockLengthSpec_ = FALSE; - // MAXSIZE isMaxSizeSpec_ = FALSE; @@ -1060,18 +1033,6 @@ ParDDLFileAttrsAlterTable::setFileAttr(ElemDDLFileAttr * pFileAttr) *SqlParser_Diags << DgSqlCode(-3089); break; - case ELM_FILE_ATTR_LOCK_LENGTH_ELEM : - if (isLockLengthSpec_) - { - // Duplicate LOCKLENGTH phrases. - *SqlParser_Diags << DgSqlCode(-3090); - } - ComASSERT(pFileAttr->castToElemDDLFileAttrLockLength() NEQ NULL); - lockLength_ = pFileAttr->castToElemDDLFileAttrLockLength()-> - getLockLength(); - isLockLengthSpec_ = TRUE; - break; - case ELM_FILE_ATTR_EXTENT_ELEM : // Dont allow EXTENT in ALTER statements. *SqlParser_Diags << DgSqlCode(-3194); @@ -1270,19 +1231,6 @@ ParDDLFileAttrsAlterTable::getDetailInfo() const detailTextList.append("deallocate not spec"); } - // LOCKLENGTH - - if (isLockLengthSpecified()) - { - detailText = "locklen: "; - detailText += LongToNAString((Lng32)getLockLength()); - detailTextList.append(detailText); - } - else - { - detailTextList.append("locklength not spec"); - } - // MAXSIZE if (isMaxSizeSpecified()) @@ -1414,10 +1362,6 @@ ParDDLFileAttrsCreateIndex::copy(const ParDDLFileAttrsCreateIndex &rhs) isICompressSpec_ = rhs.isICompressSpec_; isICompress_ = rhs.isICompress_; - // LOCKLENGTH - isLockLengthSpec_ = rhs.isLockLengthSpec_; - lockLength_ = rhs.lockLength_; - // MAXSIZE isMaxSizeSpec_ = rhs.isMaxSizeSpec_; isMaxSizeUnbounded_ = rhs.isMaxSizeUnbounded_; @@ -1518,14 +1462,6 @@ ParDDLFileAttrsCreateIndex::initializeDataMembers() // isICompress_ = FALSE; - // LOCKLENGTH - // - // Sets number of bytes in key to use for - // generic locks. Default is 0 which means - // using the entire key. - // - lockLength_ = 0; - // MAXSIZE isMaxSizeUnbounded_ = FALSE; ParSetDefaultMaxSize(maxSize_, maxSizeUnit_); @@ -1583,9 +1519,6 @@ ParDDLFileAttrsCreateIndex::resetAllIsSpecDataMembers() // [ NO ] ICOMPRESS isICompressSpec_ = FALSE; - // LOCKLENGTH - isLockLengthSpec_ = FALSE; - // MAXSIZE isMaxSizeSpec_ = FALSE; @@ -1730,18 +1663,6 @@ ParDDLFileAttrsCreateIndex::setFileAttr(ElemDDLFileAttr * pFileAttr) isICompressSpec_ = TRUE; break; - case ELM_FILE_ATTR_LOCK_LENGTH_ELEM : - if (isLockLengthSpec_) - { - // Duplicate LOCKLENGTH phrases. - *SqlParser_Diags << DgSqlCode(-3090); - } - ComASSERT(pFileAttr->castToElemDDLFileAttrLockLength() NEQ NULL); - lockLength_ = pFileAttr->castToElemDDLFileAttrLockLength()-> - getLockLength(); - isLockLengthSpec_ = TRUE; - break; - case ELM_FILE_ATTR_EXTENT_ELEM : if (isExtentSpec_) { @@ -1882,10 +1803,6 @@ ParDDLFileAttrsCreateIndex::getDetailInfo() const detailText += YesNo(getIsICompress()); detailTextList.append(detailText); - detailText = "locklen: "; - detailText += LongToNAString((Lng32)getLockLength()); - detailTextList.append(detailText); - detailText = "maxsizunbound? "; detailText += YesNo(isMaxSizeUnbounded()); detailTextList.append(detailText); @@ -2180,7 +2097,6 @@ ParDDLFileAttrsCreateTable::setFileAttr(ElemDDLFileAttr * pFileAttr) case ELM_FILE_ATTR_CLEAR_ON_PURGE_ELEM : case ELM_FILE_ATTR_D_COMPRESS_ELEM : case ELM_FILE_ATTR_I_COMPRESS_ELEM : - case ELM_FILE_ATTR_LOCK_LENGTH_ELEM : case ELM_FILE_ATTR_EXTENT_ELEM : case ELM_FILE_ATTR_MAXEXTENTS_ELEM : case ELM_FILE_ATTR_UID_ELEM : http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/ParDDLFileAttrsAlterTable.h ---------------------------------------------------------------------- diff --git a/core/sql/parser/ParDDLFileAttrsAlterTable.h b/core/sql/parser/ParDDLFileAttrsAlterTable.h index ccc7edf..843b235 100644 --- a/core/sql/parser/ParDDLFileAttrsAlterTable.h +++ b/core/sql/parser/ParDDLFileAttrsAlterTable.h @@ -137,12 +137,6 @@ public: inline ComCompressionType getCompressionType() const; // Returns the value of COMPRESSION TYPE - inline unsigned short getLockLength() const; - - // Returns the unsigned number appearing in the specified - // LockLength phrase. The return value has no meanings when - // the LockLength phrase is not specified. - inline ULng32 getMaxSize() const; // Returns the value appearing in the specified MaxSize phrase. @@ -220,11 +214,6 @@ public: // Returns TRUE if the Deallocate phrase appears; // returns FALSE otherwise. - inline NABoolean isLockLengthSpecified() const; - - // Returns TRUE if the LockLength phrase appears; - // returns FALSE otherwise. - inline NABoolean isMaxSizeSpecified() const; // Returns TRUE if the MaxSize phrase appears; @@ -332,10 +321,6 @@ private: // DEALLOCATE NABoolean isDeallocateSpec_; - // LOCKLENGTH - NABoolean isLockLengthSpec_; - unsigned short lockLength_; - // MAXSIZE NABoolean isMaxSizeSpec_; NABoolean isMaxSizeUnbounded_; @@ -420,12 +405,6 @@ ParDDLFileAttrsAlterTable::getIsClearOnPurge() const return isClearOnPurge_; } -inline unsigned short -ParDDLFileAttrsAlterTable::getLockLength() const -{ - return lockLength_; -} - inline ULng32 ParDDLFileAttrsAlterTable::getMaxSize() const { @@ -510,13 +489,6 @@ ParDDLFileAttrsAlterTable::isDeallocateSpecified() const return isDeallocateSpec_; } -// is the LockLength phrase specified? -inline NABoolean -ParDDLFileAttrsAlterTable::isLockLengthSpecified() const -{ - return isLockLengthSpec_; -} - // is the MaxSize phrase specified? inline NABoolean ParDDLFileAttrsAlterTable::isMaxSizeSpecified() const http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/ParDDLFileAttrsCreateIndex.h ---------------------------------------------------------------------- diff --git a/core/sql/parser/ParDDLFileAttrsCreateIndex.h b/core/sql/parser/ParDDLFileAttrsCreateIndex.h index 089caba..7c8eaa5 100644 --- a/core/sql/parser/ParDDLFileAttrsCreateIndex.h +++ b/core/sql/parser/ParDDLFileAttrsCreateIndex.h @@ -157,12 +157,6 @@ public: // For Create Table statements, the default value is FALSE (no // compression). - inline unsigned short getLockLength() const; - - // Returns the unsigned number appearing in the specified - // LockLength phrase. Returns 0 (the default value) when - // the LockLength phrase is not specified. - inline ULng32 getMaxSize() const; // Returns the value specified in the MaxSize clause. @@ -260,11 +254,6 @@ public: // Returns TRUE if the ICompress phrase appears; // returns FALSE otherwise. - inline NABoolean isLockLengthSpecified() const; - - // Returns TRUE if the LockLength phrase appears; - // returns FALSE otherwise. - inline NABoolean isMaxSizeSpecified() const; // Returns TRUE if the MaxSize phrase appears; @@ -354,10 +343,6 @@ private: NABoolean isICompressSpec_; NABoolean isICompress_; - // LOCKLENGTH - NABoolean isLockLengthSpec_; - unsigned short lockLength_; - // MAXSIZE NABoolean isMaxSizeSpec_; NABoolean isMaxSizeUnbounded_; @@ -443,12 +428,6 @@ ParDDLFileAttrsCreateIndex::getIsICompress() const return isICompress_; } -inline unsigned short -ParDDLFileAttrsCreateIndex::getLockLength() const -{ - return lockLength_; -} - inline ULng32 ParDDLFileAttrsCreateIndex::getMaxSize() const { @@ -578,13 +557,6 @@ ParDDLFileAttrsCreateIndex::isICompressSpecified() const return isICompressSpec_; } -// is the LockLength phrase specified? -inline NABoolean -ParDDLFileAttrsCreateIndex::isLockLengthSpecified() const -{ - return isLockLengthSpec_; -} - // is the MaxSize phrase specified? inline NABoolean ParDDLFileAttrsCreateIndex::isMaxSizeSpecified() const http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/ParKeyWords.cpp ---------------------------------------------------------------------- diff --git a/core/sql/parser/ParKeyWords.cpp b/core/sql/parser/ParKeyWords.cpp index e766f19..9824f70 100644 --- a/core/sql/parser/ParKeyWords.cpp +++ b/core/sql/parser/ParKeyWords.cpp @@ -603,7 +603,6 @@ ParKeyWord ParKeyWords::keyWords_[] = { ParKeyWord("LOCATOR", TOK_LOCATOR, COMPAQ_|RESWORD_), ParKeyWord("LOCK", TOK_LOCK, FIRST_|NONRESTOKEN_), ParKeyWord("LOCKING", TOK_LOCKING, NONRESTOKEN_), - ParKeyWord("LOCKLENGTH", TOK_LOCKLENGTH, NONRESTOKEN_), ParKeyWord("LOCKONREFRESH", TOK_LOCKONREFRESH, FLAGSNONE_), ParKeyWord("LOG", TOK_LOG, NONRESTOKEN_), ParKeyWord("LOG10", TOK_LOG10, NONRESTOKEN_), http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/StmtDDLAlter.cpp ---------------------------------------------------------------------- diff --git a/core/sql/parser/StmtDDLAlter.cpp b/core/sql/parser/StmtDDLAlter.cpp index bd1fc16..b599ae7 100644 --- a/core/sql/parser/StmtDDLAlter.cpp +++ b/core/sql/parser/StmtDDLAlter.cpp @@ -2521,7 +2521,6 @@ StmtDDLAlterMV::checkFileAttribute(ElemDDLFileAttr * pFileAttr) case ELM_FILE_ATTR_I_COMPRESS_ELEM : case ELM_FILE_ATTR_MAX_SIZE_ELEM : case ELM_FILE_ATTR_ALLOCATE_ELEM : - case ELM_FILE_ATTR_LOCK_LENGTH_ELEM : case ELM_FILE_ATTR_AUDIT_ELEM : case ELM_FILE_ATTR_DEALLOCATE_ELEM : case ELM_FILE_ATTR_RANGE_LOG_ELEM : http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/StmtDDLCreate.cpp ---------------------------------------------------------------------- diff --git a/core/sql/parser/StmtDDLCreate.cpp b/core/sql/parser/StmtDDLCreate.cpp index 2763446..7dcd4a2 100644 --- a/core/sql/parser/StmtDDLCreate.cpp +++ b/core/sql/parser/StmtDDLCreate.cpp @@ -6470,10 +6470,6 @@ StmtDDLCreateMV::checkFileAttribute(ElemDDLFileAttr * pFileAttr) *SqlParser_Diags << DgSqlCode(-12047); break; - case ELM_FILE_ATTR_LOCK_LENGTH_ELEM : - *SqlParser_Diags << DgSqlCode(-12048); - break; - case ELM_FILE_ATTR_AUDIT_ELEM : *SqlParser_Diags << DgSqlCode(-12050); break; http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/StmtDDLDrop.cpp ---------------------------------------------------------------------- diff --git a/core/sql/parser/StmtDDLDrop.cpp b/core/sql/parser/StmtDDLDrop.cpp index a49af03..938831b 100644 --- a/core/sql/parser/StmtDDLDrop.cpp +++ b/core/sql/parser/StmtDDLDrop.cpp @@ -561,7 +561,8 @@ StmtDDLDropSchema::StmtDDLDropSchema(//const SchemaName & schemaName, // If the schema name specified is reserved name, users cannot drop them. // They can only be dropped internally. if ((! Get_SqlParser_Flags(INTERNAL_QUERY_FROM_EXEUTIL)) && - (ComIsTrafodionReservedSchemaName(schemaQualName_.getSchemaName()))) + (ComIsTrafodionReservedSchemaName(schemaQualName_.getSchemaName())) && + (!ComIsTrafodionExternalSchemaName(schemaQualName_.getSchemaName()))) { // error. *SqlParser_Diags << DgSqlCode(-1430) http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2e0b1ddf/core/sql/parser/sqlparser.y ---------------------------------------------------------------------- diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y index 72a5317..31ed1be 100755 --- a/core/sql/parser/sqlparser.y +++ b/core/sql/parser/sqlparser.y @@ -1306,7 +1306,6 @@ static void enableMakeQuotedStringISO88591Mechanism() %token TOK_LABEL_PURGEDATA %token TOK_LOCATION /* Tandem extension */ %token TOK_LOCKING /* TD extension that HP wants to ignore */ -%token TOK_LOCKLENGTH /* Tandem extension */ %token TOK_LOCKONREFRESH // MV %token TOK_M /* Tandem extension */ %token TOK_MOVE /* Tandem extension */ @@ -2621,7 +2620,6 @@ static void enableMakeQuotedStringISO88591Mechanism() %type file_attribute_deallocate_clause %type file_attribute_icompress_clause %type file_attribute_list -%type file_attribute_lock_length_clause %type file_attribute_compression_clause %type file_attribute_extent_clause %type file_attribute_maxextent_clause @@ -25790,7 +25788,6 @@ file_attribute : file_attribute_allocate_clause /* not yet supported: | file_attribute_dcompress_clause ***/ | file_attribute_deallocate_clause | file_attribute_icompress_clause - | file_attribute_lock_length_clause /* not supported anymore | file_attribute_max_size_clause ***/ | file_attribute_extent_clause | file_attribute_maxextent_clause @@ -25938,15 +25935,6 @@ file_attribute_icompress_clause : TOK_ICOMPRESS } /* type pElemDDL */ -file_attribute_lock_length_clause : TOK_LOCKLENGTH unsigned_smallint - { - $$ = new (PARSERHEAP()) - ElemDDLFileAttrLockLength( - $2 /*unsigned_smallint*/); - } - - -/* type pElemDDL */ file_attribute_extent_clause : TOK_EXTENT file_attribute_extent { $$ = $2 /*file_attribute_extent*/; @@ -32724,7 +32712,6 @@ nonreserved_word : TOK_ABORT | TOK_LOCK | TOK_LOCK_ROW | TOK_LOCKING - | TOK_LOCKLENGTH | TOK_LOCKONREFRESH // MV | TOK_LOGGABLE //++ MV | TOK_LOGON