You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by rm...@apache.org on 2016/10/14 19:53:35 UTC
[4/5] incubator-trafodion git commit: Merge branch 'master' into
trafodion-2189
Merge branch 'master' into trafodion-2189
Conflicts:
core/sql/optimizer/NATable.cpp
core/sql/sqlcomp/PrivMgrDesc.h
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/b10bc1b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/b10bc1b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/b10bc1b0
Branch: refs/heads/master
Commit: b10bc1b0b03e3c13354fadcfb6fea56a6aab1f3f
Parents: 3b43772 66bc826
Author: Roberta Marton <rm...@edev07.esgyn.local>
Authored: Wed Oct 12 23:18:05 2016 +0000
Committer: Roberta Marton <rm...@edev07.esgyn.local>
Committed: Wed Oct 12 23:18:05 2016 +0000
----------------------------------------------------------------------
.../SqlCompilerDebugger/ItemExpressionView.cpp | 4 +-
core/sql/arkcmp/CmpContext.cpp | 7 +-
core/sql/arkcmp/CmpStatement.cpp | 2 +
core/sql/arkcmp/CmpStoredProc.cpp | 2 +-
core/sql/arkcmp/cmpargs.cpp | 2 +-
core/sql/bin/SqlciErrors.txt | 2 +-
core/sql/cli/CliExtern.cpp | 16 +-
core/sql/cli/Context.cpp | 21 +-
core/sql/cli/Globals.cpp | 17 +-
core/sql/comexe/ComTdbSort.h | 10 +-
core/sql/common/BloomFilter.cpp | 2 +-
core/sql/common/ColIndList.h | 4 +-
core/sql/common/Collections.cpp | 1 -
core/sql/common/Collections.h | 47 ++-
core/sql/common/ComExeTrace.cpp | 1 +
core/sql/common/Ipc.h | 4 +-
core/sql/common/NAMemory.cpp | 2 +-
core/sql/common/NATestpoint.cpp | 3 +-
core/sql/common/NATraceList.h | 2 +-
core/sql/executor/ExHbaseAccess.cpp | 1 +
core/sql/executor/ExHbaseDDL.cpp | 2 +-
core/sql/executor/ex_sort.cpp | 16 +-
core/sql/exp/ExpLOB.h | 4 +-
core/sql/exp/ExpPCodeOptimizations.cpp | 2 +-
core/sql/exp/ExpPCodeOptsBulk.cpp | 4 +-
core/sql/exp/ExpPCodeOptsNativeExpr.cpp | 2 +-
core/sql/exp/exp_tuple_desc.cpp | 17 +-
core/sql/export/ComDiags.cpp | 4 +-
core/sql/generator/GenExplain.cpp | 2 +-
core/sql/generator/GenKey.cpp | 2 +-
core/sql/generator/GenRelGrby.cpp | 2 +-
core/sql/generator/GenRelJoin.cpp | 2 +-
core/sql/generator/GenRelMisc.cpp | 3 +-
core/sql/generator/GenRelScan.cpp | 2 +-
core/sql/generator/GenRelUpdate.cpp | 12 +-
core/sql/generator/GenResources.cpp | 2 +-
core/sql/generator/Generator.cpp | 16 +-
core/sql/langman/LmRoutineJava.cpp | 3 +-
core/sql/langman/LmUtility.cpp | 2 +-
core/sql/nskgmake/sort/Makefile | 3 +-
core/sql/optimizer/Analyzer.cpp | 15 +-
core/sql/optimizer/Analyzer.h | 5 +
core/sql/optimizer/BindItemExpr.cpp | 6 +-
core/sql/optimizer/BindRI.cpp | 2 +-
core/sql/optimizer/BindRelExpr.cpp | 11 +-
core/sql/optimizer/BindWA.cpp | 1 +
core/sql/optimizer/BindWA.h | 2 +-
core/sql/optimizer/CacheWA.cpp | 3 +
core/sql/optimizer/ColStatDesc.cpp | 20 +-
core/sql/optimizer/ControlDB.cpp | 8 +-
core/sql/optimizer/EncodedValue.cpp | 3 +-
core/sql/optimizer/HDFSHook.cpp | 2 +-
core/sql/optimizer/HbaseSearchSpec.h | 52 +--
core/sql/optimizer/ItemFuncUDF.h | 11 +-
core/sql/optimizer/ItemOther.h | 2 +-
core/sql/optimizer/LargeScopeRules.cpp | 4 +-
core/sql/optimizer/MJVIndexBuilder.cpp | 12 +-
core/sql/optimizer/MVCandidates.cpp | 10 +-
core/sql/optimizer/MVInfo.cpp | 13 +-
core/sql/optimizer/MVJoinGraph.cpp | 5 +-
core/sql/optimizer/MjvBuilder.cpp | 2 +-
core/sql/optimizer/MultiJoin.cpp | 2 +-
core/sql/optimizer/MvRefreshBuilder.cpp | 4 +-
core/sql/optimizer/NAClusterInfo.cpp | 2 +-
core/sql/optimizer/NATable.cpp | 215 ++++++-------
core/sql/optimizer/NATable.h | 9 +-
core/sql/optimizer/NodeMap.cpp | 2 +-
core/sql/optimizer/NormRelExpr.cpp | 8 +-
core/sql/optimizer/NormWA.cpp | 4 +-
core/sql/optimizer/NormWA.h | 8 +
core/sql/optimizer/OptItemExpr.cpp | 2 +-
core/sql/optimizer/OptLogRelExpr.cpp | 2 +-
core/sql/optimizer/OptRange.cpp | 4 +-
core/sql/optimizer/QRDescGenerator.cpp | 2 +-
core/sql/optimizer/QRDescGenerator.h | 5 +-
core/sql/optimizer/RETDesc.cpp | 10 +-
core/sql/optimizer/Refresh.cpp | 2 +-
core/sql/optimizer/RelExeUtil.h | 3 +-
core/sql/optimizer/RelExpr.cpp | 29 +-
core/sql/optimizer/RelPackedRows.cpp | 2 +-
core/sql/optimizer/RelRoutine.cpp | 2 +-
core/sql/optimizer/RelScan.h | 7 +-
core/sql/optimizer/Rule.cpp | 4 +-
core/sql/optimizer/ScanOptimizer.cpp | 4 +-
core/sql/optimizer/SchemaDB.cpp | 2 +-
core/sql/optimizer/SearchKey.cpp | 6 +-
core/sql/optimizer/Stats.cpp | 3 +-
core/sql/optimizer/Stats.h | 12 +-
core/sql/optimizer/TableNameMap.h | 3 +-
core/sql/optimizer/TransRule.cpp | 2 +-
core/sql/optimizer/VEGTable.cpp | 6 +-
core/sql/optimizer/ValueDesc.cpp | 2 +-
core/sql/optimizer/memo.cpp | 2 +-
core/sql/parser/ElemDDLHbaseOptions.h | 3 +-
core/sql/parser/SqlParserAux.cpp | 6 +-
core/sql/parser/StmtDDLCreate.cpp | 6 +-
core/sql/parser/sqlparser.y | 36 +--
core/sql/qmscommon/QRLogger.cpp | 6 +
core/sql/qmscommon/Range.cpp | 3 +-
core/sql/qmscommon/Range.h | 3 +-
core/sql/regress/compGeneral/DIFF042.KNOWN | 36 +--
core/sql/regress/compGeneral/EXPECTED001.SB | 2 +-
core/sql/runtimestats/ssmpipc.cpp | 5 +-
core/sql/sort/Qsort.h | 5 +-
core/sql/sort/Record.cpp | 14 +-
core/sql/sort/Record.h | 8 +
core/sql/sort/SortTopN.cpp | 318 +++++++++++++++++++
core/sql/sort/SortTopN.h | 89 ++++++
core/sql/sort/SortUtil.cpp | 78 +++--
core/sql/sort/SortUtil.h | 2 +-
core/sql/sort/SortUtilCfg.cpp | 43 +--
core/sql/sort/SortUtilCfg.h | 11 +-
core/sql/sqlcomp/CmpDescribe.cpp | 4 +-
core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp | 10 +-
core/sql/sqlcomp/CmpSeabaseDDLindex.cpp | 8 +-
core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp | 4 +-
core/sql/sqlcomp/CmpSeabaseDDLtable.cpp | 36 +--
core/sql/sqlcomp/CmpSeabaseDDLview.cpp | 4 +-
core/sql/sqlcomp/DefaultConstants.h | 1 +
core/sql/sqlcomp/PrivMgrCommands.cpp | 4 +-
core/sql/sqlcomp/PrivMgrDesc.h | 6 +-
core/sql/sqlcomp/PrivMgrPrivileges.cpp | 8 +-
core/sql/sqlcomp/QCache.cpp | 2 +-
core/sql/sqlcomp/QCache.h | 1 +
core/sql/sqlcomp/nadefaults.cpp | 2 +
core/sql/sqlcomp/parser.cpp | 5 +-
core/sql/sqlmsg/GetErrorMessage.cpp | 2 +-
core/sql/sqlmxevents/logmxevent_traf.cpp | 2 +-
.../java/org/trafodion/sql/HBaseClient.java | 13 +-
core/sql/udrserv/spinfo.cpp | 3 +-
core/sql/ustat/hs_cli.cpp | 2 +-
core/sql/ustat/hs_parser.cpp | 4 +-
.../src/asciidoc/_chapters/binder_msgs.adoc | 102 +++---
docs/messages_guide/src/asciidoc/index.adoc | 1 +
install/installer/traf_sqconfig | 5 +-
135 files changed, 1125 insertions(+), 589 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b10bc1b0/core/sql/optimizer/BindRelExpr.cpp
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b10bc1b0/core/sql/optimizer/NATable.cpp
----------------------------------------------------------------------
diff --cc core/sql/optimizer/NATable.cpp
index 24cfbf3,b240f17..67ebadd
--- a/core/sql/optimizer/NATable.cpp
+++ b/core/sql/optimizer/NATable.cpp
@@@ -5360,110 -5360,110 +5361,109 @@@ NABoolean createNAFileSets(TrafDesc * t
//
TrafDesc *view_desc = table_desc->tableDesc()->views_desc;
if (view_desc)
- {
- viewText_ = new (heap_) char[strlen(view_desc->viewDesc()->viewtext) + 2];
- strcpy(viewText_, view_desc->viewDesc()->viewtext);
- strcat(viewText_, ";");
-
- viewTextCharSet_ = (CharInfo::CharSet)view_desc->viewDesc()->viewtextcharset;
-
- viewCheck_ = NULL; //initialize
- if(view_desc->viewDesc()->viewchecktext){
- UInt32 viewCheckLength = str_len(view_desc->viewDesc()->viewchecktext)+1;
- viewCheck_ = new (heap_) char[ viewCheckLength];
- memcpy(viewCheck_, view_desc->viewDesc()->viewchecktext,
- viewCheckLength);
- }
-
- viewColUsages_ = NULL;
- if(view_desc->viewDesc()->viewcolusages){
- viewColUsages_ = new (heap_) NAList<ComViewColUsage *>(heap_); //initialize empty list
- char * beginStr (view_desc->viewDesc()->viewcolusages);
- char * endStr = strchr(beginStr, ';');
- while (endStr != NULL) {
- ComViewColUsage *colUsage = new (heap_) ComViewColUsage;
- NAString currentUsage(beginStr, endStr - beginStr + 1);
- colUsage->unpackUsage (currentUsage.data());
- viewColUsages_->insert(colUsage);
- beginStr = endStr+1;
- endStr = strchr(beginStr, ';');
- }
- }
+ {
+ viewText_ = new (heap_) char[strlen(view_desc->viewDesc()->viewtext) + 2];
+ strcpy(viewText_, view_desc->viewDesc()->viewtext);
+ strcat(viewText_, ";");
+
+ viewTextCharSet_ = (CharInfo::CharSet)view_desc->viewDesc()->viewtextcharset;
+
+ viewCheck_ = NULL; //initialize
+ if(view_desc->viewDesc()->viewchecktext){
+ UInt32 viewCheckLength = str_len(view_desc->viewDesc()->viewchecktext)+1;
+ viewCheck_ = new (heap_) char[ viewCheckLength];
+ memcpy(viewCheck_, view_desc->viewDesc()->viewchecktext,
+ viewCheckLength);
+ }
- setUpdatable(view_desc->viewDesc()->isUpdatable());
- setInsertable(view_desc->viewDesc()->isInsertable());
+ viewColUsages_ = NULL;
+ if(view_desc->viewDesc()->viewcolusages){
- viewColUsages_ = new (heap_) NAList<ComViewColUsage *>; //initialize empty list
++ viewColUsages_ = new (heap_) NAList<ComViewColUsage *>(heap_); //initialize empty list
+ char * beginStr (view_desc->viewDesc()->viewcolusages);
+ char * endStr = strchr(beginStr, ';');
+ while (endStr != NULL) {
+ ComViewColUsage *colUsage = new (heap_) ComViewColUsage;
+ NAString currentUsage(beginStr, endStr - beginStr + 1);
+ colUsage->unpackUsage (currentUsage.data());
+ viewColUsages_->insert(colUsage);
+ beginStr = endStr+1;
+ endStr = strchr(beginStr, ';');
+ }
+ }
-
+ setUpdatable(view_desc->viewDesc()->isUpdatable());
+ setInsertable(view_desc->viewDesc()->isInsertable());
- //
- // The updatable flag is false for an MP view only if it is NOT a
- // protection view. Therefore updatable == FALSE iff it is a
- // shorthand view. See ReadTableDef.cpp, l. 3379.
- //
+ //
+ // The updatable flag is false for an MP view only if it is NOT a
+ // protection view. Therefore updatable == FALSE iff it is a
+ // shorthand view. See ReadTableDef.cpp, l. 3379.
+ //
- viewFileName_ = NULL;
- CMPASSERT(view_desc->viewDesc()->viewfilename);
- UInt32 viewFileNameLength = str_len(view_desc->viewDesc()->viewfilename) + 1;
- viewFileName_ = new (heap_) char[viewFileNameLength];
- memcpy(viewFileName_, view_desc->viewDesc()->viewfilename,
- viewFileNameLength);
- }
+ viewFileName_ = NULL;
+ CMPASSERT(view_desc->viewDesc()->viewfilename);
+ UInt32 viewFileNameLength = str_len(view_desc->viewDesc()->viewfilename) + 1;
+ viewFileName_ = new (heap_) char[viewFileNameLength];
+ memcpy(viewFileName_, view_desc->viewDesc()->viewfilename,
+ viewFileNameLength);
+ }
else
- {
- //keep track of memory used by NAFileSets
- Lng32 preCreateNAFileSetsMemSize = heap_->getAllocSize();
+ {
+ //keep track of memory used by NAFileSets
+ Lng32 preCreateNAFileSetsMemSize = heap_->getAllocSize();
- //
- // Process indexes and vertical partitions for this table.
- //
- if (createNAFileSets(table_desc /*IN*/,
- this /*IN*/,
- colArray_ /*IN*/,
- indexes_ /*OUT*/,
- vertParts_ /*OUT*/,
- clusteringIndex_ /*OUT*/,
- tableIdList_ /*OUT*/,
- heap_,
- bindWA,
- newColumns_, /*OUT*/
- maxIndexLevelsPtr)) {
- return; // colcount_ == 0 indicates an error
- }
+ //
+ // Process indexes and vertical partitions for this table.
+ //
+ if (createNAFileSets(table_desc /*IN*/,
+ this /*IN*/,
+ colArray_ /*IN*/,
+ indexes_ /*OUT*/,
+ vertParts_ /*OUT*/,
+ clusteringIndex_ /*OUT*/,
+ tableIdList_ /*OUT*/,
+ heap_,
+ bindWA,
+ newColumns_, /*OUT*/
+ maxIndexLevelsPtr)) {
+ return; // colcount_ == 0 indicates an error
+ }
- // Add constraint info.
- //
- // This call to createConstraintInfo, calls the parser on
- // the constraint name
- //
-
- NABoolean errorOccurred =
- createConstraintInfo(table_desc /*IN*/,
- getTableName() /*IN*/,
- getNAColumnArray()/*IN (some columns updated)*/,
- checkConstraints_ /*OUT*/,
- uniqueConstraints_/*OUT*/,
- refConstraints_ /*OUT*/,
- heap_,
- bindWA);
-
- if (errorOccurred) {
- // return before setting colcount_, indicating that there
- // was an error in constructing this NATable.
- //
- return;
- }
-
- //
- // FetchHistograms call used to be here -- moved to getStatistics().
- //
- }
-
- // change partFunc for base table if PARTITION clause has been used
- // to limit the number of partitions that will be accessed.
- if ((qualifiedName_.isPartitionNameSpecified()) ||
- (qualifiedName_.isPartitionRangeSpecified())) {
- if (filterUnusedPartitions(corrName.getPartnClause())) {
- return ;
- }
- }
+ // Add constraint info.
+ //
+ // This call to createConstraintInfo, calls the parser on
+ // the constraint name
+ //
+
+ NABoolean errorOccurred =
+ createConstraintInfo(table_desc /*IN*/,
+ getTableName() /*IN*/,
+ getNAColumnArray()/*IN (some columns updated)*/,
+ checkConstraints_ /*OUT*/,
+ uniqueConstraints_/*OUT*/,
+ refConstraints_ /*OUT*/,
+ heap_,
+ bindWA);
+
+ if (errorOccurred) {
+ // return before setting colcount_, indicating that there
+ // was an error in constructing this NATable.
+ //
+ return;
+ }
+
+ //
+ // FetchHistograms call used to be here -- moved to getStatistics().
+ //
+ }
+
+ // change partFunc for base table if PARTITION clause has been used
+ // to limit the number of partitions that will be accessed.
+ if ((qualifiedName_.isPartitionNameSpecified()) ||
+ (qualifiedName_.isPartitionRangeSpecified())) {
+ if (filterUnusedPartitions(corrName.getPartnClause())) {
+ return ;
+ }
+ }
//
// Set colcount_ after all possible errors (Binder uses nonzero colcount
@@@ -5773,267 -5771,268 +5773,268 @@@
// Constructor for a Hive table
NATable::NATable(BindWA *bindWA,
- const CorrName& corrName,
- NAMemory *heap,
- struct hive_tbl_desc* htbl)
- //
- // The NATable heap ( i.e. heap_ ) used to come from ContextHeap
- // (i.e. heap) but it creates high memory usage/leakage in Context
- // Heap. Although the NATables are deleted at the end of each statement,
- // the heap_ is returned to heap (i.e. context heap) which caused
- // context heap containing a lot of not used chunk of memory. So it is
- // changed to be from whatever heap is passed in at the call in
- // NATableDB.getNATable.
- //
- // Now NATable objects can be cached.If an object is to be cached (persisted
- // across statements) a NATable heap is allocated for the object
- // and is passed in (this is done in NATableDB::get(CorrName& corrName...).
- // Otherwise a reference to the Statement heap is passed in. When a cached
- // object is to be deleted the object's heap is deleted which wipes out the
- // NATable object all its related stuff. NATable objects that are not cached
- // are wiped out at the end of the statement when the statement heap is deleted.
- //
- : heap_(heap),
- referenceCount_(0),
- refsIncompatibleDP2Halloween_(FALSE),
- isHalloweenTable_(FALSE),
- qualifiedName_(corrName.getExtendedQualNameObj(),heap),
- synonymReferenceName_(heap),
- fileSetName_(corrName.getQualifiedNameObj(),heap), // for now, set equal
- clusteringIndex_(NULL),
- colcount_(0),
- colArray_(heap),
- recordLength_(0),
- indexes_(heap),
- vertParts_(heap),
- colStats_(NULL),
- statsFetched_(FALSE),
- viewFileName_(NULL),
- viewText_(NULL),
- viewTextInNAWchars_(heap),
- viewTextCharSet_(CharInfo::UnknownCharSet),
- viewCheck_(NULL),
- viewColUsages_(NULL),
- flags_(IS_INSERTABLE | IS_UPDATABLE),
- insertMode_(COM_REGULAR_TABLE_INSERT_MODE),
- isSynonymTranslationDone_(FALSE),
- checkConstraints_(heap),
- createTime_(htbl->creationTS_),
- redefTime_(htbl->redeftime()),
- cacheTime_(0),
- statsTime_(0),
- catalogUID_(0),
- schemaUID_(0),
- objectUID_(0),
- objectType_(COM_UNKNOWN_OBJECT),
- partitioningScheme_(COM_UNKNOWN_PARTITIONING),
- uniqueConstraints_(heap),
- refConstraints_(heap),
- isAnMV_(FALSE),
- isAnMVMetaData_(FALSE),
- mvsUsingMe_(heap),
- mvInfo_(NULL),
- accessedInCurrentStatement_(TRUE),
- setupForStatement_(FALSE),
- resetAfterStatement_(FALSE),
- hitCount_(0),
- replacementCounter_(2),
- sizeInCache_(0),
- recentlyUsed_(TRUE),
- tableConstructionHadWarnings_(FALSE),
- isAnMPTableWithAnsiName_(FALSE),
- isUMDTable_(FALSE),
- isSMDTable_(FALSE),
- isMVUMDTable_(FALSE),
-
- // For virtual tables, we set the object schema version
- // to be the current schema version
- osv_(COM_VERS_CURR_SCHEMA),
- ofv_(COM_VERS_CURR_SCHEMA),
- partnsDesc_(NULL),
- colsWithMissingStats_(NULL),
- originalCardinality_(-1.0),
- tableIdList_(heap),
- rcb_(NULL),
- rcbLen_(0),
- keyLength_(0),
- parentTableName_(NULL),
- sgAttributes_(NULL),
- isHive_(TRUE),
- isHbase_(FALSE),
- isHbaseCell_(FALSE),
- isHbaseRow_(FALSE),
- isSeabase_(FALSE),
- isSeabaseMD_(FALSE),
- isSeabasePrivSchemaTable_(FALSE),
- isUserUpdatableSeabaseMD_(FALSE),
- resetHDFSStatsAfterStmt_(FALSE),
- hiveDefaultStringLen_(0),
- hiveTableId_(htbl->tblID_),
- tableDesc_(NULL),
- secKeySet_(heap),
- privInfo_(NULL),
- newColumns_(heap),
- snapshotName_(NULL)
+ const CorrName& corrName,
+ NAMemory *heap,
+ struct hive_tbl_desc* htbl)
+ //
+ // The NATable heap ( i.e. heap_ ) used to come from ContextHeap
+ // (i.e. heap) but it creates high memory usage/leakage in Context
+ // Heap. Although the NATables are deleted at the end of each statement,
+ // the heap_ is returned to heap (i.e. context heap) which caused
+ // context heap containing a lot of not used chunk of memory. So it is
+ // changed to be from whatever heap is passed in at the call in
+ // NATableDB.getNATable.
+ //
+ // Now NATable objects can be cached.If an object is to be cached (persisted
+ // across statements) a NATable heap is allocated for the object
+ // and is passed in (this is done in NATableDB::get(CorrName& corrName...).
+ // Otherwise a reference to the Statement heap is passed in. When a cached
+ // object is to be deleted the object's heap is deleted which wipes out the
+ // NATable object all its related stuff. NATable objects that are not cached
+ // are wiped out at the end of the statement when the statement heap is deleted.
+ //
+ : heap_(heap),
+ referenceCount_(0),
+ refsIncompatibleDP2Halloween_(FALSE),
+ isHalloweenTable_(FALSE),
+ qualifiedName_(corrName.getExtendedQualNameObj(),heap),
+ synonymReferenceName_(heap),
+ fileSetName_(corrName.getQualifiedNameObj(),heap), // for now, set equal
+ clusteringIndex_(NULL),
+ colcount_(0),
+ colArray_(heap),
+ recordLength_(0),
+ indexes_(heap),
+ vertParts_(heap),
+ colStats_(NULL),
+ statsFetched_(FALSE),
+ viewFileName_(NULL),
+ viewText_(NULL),
+ viewTextInNAWchars_(heap),
+ viewTextCharSet_(CharInfo::UnknownCharSet),
+ viewCheck_(NULL),
+ viewColUsages_(NULL),
+ flags_(IS_INSERTABLE | IS_UPDATABLE),
+ insertMode_(COM_REGULAR_TABLE_INSERT_MODE),
+ isSynonymTranslationDone_(FALSE),
+ checkConstraints_(heap),
+ createTime_(htbl->creationTS_),
+ redefTime_(htbl->redeftime()),
+ cacheTime_(0),
+ statsTime_(0),
+ catalogUID_(0),
+ schemaUID_(0),
+ objectUID_(0),
+ objectType_(COM_UNKNOWN_OBJECT),
+ partitioningScheme_(COM_UNKNOWN_PARTITIONING),
+ uniqueConstraints_(heap),
+ refConstraints_(heap),
+ isAnMV_(FALSE),
+ isAnMVMetaData_(FALSE),
+ mvsUsingMe_(heap),
+ mvInfo_(NULL),
+ accessedInCurrentStatement_(TRUE),
+ setupForStatement_(FALSE),
+ resetAfterStatement_(FALSE),
+ hitCount_(0),
+ replacementCounter_(2),
+ sizeInCache_(0),
+ recentlyUsed_(TRUE),
+ tableConstructionHadWarnings_(FALSE),
+ isAnMPTableWithAnsiName_(FALSE),
+ isUMDTable_(FALSE),
+ isSMDTable_(FALSE),
+ isMVUMDTable_(FALSE),
+
+ // For virtual tables, we set the object schema version
+ // to be the current schema version
+ osv_(COM_VERS_CURR_SCHEMA),
+ ofv_(COM_VERS_CURR_SCHEMA),
+ partnsDesc_(NULL),
+ colsWithMissingStats_(NULL),
+ originalCardinality_(-1.0),
+ tableIdList_(heap),
+ rcb_(NULL),
+ rcbLen_(0),
+ keyLength_(0),
+ parentTableName_(NULL),
+ sgAttributes_(NULL),
+ isHive_(TRUE),
+ isHbase_(FALSE),
+ isHbaseCell_(FALSE),
+ isHbaseRow_(FALSE),
+ isSeabase_(FALSE),
+ isSeabaseMD_(FALSE),
+ isSeabasePrivSchemaTable_(FALSE),
+ isUserUpdatableSeabaseMD_(FALSE),
+ resetHDFSStatsAfterStmt_(FALSE),
+ hiveDefaultStringLen_(0),
+ hiveTableId_(htbl->tblID_),
+ tableDesc_(NULL),
+ secKeySet_(heap),
+ privInfo_(NULL),
+ newColumns_(heap),
+ snapshotName_(NULL),
+ allColFams_(heap)
{
- NAString tblName = qualifiedName_.getQualifiedNameObj().getQualifiedNameAsString();
- NAString mmPhase;
-
- Lng32 preCreateNATableWarnings = CmpCommon::diags()->getNumber(DgSqlCode::WARNING_);
-
- //set heap type
- if(heap_ == CmpCommon::statementHeap()){
- heapType_ = STATEMENT;
- mmPhase = "NATable Init (Stmt) - " + tblName;
- }else if (heap_ == CmpCommon::contextHeap()){
- heapType_ = CONTEXT;
- mmPhase = "NATable Init (Cnxt) - " + tblName;
- }else {
- heapType_ = OTHER;
- mmPhase = "NATable Init (Other) - " + tblName;
- }
+ NAString tblName = qualifiedName_.getQualifiedNameObj().getQualifiedNameAsString();
+ NAString mmPhase;
+
+ Lng32 preCreateNATableWarnings = CmpCommon::diags()->getNumber(DgSqlCode::WARNING_);
+
+ //set heap type
+ if(heap_ == CmpCommon::statementHeap()){
+ heapType_ = STATEMENT;
+ mmPhase = "NATable Init (Stmt) - " + tblName;
+ }else if (heap_ == CmpCommon::contextHeap()){
+ heapType_ = CONTEXT;
+ mmPhase = "NATable Init (Cnxt) - " + tblName;
+ }else {
+ heapType_ = OTHER;
+ mmPhase = "NATable Init (Other) - " + tblName;
+ }
- MonitorMemoryUsage_Enter((char*)mmPhase.data(), heap_, TRUE);
+ MonitorMemoryUsage_Enter((char*)mmPhase.data(), heap_, TRUE);
- isTrigTempTable_ = FALSE;
+ isTrigTempTable_ = FALSE;
- insertMode_ =
- COM_MULTISET_TABLE_INSERT_MODE; // allow dup, to check
- //ComInsertMode::COM_MULTISET_TABLE_INSERT_MODE; // allow dup, to check
+ insertMode_ =
+ COM_MULTISET_TABLE_INSERT_MODE; // allow dup, to check
+ //ComInsertMode::COM_MULTISET_TABLE_INSERT_MODE; // allow dup, to check
- //
- // Add timestamp information.
- //
+ //
+ // Add timestamp information.
+ //
- // To get from Hive
-/*
- createTime_ = longArrayToInt64(table_desc->tableDesc()->createtime);
- redefTime_ = longArrayToInt64(table_desc->tableDesc()->redeftime);
- cacheTime_ = longArrayToInt64(table_desc->tableDesc()->cachetime);
-*/
+ // To get from Hive
+ /*
+ createTime_ = longArrayToInt64(table_desc->tableDesc()->createtime);
+ redefTime_ = longArrayToInt64(table_desc->tableDesc()->redeftime);
+ cacheTime_ = longArrayToInt64(table_desc->tableDesc()->cachetime);
+ */
- // NATable has a schemaUID column, probably should propogate it.
- // for now, set to 0.
- schemaUID_ = 0;
+ // NATable has a schemaUID column, probably should propogate it.
+ // for now, set to 0.
+ schemaUID_ = 0;
- // Set the objectUID_
- // 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?
- if ( !fetchObjectUIDForNativeTable(corrName) )
- return;
+ // Set the objectUID_
+ // 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?
+ if ( !fetchObjectUIDForNativeTable(corrName) )
+ return;
- if ( objectUID_ > 0 )
- setHasExternalTable(TRUE);
+ if ( objectUID_ > 0 )
+ setHasExternalTable(TRUE);
- // for HIVE objects, the schema owner and table owner is HIVE_ROLE_ID
- if (CmpCommon::context()->isAuthorizationEnabled())
- {
- owner_ = HIVE_ROLE_ID;
- schemaOwner_ = HIVE_ROLE_ID;
- }
- else
- {
- owner_ = SUPER_USER;
- schemaOwner_ = SUPER_USER;
- }
+ // for HIVE objects, the schema owner and table owner is HIVE_ROLE_ID
+ if (CmpCommon::context()->isAuthorizationEnabled())
+ {
+ owner_ = HIVE_ROLE_ID;
+ schemaOwner_ = HIVE_ROLE_ID;
+ }
+ else
+ {
+ owner_ = SUPER_USER;
+ schemaOwner_ = SUPER_USER;
+ }
- if (hasExternalTable())
- getPrivileges(NULL);
+ if (hasExternalTable())
+ getPrivileges(NULL);
- // TBD - if authorization is enabled and there is no external table to store
- // privileges, go get privilege information from HIVE metadata ...
-
- // TBD - add a check to verify that the column list coming from HIVE matches
- // the column list stored in the external table. Maybe some common method
- // that can be used to compare other things as well...
-
- objectType_ = COM_BASE_TABLE_OBJECT;
+ // TBD - if authorization is enabled and there is no external table to store
+ // privileges, go get privilege information from HIVE metadata ...
-// to check
- partitioningScheme_ = COM_UNKNOWN_PARTITIONING;
+ // TBD - add a check to verify that the column list coming from HIVE matches
+ // the column list stored in the external table. Maybe some common method
+ // that can be used to compare other things as well...
-// to check
- rcb_ = 0;
- rcbLen_ = 0;
- keyLength_ = 0;
+ objectType_ = COM_BASE_TABLE_OBJECT;
- partnsDesc_ = NULL;
+ // to check
+ partitioningScheme_ = COM_UNKNOWN_PARTITIONING;
- //
- // Insert a NAColumn in the colArray_ for this NATable for each
- // columns_desc from the ARK SMD. Returns TRUE if error creating NAColumns.
- //
+ // to check
+ rcb_ = 0;
+ rcbLen_ = 0;
+ keyLength_ = 0;
- if (createNAColumns(htbl->getColumns(),
- this,
- colArray_ /*OUT*/,
- heap_))
- //coverity[leaked_storage]
- return;
+ partnsDesc_ = NULL;
+ //
+ // Insert a NAColumn in the colArray_ for this NATable for each
+ // columns_desc from the ARK SMD. Returns TRUE if error creating NAColumns.
+ //
- //
- // Set colcount_ after all possible errors (Binder uses nonzero colcount
- // as an indicator of valid table definition).
- //
+ if (createNAColumns(htbl->getColumns(),
+ this,
+ colArray_ /*OUT*/,
+ heap_))
+ //coverity[leaked_storage]
+ return;
- // To set it via the new createNAColumns()
- colcount_ = colArray_.entries();
- // compute record length from colArray
+ //
+ // Set colcount_ after all possible errors (Binder uses nonzero colcount
+ // as an indicator of valid table definition).
+ //
- Int32 recLen = 0;
- for ( CollIndex i=0; i<colcount_; i++ ) {
- recLen += colArray_[i]->getType()->getNominalSize();
- }
+ // To set it via the new createNAColumns()
+ colcount_ = colArray_.entries();
- setRecordLength(recLen);
-
- if (createNAFileSets(htbl /*IN*/,
- this /*IN*/,
- colArray_ /*IN*/,
- indexes_ /*OUT*/,
- vertParts_ /*OUT*/,
- clusteringIndex_ /*OUT*/,
- tableIdList_ /*OUT*/,
- heap_,
- bindWA
- )) {
- colcount_ = 0; // indicates failure
- return;
- }
+ // compute record length from colArray
- // HIVE-TBD ignore constraint info creation for now
+ Int32 recLen = 0;
+ for ( CollIndex i=0; i<colcount_; i++ ) {
+ recLen += colArray_[i]->getType()->getNominalSize();
+ }
+ setRecordLength(recLen);
- // If there is a host variable associated with this table, store it
- // for use by the generator to generate late-name resolution information.
- //
- HostVar *hv = corrName.getPrototype();
- prototype_ = hv ? new (heap_) HostVar(*hv) : NULL;
+ if (createNAFileSets(htbl /*IN*/,
+ this /*IN*/,
+ colArray_ /*IN*/,
+ indexes_ /*OUT*/,
+ vertParts_ /*OUT*/,
+ clusteringIndex_ /*OUT*/,
+ tableIdList_ /*OUT*/,
+ heap_,
+ bindWA
+ )) {
+ colcount_ = 0; // indicates failure
+ return;
+ }
- // MV
- // Initialize the MV support data members
- isAnMV_ = FALSE;
- isAnMVMetaData_ = FALSE;
+ // HIVE-TBD ignore constraint info creation for now
- Lng32 postCreateNATableWarnings = CmpCommon::diags()->getNumber(DgSqlCode::WARNING_);
- if(postCreateNATableWarnings != preCreateNATableWarnings)
- tableConstructionHadWarnings_=TRUE;
+ // If there is a host variable associated with this table, store it
+ // for use by the generator to generate late-name resolution information.
+ //
+ HostVar *hv = corrName.getPrototype();
+ prototype_ = hv ? new (heap_) HostVar(*hv) : NULL;
- hiveDefaultStringLen_ = CmpCommon::getDefaultLong(HIVE_MAX_STRING_LENGTH);
- Int32 hiveDefaultStringLenInBytes = CmpCommon::getDefaultLong(HIVE_MAX_STRING_LENGTH_IN_BYTES);
- if( hiveDefaultStringLenInBytes != 32000 )
- hiveDefaultStringLen_ = hiveDefaultStringLenInBytes;
+ // MV
+ // Initialize the MV support data members
+ isAnMV_ = FALSE;
+ isAnMVMetaData_ = FALSE;
-// LCOV_EXCL_STOP
- initialSize_ = heap_->getAllocSize();
- MonitorMemoryUsage_Exit((char*)mmPhase.data(), heap_, NULL, TRUE);
+ Lng32 postCreateNATableWarnings = CmpCommon::diags()->getNumber(DgSqlCode::WARNING_);
+
+ if(postCreateNATableWarnings != preCreateNATableWarnings)
+ tableConstructionHadWarnings_=TRUE;
+
+ hiveDefaultStringLen_ = CmpCommon::getDefaultLong(HIVE_MAX_STRING_LENGTH);
+ Int32 hiveDefaultStringLenInBytes = CmpCommon::getDefaultLong(HIVE_MAX_STRING_LENGTH_IN_BYTES);
+ if( hiveDefaultStringLenInBytes != 32000 )
+ hiveDefaultStringLen_ = hiveDefaultStringLenInBytes;
+
+ // LCOV_EXCL_STOP
+ initialSize_ = heap_->getAllocSize();
+ MonitorMemoryUsage_Exit((char*)mmPhase.data(), heap_, NULL, TRUE);
} // NATable()
#pragma warn(770) // warning elimination
@@@ -6890,36 -6885,28 +6891,36 @@@ void NATable::getPrivileges(TrafDesc *
if (CmpSeabaseDDL::isSeabasePrivMgrMD
(qualifiedName_.getQualifiedNameObj().getCatalogName(),
qualifiedName_.getQualifiedNameObj().getSchemaName()))
+
+ {
isSeabasePrivSchemaTable_ = TRUE;
- return;
++ return;
+ }
- if ((!isSeabaseTable() && !isHiveTable()) ||
- !CmpCommon::context()->isAuthorizationEnabled() ||
- isVolatileTable() ||
- ComUser::isRootUserID()||
- ComUser::getCurrentUser() == owner_)
- {
- privInfo_ = new(heap_) PrivMgrUserPrivs;
- privInfo_->setOwnerDefaultPrivs();
- return;
- }
-
- // priv_desc could be NULL if NATable is being created for an MD or hive
- // table.
- // For hive tables, go ahead and read the privilege manager metadata to
- // extract privs
- // Much of the time, MD is read by the compiler/DDL on behalf of the user so
+ // Most of the time, MD is read by the compiler/DDL on behalf of the user so
// privilege checks are skipped. Instead of performing the I/O to get
// privilege information at this time, set privInfo_ to NULL and rely on
// RelRoot::checkPrivileges to look up privileges. checkPrivileges is
// optimized to lookup privileges only when needed.
+ if (CmpSeabaseDDL::isSeabaseReservedSchema
+ (qualifiedName_.getQualifiedNameObj().getCatalogName(),
+ qualifiedName_.getQualifiedNameObj().getSchemaName()))
+ return;
+
+ // If current user is root, object owner, or this is a volatile table
+ // automatically have owner default privileges.
+ if ((!isSeabaseTable() && !isHiveTable()) ||
+ !CmpCommon::context()->isAuthorizationEnabled() ||
+ isVolatileTable() ||
+ ComUser::isRootUserID()||
+ ComUser::getCurrentUser() == owner_)
+ {
+ privInfo_ = new(heap_) PrivMgrUserPrivs;
+ privInfo_->setOwnerDefaultPrivs();
+ return;
+ }
+
- ComSecurityKeySet secKeyVec;
++ ComSecurityKeySet secKeyVec(heap_);
if (priv_desc == NULL)
{
if (isHiveTable())
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b10bc1b0/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b10bc1b0/core/sql/sqlcomp/PrivMgrCommands.cpp
----------------------------------------------------------------------
diff --cc core/sql/sqlcomp/PrivMgrCommands.cpp
index 6faf70b,550ac64..30b6eea
--- a/core/sql/sqlcomp/PrivMgrCommands.cpp
+++ b/core/sql/sqlcomp/PrivMgrCommands.cpp
@@@ -78,76 -75,69 +78,76 @@@ bool PrivMgrUserPrivs::initUserPrivs
// generate PrivMgrUserPrivs from the priv_desc structure
TrafDesc *priv_grantees_desc = priv_desc->privDesc()->privGrantees;
- NAList<PrivMgrDesc> descList;
- TrafDesc *priv_grantee_desc = NULL;
- TrafDesc *priv_public_desc = NULL;
++ NAList<PrivMgrDesc> descList(NULL);
- // Find relevant desc for the user
+ // Find relevant descs for the user
while (priv_grantees_desc)
{
Int32 grantee = priv_grantees_desc->privGranteeDesc()->grantee;
+ bool addDesc = false;
if (grantee == userID)
- priv_grantee_desc = priv_grantees_desc->privGranteeDesc();
+ addDesc = true;
+
+ if (PrivMgr::isRoleID(grantee))
+ {
+ if ((std::find(roleIDs.begin(), roleIDs.end(), grantee)) != roleIDs.end())
+ addDesc = true;
+ }
if (ComUser::isPublicUserID(grantee))
- priv_public_desc = priv_grantees_desc->privGranteeDesc();
+ {
+ addDesc = true;
+ hasPublicPriv_ = true;
+ }
- priv_grantees_desc = priv_grantees_desc->next;
- }
+ // Create a list of PrivMgrDesc contain privileges for user, user's roles,
+ // and public
+ if (addDesc)
+ {
+ TrafDesc *objectPrivs = priv_grantees_desc->privGranteeDesc()->objectBitmap;
- // If the user has a privilege in the priv_grantees_desc list, use it to
- // create the PrivMgrUserPrivs class.
- if (priv_grantee_desc)
- {
+ PrivMgrCoreDesc objectDesc(objectPrivs->privBitmapDesc()->privBitmap,
+ objectPrivs->privBitmapDesc()->privWGOBitmap);
+
+ TrafDesc *priv_grantee_desc = priv_grantees_desc->privGranteeDesc();
+ TrafDesc *columnPrivs = priv_grantee_desc->privGranteeDesc()->columnBitmaps;
- NAList<PrivMgrCoreDesc> columnDescs;
++ NAList<PrivMgrCoreDesc> columnDescs(NULL);
+ while (columnPrivs)
+ {
+ PrivMgrCoreDesc columnDesc(columnPrivs->privBitmapDesc()->privBitmap,
+ columnPrivs->privBitmapDesc()->privWGOBitmap,
+ columnPrivs->privBitmapDesc()->columnOrdinal);
+ columnDescs.insert(columnDesc);
+ columnPrivs = columnPrivs->next;
+ }
- // Set up object level privileges
- TrafDesc *objectPrivs = priv_grantee_desc->privGranteeDesc()->objectBitmap;
- objectBitmap_ = objectPrivs->privBitmapDesc()->privBitmap;
- grantableBitmap_ = objectPrivs->privBitmapDesc()->privWGOBitmap;
+ PrivMgrDesc privs(priv_grantees_desc->privGranteeDesc()->grantee);
+ privs.setTablePrivs(objectDesc);
+ privs.setColumnPrivs(columnDescs);
+ privs.setHasPublicPriv(hasPublicPriv_);
- // Set up column level privileges
- // The PrivColList is a key <=> value pair structure, the key is the
- // column ordinal (number) and the value is the associated bitmap.
- TrafDesc *columnPrivs = priv_grantee_desc->privGranteeDesc()->columnBitmaps;
- PrivColList colPrivsList;
- PrivColList colGrantableList;
- while (columnPrivs)
- {
- Int32 columnOrdinal = columnPrivs->privBitmapDesc()->columnOrdinal;
- colPrivsList[columnOrdinal] = columnPrivs->privBitmapDesc()->privBitmap;
- colGrantableList[columnOrdinal] = columnPrivs->privBitmapDesc()->privWGOBitmap;
- columnPrivs = columnPrivs->next;
+ descList.insert(privs);
}
- colPrivsList_= colPrivsList;
- colGrantableList_ = colGrantableList;
+ priv_grantees_desc = priv_grantees_desc->next;
}
- // See if there are privileges assigned to public. If so, "or" the public
- // list to the user to the current bitmaps. Initially all the bitmap are
- // set to 0.
- if (priv_public_desc)
+ // Union privileges from all grantees together to create a single set of
+ // bitmaps. Create security invalidation keys
+ for (int i = 0; i < descList.entries(); i++)
{
+ PrivMgrDesc privs = descList[i];
+
// Set up object level privileges
- TrafDesc *objectPrivs = priv_public_desc->privGranteeDesc()->objectBitmap;
- objectBitmap_ |= objectPrivs->privBitmapDesc()->privBitmap;
- grantableBitmap_ |= objectPrivs->privBitmapDesc()->privWGOBitmap;
+ objectBitmap_ |= privs.getTablePrivs().getPrivBitmap();
+ grantableBitmap_ |= privs.getTablePrivs().getWgoBitmap();
// Set up column level privileges
- // The PrivColList is a key <=> value pair structure, the key is the
- // column ordinal (number) and the value is the associated bitmap.
- TrafDesc *columnPrivs = priv_public_desc->privGranteeDesc()->columnBitmaps;
- PrivColList colPrivsList;
- PrivColList colGrantableList;
- std::map<size_t,PrivColumnBitmap>::iterator it;
- while (columnPrivs)
+ NAList<PrivMgrCoreDesc> columnPrivs = privs.getColumnPrivs();
+ std::map<size_t,PrivColumnBitmap>::iterator it;
+ for (int j = 0; j < columnPrivs.entries(); j++)
{
- Int32 columnOrdinal = columnPrivs->privBitmapDesc()->columnOrdinal;
+ PrivMgrCoreDesc colDesc = columnPrivs[j];
+ Int32 columnOrdinal = colDesc.getColumnOrdinal();
it = colPrivsList_.find(columnOrdinal);
if (it == colPrivsList_.end())
{
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b10bc1b0/core/sql/sqlcomp/PrivMgrDesc.h
----------------------------------------------------------------------
diff --cc core/sql/sqlcomp/PrivMgrDesc.h
index dc72474,1ebc8ce..13e83a2
--- a/core/sql/sqlcomp/PrivMgrDesc.h
+++ b/core/sql/sqlcomp/PrivMgrDesc.h
@@@ -390,24 -389,21 +390,24 @@@ public
const int32_t nbrCols = 0 // preset constructor
)
: tableLevel_(),
- columnLevel_(),
+ columnLevel_(NULL),
- grantee_(grantee)
+ grantee_(grantee),
+ hasPublicPriv_(false)
{}
PrivMgrDesc(const PrivMgrDesc &privs, // preset constructor
const int32_t grantee)
: tableLevel_(privs.tableLevel_),
- columnLevel_(privs.columnLevel_),
- columnLevel_(privs.columnLevel_, NULL),
- grantee_(privs.grantee_)
++ columnLevel_(privs.columnLevel_,NULL),
+ grantee_(privs.grantee_),
+ hasPublicPriv_(privs.hasPublicPriv_)
{}
PrivMgrDesc(void)
: tableLevel_(),
- columnLevel_(),
+ columnLevel_(NULL),
- grantee_(0)
+ grantee_(0),
+ hasPublicPriv_(false)
{}
virtual ~PrivMgrDesc() // destructor
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b10bc1b0/core/sql/sqlcomp/PrivMgrPrivileges.cpp
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b10bc1b0/core/sql/sqlcomp/QCache.cpp
----------------------------------------------------------------------