You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by an...@apache.org on 2016/10/07 23:05:38 UTC
[1/8] incubator-trafodion git commit: similarity check changes,
commit #1
Repository: incubator-trafodion
Updated Branches:
refs/heads/master 5cd718a2f -> dd5ea5ae8
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/comexe/LateBindInfo.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/LateBindInfo.h b/core/sql/comexe/LateBindInfo.h
index ae286b6..38afb40 100644
--- a/core/sql/comexe/LateBindInfo.h
+++ b/core/sql/comexe/LateBindInfo.h
@@ -436,296 +436,55 @@ private:
// ---------------------------------------------------------------------
typedef NAVersionedObjectPtrTempl<LateNameInfoList> LateNameInfoListPtr;
-
-class ResolvedName
-{
-public:
- ResolvedName()
- : flags_(0),
- numIndexes_(-1)
- {str_pad(filler_, sizeof(filler_), '\0');};
-
- char * resolvedGuardianName() { return resolvedGuardianName_; };
- char * resolvedAnsiName() { return resolvedAnsiName_; };
- void setResolvedAnsiName(char *name) { resolvedAnsiName_ = name; };
-
- Int16 numIndexes() { return numIndexes_; }
- void setNumIndexes(Int16 i) { numIndexes_ = i; }
-
- void resetFlags() { flags_ = 0; };
- void resetFiller() {str_pad(filler_, sizeof(filler_), '\0'); };
- NABoolean ignoreTS() { return (flags_ & IGNORE_TS) != 0; };
- void setIgnoreTS(short v)
- { (v ? flags_ |= IGNORE_TS : flags_ &= ~IGNORE_TS); }
-
- NABoolean validateNumIndexes() { return (flags_ & VALIDATE_NUM_INDEXES) != 0; };
- void setValidateNumIndexes(short v)
- { (v ? flags_ |= VALIDATE_NUM_INDEXES : flags_ &= ~VALIDATE_NUM_INDEXES); }
-
-private:
- enum
- {
- IGNORE_TS = 0x0001,
- VALIDATE_NUM_INDEXES = 0x0002
- };
-
- ULng32 flags_;
- char resolvedGuardianName_[MAX_PHYSICAL_NAME_LENGTH];
- char *resolvedAnsiName_;
-
- Int16 numIndexes_;
- char filler_[50];
-};
-
-// An list of LateNameInfo_ generated at compiled time.
-// All list entries are allocated in a contiguous space
-// so they could be accessed quickly.
-class ResolvedNameList
-{
-public:
- ResolvedNameList()
- {str_pad(filler_, sizeof(filler_), '\0');version_=0; };
-
- ResolvedName &getResolvedName(Int32 i)
- {
- return resolvedName_[i];
- };
-
- ULng32 &numEntries() { return numEntries_; };
-
- // returns the length of total info that needs to be sent to compiler
- // at recomp time. This info is used to get to the actual tablename
- // (and not the prototype name) that was specified thru a hvar/param/env
- // var.
- ULng32 getRecompResolvedNameListLen();
- // puts recomp info into 'buffer'. Space is to be allocated by caller.
- void getRecompResolvedNameList(char * buffer);
-
- void resetFlags()
- {
- flags_ = 0;
- for (UInt32 i = 0; i < numEntries_; i++)
- {
- resolvedName_[i].resetFlags();
- }
- };
- void resetFiller()
- {
- str_pad(filler_, sizeof(filler_), '\0');
-
- for (UInt32 i = 0; i < numEntries_; i++)
- {
- resolvedName_[i].resetFiller();
- }
- }
- void translateFromOldVersion(ResolvedNameListPre1800 *newrnl);
- void setVersion(short version) { version_ = version; }
- short getVersion() {return version_;}
-
-private:
- ULng32 flags_;
-
- ULng32 numEntries_;
-
- ResolvedName resolvedName_[1];
- short version_;
- char filler_[54];
-};
-
-// name info needed at automatic recomp time. Sent
-// by executor to arkcmp. It uses this to replace the original
-// compile time ansi name with the actual runtime ansi name
-// when the query is recompiled.
-class RecompLateNameInfo
-{
-public:
- RecompLateNameInfo(){flags_ = 0; str_pad(filler_, sizeof(filler_), '\0');};
-
- char * varName() { return varName_; };
- char * compileTimeAnsiName() { return compileTimeAnsiName_; };
- char * actualAnsiName() { return actualAnsiName_; };
-
- void setMPalias(short v) {(v ? flags_ |= IS_MPALIAS : flags_ &= ~IS_MPALIAS); };
- NABoolean isMPalias() { return (flags_ & IS_MPALIAS) != 0; };
-
-private:
- enum RecompLateNameInfoFlags
- {
- IS_MPALIAS = 0x0001 // the variable contains an mpalias name.
- };
-
-char varName_[50];
-
-// the compile-time ANSI name prototype
-// value for the table name at original compile time.
-char compileTimeAnsiName_[ComAnsiNamePart::MAX_ANSI_NAME_EXT_LEN+1];
-
-// actual value of varName_ that was input at runtime.
-char actualAnsiName_[ComAnsiNamePart::MAX_ANSI_NAME_EXT_LEN+1];
-
-ULng32 flags_;
-char filler_[50];
-};
-
-class RecompLateNameInfoList
-{
-public:
- RecompLateNameInfoList()
- {
- str_pad(filler_, sizeof(filler_), '\0');
- version_=0;
- };
-
- ULng32 &numEntries() { return numEntries_; };
-
- RecompLateNameInfo &getRecompLateNameInfo(Int32 i)
- {
- return lateNameInfo_[i];
- };
-
-private:
- ULng32 numEntries_;
- RecompLateNameInfo lateNameInfo_[1];
- short version_;
- char filler_[50];
-};
-
-
-//------------------------------------------------------------------------------
-
-class RecompLateNameInfoPre1800
-{
-public:
- RecompLateNameInfoPre1800(){};
- char * varName() { return varName_; };
- char * compileTimeAnsiName() { return compileTimeAnsiName_; };
- char * actualAnsiName() { return actualAnsiName_; };
-
- void setMPalias(short v) {(v ? flags_ |= IS_MPALIAS : flags_ &= ~IS_MPALIAS); };
- NABoolean isMPalias() { return (flags_ & IS_MPALIAS) != 0; };
-
-private:
- enum RecompLateNameInfoFlags
- {
- IS_MPALIAS = 0x0001 // the variable contains an mpalias name.
- };
-
- char varName_[50];
-
- // the compile-time ANSI name prototype
- // value for the table name at original compile time.
- char compileTimeAnsiName_[ComAnsiNamePart::MAX_ANSI_NAME_EXT_LEN+1];
-
- // actual value of varName_ that was input at runtime.
- char actualAnsiName_[ComAnsiNamePart::MAX_ANSI_NAME_EXT_LEN+1];
-
- ULng32 flags_;
-
-};
-
-class RecompLateNameInfoListPre1800
-{
-public:
- RecompLateNameInfoListPre1800(){};
- ULng32 &numEntries() { return numEntries_; };
-
- RecompLateNameInfoPre1800 &getRecompLateNameInfo(Int32 i)
- {
- return lateNameInfo_[i];
- };
- void translateFromNewVersion();
-private:
- ULng32 numEntries_;
- RecompLateNameInfoPre1800 lateNameInfo_[1];
-};
-
-
-class ResolvedNamePre1800
+class AnsiOrNskName : public NABasicObject
{
public:
- ResolvedNamePre1800()
- : flags_(0),
- numIndexes_(-1)
- {};
- char * resolvedGuardianName() { return resolvedGuardianName_; };
- char * resolvedAnsiName() { return resolvedAnsiName_; };
- void setResolvedAnsiName(char *name) { resolvedAnsiName_ = name; };
-
- Int16 numIndexes() { return numIndexes_; }
- void setNumIndexes(Int16 i) { numIndexes_ = i; }
-
- void resetFlags() { flags_ = 0; };
- NABoolean ignoreTS() { return (flags_ & IGNORE_TS) != 0; };
- void setIgnoreTS(short v)
- { (v ? flags_ |= IGNORE_TS : flags_ &= ~IGNORE_TS); }
-
- NABoolean validateNumIndexes() { return (flags_ & VALIDATE_NUM_INDEXES) != 0; };
- void setValidateNumIndexes(short v)
- { (v ? flags_ |= VALIDATE_NUM_INDEXES : flags_ &= ~VALIDATE_NUM_INDEXES); }
+ AnsiOrNskName(char *inName);
+
+ char *getInternalName() ;
+ char *getExternalName() ;
+ Int16 extractParts(Lng32 &numParts,
+ char *parts[]);
+ Int16 equals(AnsiOrNskName *name);
+ Int16 convertAnsiOrNskName(bool doCheck = TRUE);
+ Int16 fillInMissingParts(char *schemaName);
+ bool isNskName();
+ Int16 updateNSKInternalName(char *inName);
+ Int16 quoteNSKExtName();
private:
- enum
- {
- IGNORE_TS = 0x0001,
- VALIDATE_NUM_INDEXES = 0x0002
- };
-
- ULng32 flags_;
- char resolvedGuardianName_[MAX_PHYSICAL_NAME_LENGTH];
- char *resolvedAnsiName_;
-
- Int16 numIndexes_;
+ char extName_[MAX_ANSI_NAME_LENGTH]; // Given (external) 3-part name
+ // The ansi name with quotes stripped out and checked for ANSI name conventions.
+ // The maximum length (in bytes) of a UTF8 internal name is almost as long as
+ // that of the corresponding external name therefore we make the size of the array
+ // for the 3-part interal name the same as that for the 3-part external name.
+ char intName_[MAX_ANSI_NAME_LENGTH];
+ Int16 noOfParts_;
+ bool isNskName_; // TRUE if NSK name, FALSE if ansi name
+ char parts_[4][ComMAX_1_PART_EXTERNAL_UTF8_NAME_LEN_IN_BYTES+1]; // in UTF8
+ bool isValid_; // The flag that denotes if the name is checked and extracted into parts
+ bool isError_;
};
-class ResolvedNameListPre1800
+///////////////////////////////////////////////////////////
+// class TrafSimilarityTableInfo
+///////////////////////////////////////////////////////////
+class TrafSimilarityTableInfo : public NAVersionedObject
{
public:
- ResolvedNameListPre1800()
- {};
- ResolvedNameListPre1800(ResolvedNameList *newrnl, CollHeap *heap);
- ResolvedNamePre1800 &getResolvedName(Int32 i)
- {
- return resolvedName_[i];
- };
-
- ULng32 &numEntries() { return numEntries_; };
-
- // returns the length of total info that needs to be sent to compiler
- // at recomp time. This info is used to get to the actual tablename
- // (and not the prototype name) that was specified thru a hvar/param/env
- // var.
- ULng32 getRecompResolvedNameListLen();
- // puts recomp info into 'buffer'. Space is to be allocated by caller.
- void getRecompResolvedNameList(char * buffer);
-
- void resetFlags()
- {
- flags_ = 0;
- for (UInt32 i = 0; i < numEntries_; i++)
- {
- resolvedName_[i].resetFlags();
- }
- };
-
- void translateFromNewVersion(ResolvedNameList *newrnl);
-private:
- ULng32 flags_;
-
- ULng32 numEntries_;
-
- ResolvedNamePre1800 resolvedName_[1];
-
-};
-//------------------------------------------------------------------------------
+ TrafSimilarityTableInfo(char * tableName,
+ NABoolean isHive,
+ char * hdfsRootDir,
+ Int64 modTS, Int32 numPartnLevels,
+ Queue * hdfsDirsToCheck,
+ char * hdfsHostName,
+ Int32 hdfsPort);
+ TrafSimilarityTableInfo();
+ ~TrafSimilarityTableInfo();
-
-class SimilarityTableInfo : public NAVersionedObject
-{
-public:
- SimilarityTableInfo();
- ~SimilarityTableInfo();
+ NABoolean operator==(TrafSimilarityTableInfo &o);
// ---------------------------------------------------------------------
// Redefine virtual functions required for Versioning.
@@ -740,72 +499,56 @@ public:
setImageVersionID(0,getClassVersionID());
}
- virtual short getClassSize() { return (short)sizeof(SimilarityTableInfo); }
+ virtual short getClassSize() { return (short)sizeof(TrafSimilarityTableInfo); }
Long pack(void * space);
Lng32 unpack(void *, void * reallocator);
- NABoolean entrySeq() {return ((flags_ & ENTRY_SEQ) != 0);};
- void setEntrySeq(NABoolean v)
- { (v ? flags_ |= ENTRY_SEQ : flags_ &= ~ENTRY_SEQ); };
-
- NABoolean audited() {return ((flags_ & AUDITED) != 0);};
- void setAudited(NABoolean v)
- { (v ? flags_ |= AUDITED : flags_ &= ~AUDITED); };
+ Int64 modTS() { return modTS_; }
+ Int32 numPartnLevels() { return numPartnLevels_; }
- NABoolean isPartitioned() {return ((flags_ & PARTITIONED) != 0);};
- void setIsPartitioned(NABoolean v)
- { (v ? flags_ |= PARTITIONED : flags_ &= ~PARTITIONED); };
+ char * tableName() { return tableName_; }
+ char * hdfsRootDir() { return hdfsRootDir_; }
+ Queue * hdfsDirsToCheck() { return hdfsDirsToCheck_; }
- NABoolean noPartitionSimCheck() {return ((flags_ & NO_PARTITION_SIM_CHECK) != 0);};
- void setNoPartitionSimCheck(NABoolean v)
- { (v ? flags_ |= NO_PARTITION_SIM_CHECK : flags_ &= ~NO_PARTITION_SIM_CHECK); };
+ char * hdfsHostName() { return hdfsHostName_; }
+ Int32 hdfsPort() { return hdfsPort_; }
- unsigned short &numPartitions() { return numPartitions_; };
-
- void setPartitioningScheme(const char * scheme)
- {
- str_cpy_all(partitioningScheme_, scheme, 2);
- }
- char * getPartitioningScheme(){return partitioningScheme_;};
+ NABoolean isHive() {return ((flags_ & HIVE) != 0);};
+ void setIsHive(NABoolean v)
+ { (v ? flags_ |= HIVE : flags_ &= ~HIVE); };
private:
enum Flags
{
- ENTRY_SEQ = 0x0001,
- AUDITED = 0x0002,
- PARTITIONED = 0x0004,
-
- // if set, indicates that partition sim check always passes even if
- // the num of partitions are different. Used in cases where we know
- // that the change in num of partns will not change the plan, for ex,
- // if OLT opt is being used in which case only one partn will be
- // accessed at runtime.
- NO_PARTITION_SIM_CHECK = 0x0008
+ HIVE = 0x0001
};
- UInt32 flags_; // 00-03
- UInt16 numPartitions_; // 04-05
+ Int64 modTS_;
+ Int32 numPartnLevels_;
+ UInt32 flags_;
- // see common/ComSmallDefs.h for values for this field.
- // (COM_RANGE_PARTITIONING_LIT...etc).
- char partitioningScheme_[2]; // 06-07
+ NABasicPtr tableName_;
+ NABasicPtr hdfsRootDir_;
+ QueuePtr hdfsDirsToCheck_;
- char fillersSimilarityTableInfo_[16]; // 08-23
+ NABasicPtr hdfsHostName_;
+ Int32 hdfsPort_;
-};
+ char fillers_[12];
-// ---------------------------------------------------------------------
-// Template instantiation to produce a 64-bit pointer emulator class
-// for SimilarityTableInfo
-// ---------------------------------------------------------------------
-typedef NAVersionedObjectPtrTempl<SimilarityTableInfo> SimilarityTableInfoPtr;
+};
+typedef NAVersionedObjectPtrTempl<TrafSimilarityTableInfo> TrafSimilarityTableInfoPtr;
-class SimilarityInfo : public NAVersionedObject
+///////////////////////////////////////////////////////////////////
+// class TrafQuerySimilarityInfo
+///////////////////////////////////////////////////////////////////
+class TrafQuerySimilarityInfo : public NAVersionedObject
{
public:
- SimilarityInfo(NAMemory * heap = NULL);
- ~SimilarityInfo();
+ TrafQuerySimilarityInfo(Queue * siList);
+ TrafQuerySimilarityInfo();
+ ~TrafQuerySimilarityInfo();
// ---------------------------------------------------------------------
// Redefine virtual functions required for Versioning.
@@ -820,289 +563,45 @@ public:
setImageVersionID(0,getClassVersionID());
}
- virtual short getClassSize() { return (short)sizeof(SimilarityInfo); }
+ virtual short getClassSize() { return (short)sizeof(TrafQuerySimilarityInfo); }
+
+ Queue * siList() { return siList_; };
Long pack(void * space);
Lng32 unpack(void *, void * reallocator);
- ExpTupleDesc* getTupleDesc() { return tupleDesc_; };
- void setTupleDesc(ExpTupleDesc *td) { tupleDesc_ = td; };
-
- Queue* getColNameList() { return colNameList_; };
- void setColNameList(Queue *cnl) { colNameList_ = cnl; };
- SimilarityTableInfo* getTableInfo() { return sti_;};
- void setTableInfo(SimilarityTableInfo* sti) { sti_ = sti;};
- // ArkFsIndexMapArray* getIndexMapArray() { return indexMapArray_; };
- // void setIndexMapArray(ArkFsIndexMapArray* ima) { indexMapArray_ = ima; };
- //++ MV
- void setMvAttributesBitmap(UInt32 bitmap) {mvAttributesBitmap_ = bitmap;};
- UInt32 getMvAttributesBitmap() const{return mvAttributesBitmap_;};
-
- void setSimCheck(short s)
- {
- if (s)
- runtimeFlags_ |= DO_SIM_CHK;
- else
- runtimeFlags_ &= ~DO_SIM_CHK;
- }
+ NABoolean disableSimCheck()
+ {return ((flags_ & DISABLE_SIM_CHECK) != 0);};
+ void setDisableSimCheck(NABoolean v)
+ {(v ? flags_ |= DISABLE_SIM_CHECK : flags_ &= ~DISABLE_SIM_CHECK);};
- NABoolean doSimCheck()
- {
- return ((runtimeFlags_ & DO_SIM_CHK) ? TRUE : FALSE);
- };
-
- void setReResolveName(short s)
- {
- if (s)
- runtimeFlags_ |= RE_RESOLVE_NAME;
- else
- runtimeFlags_ &= ~RE_RESOLVE_NAME;
- }
+ NABoolean disableAutoRecomp()
+ {return ((flags_ & DISABLE_AUTO_RECOMP) != 0);};
+ void setDisableAutoRecomp(NABoolean v)
+ {(v ? flags_ |= DISABLE_AUTO_RECOMP : flags_ &= ~DISABLE_AUTO_RECOMP);};
- NABoolean reResolveName()
- {
- return ((runtimeFlags_ & RE_RESOLVE_NAME) ? TRUE : FALSE);
- };
-
- void resetRuntimeFlags() { runtimeFlags_ = 0;};
-
- void disableSimCheck() { compiletimeFlags_ |= SIM_CHECK_DISABLE; };
- void enableSimCheck() { compiletimeFlags_ &= ~SIM_CHECK_DISABLE; };
- NABoolean simCheckDisable() { return ((compiletimeFlags_ & SIM_CHECK_DISABLE) != 0);};
-
- void setInternalSimCheck() { compiletimeFlags_ |= INTERNAL_SIM_CHECK; };
- NABoolean internalSimCheck() { return ((compiletimeFlags_ & INTERNAL_SIM_CHECK) != 0);};
-
- void setGetMatchingIndex() { compiletimeFlags_ |= GET_MATCHING_INDEX; };
- NABoolean getMatchingIndex() { return ((compiletimeFlags_ & GET_MATCHING_INDEX) != 0);};
-
private:
- enum CompiletimeFlags
- {
- SIM_CHECK_DISABLE = 0x0001, INTERNAL_SIM_CHECK = 0x0002,
- GET_MATCHING_INDEX = 0x0004 // skip sim check, get resolved name from
- // index info list(see QuerySimilarityList)
-
- };
-
- enum RuntimeFlags
- {
- DO_SIM_CHK = 0x0001,
- RE_RESOLVE_NAME = 0x0002
- };
-
- UInt32 compiletimeFlags_; // 00-03
- UInt32 runtimeFlags_; // 04-07
- ExpTupleDescPtr tupleDesc_; // 08-15
- // list of column names. Each name is a null-terminated "char *".
- QueuePtr colNameList_; // 24-31
-
- SimilarityTableInfoPtr sti_; // 32-39
- UInt32 mvAttributesBitmap_; // 56-59
-
- char fillersSimilarityInfo_[36]; // 60-95
-};
-
-// ---------------------------------------------------------------------
-// Template instantiation to produce a 64-bit pointer emulator class
-// for SimilarityInfo
-// ---------------------------------------------------------------------
-typedef NAVersionedObjectPtrTempl<SimilarityInfo> SimilarityInfoPtr;
-
-class IndexInfo : public NAVersionedObject
-{
-public:
- IndexInfo()
+ enum Flags
{
- flags_ = 0;
+ DISABLE_SIM_CHECK = 0x0002,
+ DISABLE_AUTO_RECOMP = 0x0004
};
- // ---------------------------------------------------------------------
- // Redefine virtual functions required for Versioning.
- //----------------------------------------------------------------------
-NA_EIDPROC
- virtual unsigned char getClassVersionID()
- {
- return 1;
- }
-
-NA_EIDPROC
- virtual void populateImageVersionIDArray()
- {
- setImageVersionID(0,getClassVersionID());
- }
-
-NA_EIDPROC
- virtual short getClassSize() { return (short)sizeof(IndexInfo); }
-
- // Fix for CR 10-010614-3437: Redefined ime_ to be a versioned
- // object pointer, in order to pack and unpack it correctly.
- // Also defined the get and set methods.
- char* indexAnsiName() { return indexAnsiName_;}
- char* indexPhyName() { return indexPhyName_; }
-
- virtual Long pack(void * space);
- virtual Lng32 unpack(void *, void * reallocator);
-
- void setSimPartInfo(NABoolean v)
- {
- (v ? flags_ |= SIM_PART_INFO : flags_ &= ~SIM_PART_INFO);
- };
- NABoolean simPartInfo() { return (flags_ & SIM_PART_INFO) != 0; };
-
- void setPartitioningScheme(const char * scheme)
- {
- str_cpy_all(partitioningScheme_, scheme, 2);
- }
- char * getPartitioningScheme() {return partitioningScheme_;};
-
- void setNumPartitions(ULng32 numPartitions = 0)
- {
- numPartitions_ = (unsigned short) numPartitions;
- }
- ULng32 getNumPartitions() {return (ULng32) numPartitions_;};
-
-private:
- enum Flags
- {
- // set by genSimilarityInfo if index partition info present
- SIM_PART_INFO = 0x0001
- };
-
- // See common/ComAnsiNamePart.h. 6 bytes added here for null terminator and
- // filler to make length multiple of 8.
- enum { MAX_ANSI_IDENTIFIER_LEN = 258 + 6 };
-
- char indexAnsiName_[MAX_ANSI_IDENTIFIER_LEN]; // 00-263
+ // Queue of class TrafSimilarityTableInfo
+ QueuePtr siList_; // 00-07
- // resolved index name
- char indexPhyName_[56]; // 264-319
-#ifdef NA_64BIT
- // dg64 - 32-bits on disk
- UInt32 flags_; // 328-331
-#else
- ULng32 flags_; // 328-331
-#endif
+ Int16 option_; // 08-09
- // number of partitions
- unsigned short numPartitions_; // 332-333
+ Int16 flags_; // 10-11
- // partitioning scheme, see common/comSmallDefs.h
- char partitioningScheme_[2]; // 334-335
-
- char filler_[32]; // 336-367
-};
-
-// ---------------------------------------------------------------------
-// Template instantiation to produce a 64-bit pointer emulator class
-// for SimilarityInfo
-// ---------------------------------------------------------------------
-typedef NAVersionedObjectPtrTempl<IndexInfo> IndexInfoPtr;
-
-class QuerySimilarityInfo : public NAVersionedObject
-{
-public:
- enum Options { RECOMP_ON_TS_MISMATCH, ERROR_ON_TS_MISMATCH,
- SIM_CHECK_ON_TS_MISMATCH, INTERNAL_SIM_CHECK,
- SIM_CHECK_AND_RECOMP_ON_FAILURE,
- SIM_CHECK_AND_ERROR_ON_FAILURE
- };
- QuerySimilarityInfo(NAMemory * heap);
- QuerySimilarityInfo();
- ~QuerySimilarityInfo();
-
- // ---------------------------------------------------------------------
- // Redefine virtual functions required for Versioning.
- //----------------------------------------------------------------------
- virtual unsigned char getClassVersionID()
- {
- return 1;
- }
-
- virtual void populateImageVersionIDArray()
- {
- setImageVersionID(0,getClassVersionID());
- }
-
- virtual short getClassSize() { return (short)sizeof(QuerySimilarityInfo); }
-
- Queue * siList() { return siList_; };
-
- Queue * indexInfoList() { return indexInfoList_; };
-
- void setIndexInfoList(Queue *iil)
- {
- indexInfoList_ = iil;
- }
-
- // Options &similarityCheckOption() { return option_; };
- Options getSimilarityCheckOption() { return (Options)option_; };
- void setSimilarityCheckOption(Options op) { option_ = op; };
-
- Int16 &namePosition() { return namePosition_; };
-
- Long pack(void * space);
- Lng32 unpack(void *, void * reallocator);
-
-private:
-
- NAMemory *heap_;
-#ifndef NA_64BIT
- char fillersQuerySimilarityInfo1_[4];
-#endif // 00-07
-
- // Queue of class SimilarityInfo
- QueuePtr siList_; // 08-15
-
- // List of indices that have to be checked for similarity.
- // The table whose indices are to be
- // checked is at position namePosition_ of siList_(member of this
- // class) and LateNameInfoList (member of Root Tdb).
- // Queue of class IndexInfo.
- QueuePtr indexInfoList_; // 16-23
- Int16 namePosition_; // 24-25
-
- Int16 option_; // 26-27
-
- char fillersQuerySimilarityInfo_[36]; // 28-55
+ char fillersQuerySimilarityInfo_[36]; // 12-47
};
// ---------------------------------------------------------------------
// Template instantiation to produce a 64-bit pointer emulator class
-// for QuerySimilarityInfo
+// for TrafQuerySimilarityInfo
// ---------------------------------------------------------------------
-typedef NAVersionedObjectPtrTempl<QuerySimilarityInfo> QuerySimilarityInfoPtr;
-
-
-class AnsiOrNskName : public NABasicObject
-{
-public:
- AnsiOrNskName(char *inName);
-
- char *getInternalName() ;
- char *getExternalName() ;
- Int16 extractParts(Lng32 &numParts,
- char *parts[]);
- Int16 equals(AnsiOrNskName *name);
- Int16 convertAnsiOrNskName(bool doCheck = TRUE);
- Int16 fillInMissingParts(char *schemaName);
- bool isNskName();
- Int16 updateNSKInternalName(char *inName);
- Int16 quoteNSKExtName();
-private:
-
- char extName_[MAX_ANSI_NAME_LENGTH]; // Given (external) 3-part name
- // The ansi name with quotes stripped out and checked for ANSI name conventions.
- // The maximum length (in bytes) of a UTF8 internal name is almost as long as
- // that of the corresponding external name therefore we make the size of the array
- // for the 3-part interal name the same as that for the 3-part external name.
- char intName_[MAX_ANSI_NAME_LENGTH];
- Int16 noOfParts_;
- bool isNskName_; // TRUE if NSK name, FALSE if ansi name
- char parts_[4][ComMAX_1_PART_EXTERNAL_UTF8_NAME_LEN_IN_BYTES+1]; // in UTF8
- bool isValid_; // The flag that denotes if the name is checked and extracted into parts
- bool isError_;
-};
+typedef NAVersionedObjectPtrTempl<TrafQuerySimilarityInfo> TrafQuerySimilarityInfoPtr;
#endif // EX_LATEBIND_H
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/ExExeUtilMisc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilMisc.cpp b/core/sql/executor/ExExeUtilMisc.cpp
index 47c817d..440c83b 100644
--- a/core/sql/executor/ExExeUtilMisc.cpp
+++ b/core/sql/executor/ExExeUtilMisc.cpp
@@ -2303,6 +2303,8 @@ short ExExeUtilHiveTruncateTcb::work()
case DATA_MOD_CHECK_:
{
Int64 failedModTS = -1;
+ Lng32 failedLocBufLen = 1000;
+ char failedLocBuf[failedLocBufLen];
cliRC = ExpLOBinterfaceDataModCheck
(lobGlob_,
(htTdb().getPartnLocation() ?
@@ -2312,7 +2314,8 @@ short ExExeUtilHiveTruncateTcb::work()
htTdb().getHdfsPort(),
htTdb().getModTS(),
0,
- failedModTS);
+ failedModTS,
+ failedLocBuf, failedLocBufLen);
if (cliRC < 0)
{
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/ExFastTransport.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExFastTransport.cpp b/core/sql/executor/ExFastTransport.cpp
index 8c7e9bb..2fe4a60 100644
--- a/core/sql/executor/ExFastTransport.cpp
+++ b/core/sql/executor/ExFastTransport.cpp
@@ -482,7 +482,10 @@ Lng32 ExHdfsFastExtractTcb::lobInterfaceCreate()
}
-Lng32 ExHdfsFastExtractTcb::lobInterfaceDataModCheck(Int64 &failedModTS)
+Lng32 ExHdfsFastExtractTcb::lobInterfaceDataModCheck
+(Int64 &failedModTS,
+ char * failedLocBuf,
+ Int32 &failedLocBufLen)
{
return ExpLOBinterfaceDataModCheck(lobGlob_,
targetLocation_,
@@ -490,7 +493,8 @@ Lng32 ExHdfsFastExtractTcb::lobInterfaceDataModCheck(Int64 &failedModTS)
hdfsPort_,
myTdb().getModTSforDir(),
0,
- failedModTS);
+ failedModTS,
+ failedLocBuf, failedLocBufLen);
}
@@ -721,7 +725,10 @@ ExWorkProcRetcode ExHdfsFastExtractTcb::work()
snprintf(targetLocation_,999, "%s", myTdb().getTargetName());
Int64 failedModTS = -1;
- retcode = lobInterfaceDataModCheck(failedModTS);
+ Lng32 failedLocBufLen = 1000;
+ char failedLocBuf[failedLocBufLen];
+ retcode =
+ lobInterfaceDataModCheck(failedModTS, failedLocBuf, failedLocBufLen);
if (retcode < 0)
{
Lng32 cliError = 0;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/ExFastTransport.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExFastTransport.h b/core/sql/executor/ExFastTransport.h
index 428ad42..d0875f5 100644
--- a/core/sql/executor/ExFastTransport.h
+++ b/core/sql/executor/ExFastTransport.h
@@ -405,7 +405,9 @@ protected:
Lng32 lobInterfaceInsert(ssize_t bytesToWrite);
Lng32 lobInterfaceCreate();
Lng32 lobInterfaceClose();
- Lng32 lobInterfaceDataModCheck(Int64 &failedModTS);
+ Lng32 lobInterfaceDataModCheck(Int64 &failedModTS,
+ char * failedLocBuf,
+ Int32 &failedLocBufLen);
virtual void insertUpQueueEntry(ex_queue::up_status status,
ComDiagsArea *diags,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/ExHdfsScan.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExHdfsScan.cpp b/core/sql/executor/ExHdfsScan.cpp
index 222ed71..0552f6c 100644
--- a/core/sql/executor/ExHdfsScan.cpp
+++ b/core/sql/executor/ExHdfsScan.cpp
@@ -449,6 +449,8 @@ ExWorkProcRetcode ExHdfsScanTcb::work()
}
Int64 failedModTS = -1;
+ Lng32 failedLocBufLen = 1000;
+ char failedLocBuf[failedLocBufLen];
retcode = ExpLOBinterfaceDataModCheck
(lobGlob_,
dirPath,
@@ -456,7 +458,8 @@ ExWorkProcRetcode ExHdfsScanTcb::work()
hdfsScanTdb().port_,
modTS,
numOfPartLevels,
- failedModTS);
+ failedModTS,
+ failedLocBuf, failedLocBufLen);
if (retcode < 0)
{
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/Ex_esp_msg.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/Ex_esp_msg.h b/core/sql/executor/Ex_esp_msg.h
index 2fe6756..4b7b924 100644
--- a/core/sql/executor/Ex_esp_msg.h
+++ b/core/sql/executor/Ex_esp_msg.h
@@ -83,9 +83,6 @@ class ExSMDownloadInfo;
// -----------------------------------------------------------------------
// Forward references
// -----------------------------------------------------------------------
-class ResolvedNameList;
-class ResolvedNameListPre1800;
-class ResolvedName;
class TimeoutData;
// -----------------------------------------------------------------------
@@ -1095,43 +1092,6 @@ public:
};
// -----------------------------------------------------------------------
-// Information needed to open SQL tables.
-// -----------------------------------------------------------------------
-class ExResolvedNameObj : public ExEspMsgObj
-{
-public:
-
- ExResolvedNameObj(ResolvedNameList * rnl,
- NAMemory * heap,
- NABoolean takeOwnership = FALSE);
- ~ExResolvedNameObj();
-
- // accessor functions
- inline ResolvedNameList * resolvedNameList() { return rnl_; }
-
- // method needed to pack and unpack this object
- IpcMessageObjSize packedLength();
- IpcMessageObjSize packObjIntoMessage(IpcMessageBufferPtr buffer);
- void unpackObj(IpcMessageObjType objType,
- IpcMessageObjVersion objVersion,
- NABoolean sameEndianness,
- IpcMessageObjSize objSize,
- IpcConstMessageBufferPtr buffer);
-
- // ---------------------------------------------------------------------
- // Override of the IpcMessageObj::isActualVersionOK virtual method.
- // An ExResolvedNameObj's version is OK if it is one of a set of known versions.
- //
- NABoolean isActualVersionOK (const IpcMessageObjVersion actualVersion) const
- {return ( (actualVersion == Pre1800ResolvedNameObjVersion) || (actualVersion == CurrResolvedNameObjVersion) ); }
-
-private:
- ResolvedNameList * rnl_;
- ExIpcMsgBoolean iOwnRnl_; // TRUE means destructor deletes rnl_
-};
-
-
-// -----------------------------------------------------------------------
// The generated data of a fragment, in a form that can be shipped in
// a message.
// -----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/ex_control.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_control.cpp b/core/sql/executor/ex_control.cpp
index 3d93243..70a1271 100644
--- a/core/sql/executor/ex_control.cpp
+++ b/core/sql/executor/ex_control.cpp
@@ -182,7 +182,7 @@ short ExControlTcb::work()
// Only a STATIC compile will actually affect Arkcmp's context.
- CmpCompileInfo c(buf, usedlen, sqlTextCharSet, NULL, 0, NULL, 0, NULL, 0, 0, 0);
+ CmpCompileInfo c(buf, usedlen, sqlTextCharSet, NULL, 0, NULL, 0, 0, 0);
size_t dataLen = c.getLength();
#ifdef NA_CMPDLL
NABoolean saveControl = FALSE; // if save controls in exe ControlInfoTables
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/ex_ddl.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_ddl.cpp b/core/sql/executor/ex_ddl.cpp
index 1c60814..e06aa2f 100644
--- a/core/sql/executor/ex_ddl.cpp
+++ b/core/sql/executor/ex_ddl.cpp
@@ -204,7 +204,6 @@ short ExDDLTcb::work()
CmpCompileInfo c(ddlTdb().query_, ddlTdb().queryLen_ + 1,
(Lng32)ddlTdb().queryCharSet_,
- NULL, 0,
ddlTdb().objectName_, ddlTdb().objectNameLen_+1,
masterGlob->getStatement()->recompControlInfo(),
masterGlob->getStatement()->recompControlInfoLen(),
@@ -1473,7 +1472,6 @@ short ExProcessVolatileTableTcb::work()
CmpCompileInfo c(pvtTdb().query_, pvtTdb().queryLen_ + 1,
pvtTdb().queryCharSet_,
- NULL, 0,
pvtTdb().objectName_, pvtTdb().objectNameLen_+1,
masterGlob->getStatement()->recompControlInfo(),
masterGlob->getStatement()->recompControlInfoLen(),
@@ -1927,7 +1925,6 @@ short ExProcessInMemoryTableTcb::work()
CmpCompileInfo c(pimtTdb().query_, pimtTdb().queryLen_ + 1,
pimtTdb().queryCharSet_,
- NULL, 0,
pimtTdb().objectName_, pimtTdb().objectNameLen_+1,
masterGlob->getStatement()->recompControlInfo(),
masterGlob->getStatement()->recompControlInfoLen(),
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/ex_esp_frag_dir.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_esp_frag_dir.cpp b/core/sql/executor/ex_esp_frag_dir.cpp
index 5598015..f2ba14f 100644
--- a/core/sql/executor/ex_esp_frag_dir.cpp
+++ b/core/sql/executor/ex_esp_frag_dir.cpp
@@ -1410,13 +1410,6 @@ void ExEspControlMessage::actOnFixupFragmentReq(ComDiagsArea &da)
}
}
- if (moreObjects() AND getNextObjType() == ESP_LATE_NAME_INFO)
- {
- lnio = new(instHeap) ExResolvedNameObj(NULL, instHeap, TRUE);
-
- *this >> *lnio;
- }
-
if (moreObjects() AND getNextObjType() == ESP_RESOURCE_INFO)
{
ri = new(instHeap) ExMsgResourceInfo(NULL,instHeap);
@@ -1450,10 +1443,6 @@ void ExEspControlMessage::actOnFixupFragmentReq(ComDiagsArea &da)
// fragment entry
glob->setPidFragList(poflist);
- // Soln 10-041117-1848
- if (lnio)
- glob->resolvedNameList() = lnio->resolvedNameList();
-
glob->setResourceInfo(ri);
if ( td ) * glob->getTimeoutData() = td->getTimeoutData() ;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/ex_esp_msg.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_esp_msg.cpp b/core/sql/executor/ex_esp_msg.cpp
index fbefd55..51e1b0e 100644
--- a/core/sql/executor/ex_esp_msg.cpp
+++ b/core/sql/executor/ex_esp_msg.cpp
@@ -763,249 +763,6 @@ ExProcessIdsOfFrag * ExProcessIdsOfFragList::findEntry(
}
// -----------------------------------------------------------------------
-// Methods for class ExResolvedNameObj
-// -----------------------------------------------------------------------
-
-ExResolvedNameObj::ExResolvedNameObj(ResolvedNameList * rnl,
- NAMemory * heap,
- NABoolean takeOwnership) :
- ExEspMsgObj(ESP_LATE_NAME_INFO,CurrResolvedNameObjVersion,heap),
- rnl_(rnl), iOwnRnl_(takeOwnership)
-{
- ex_assert(NOT iOwnRnl_ OR rnl_ == NULL,
- "Dont't support handing over ownership for now.");
-}
-
-ExResolvedNameObj::~ExResolvedNameObj()
-{
- if (iOwnRnl_)
- {
- if (getHeap())
- getHeap()->deallocateMemory(rnl_);
- else
- delete (char *) rnl_;
- }
-}
-
-IpcMessageObjSize ExResolvedNameObj::packedLength()
-{
- // The ExResolvedNameObj consists of the following pieces of information:
- //
- // |------------------------------------------------------------------------|
- // | IpcMessageObh | ResolvedNameList | List of resolved run-time ansi names|
- // |------------------------------------------------------------------------|
- IpcMessageObjSize result = 0;
- Int32 totalAnsiNameListLength = 0;
- if (getVersion() == Pre1800ResolvedNameObjVersion)
- {
- for (Int32 i=0; i < (Int32)(((ResolvedNameListPre1800 *)rnl_)->numEntries()); i++)
- {
- // For each ResolvedName object in the ResolvedNameList, compute the length
- // of the resolved run-time ANSI name, and add it to the total length. Note
- // that this includes the null-terminator for each string.
- totalAnsiNameListLength =
- totalAnsiNameListLength +
- str_len(((ResolvedNameListPre1800 *)rnl_)->getResolvedName(i).resolvedAnsiName()) + 1;
- }
-
- // The total object size if the sum of the base class size
- // (i.e., IpcMessageObj size), the size of each entry in the ResolvedNameList,
- // (i.e., numEntries * sizeof(ResolvedName)), and the total size of all
- // the resolved run-time ANSI names pointed to by each ResolvedName entry.
- result = baseClassPackedLength()
- + sizeof(ResolvedNameListPre1800) +
- (((ResolvedNameListPre1800 *)rnl_)->numEntries()-1) * sizeof(ResolvedNamePre1800) + totalAnsiNameListLength;
- }
-
- else
- {
-
- for (Int32 i=0; i < (Int32)(rnl_->numEntries()); i++)
- {
- // For each ResolvedName object in the ResolvedNameList, compute the length
- // of the resolved run-time ANSI name, and add it to the total length. Note
- // that this includes the null-terminator for each string.
- totalAnsiNameListLength =
- totalAnsiNameListLength +
- str_len(rnl_->getResolvedName(i).resolvedAnsiName()) + 1;
- }
-
- // The total object size if the sum of the base class size
- // (i.e., IpcMessageObj size), the size of each entry in the ResolvedNameList,
- // (i.e., numEntries * sizeof(ResolvedName)), and the total size of all
- // the resolved run-time ANSI names pointed to by each ResolvedName entry.
- result = baseClassPackedLength()
- + sizeof(ResolvedNameList) +
- (rnl_->numEntries()-1) * sizeof(ResolvedName) + totalAnsiNameListLength;
- }
- return result;
-}
-
-IpcMessageObjSize ExResolvedNameObj::packObjIntoMessage(
- IpcMessageBufferPtr buffer)
-{
- IpcMessageObjSize result = packBaseClassIntoMessage(buffer);
- IpcMessageObjSize size = 0;
- if (getVersion() == Pre1800ResolvedNameObjVersion)
- {
- size =
- (sizeof(ResolvedNameListPre1800) +
- (((ResolvedNameListPre1800 *)rnl_)->numEntries()-1) * sizeof(ResolvedNamePre1800));
- }
- else
- {
- size =
- (sizeof(ResolvedNameList) +(rnl_->numEntries()-1) * sizeof(ResolvedName));
- }
-#pragma nowarn(1506) // warning elimination
- str_cpy_all(buffer, (char *) rnl_, size);
-#pragma warn(1506) // warning elimination
- buffer += size;
-
- // Copy all the resolved run-time ANSI names for each ResolvedName entry
- // after the list of ResolvedName objects.
-
- if (getVersion() == Pre1800ResolvedNameObjVersion)
- {
- for (Int32 i=0; i < (Int32)(((ResolvedNameListPre1800 *)rnl_)->numEntries()); i++)
- {
- strcpy((char *)buffer, ((ResolvedNameListPre1800 *)rnl_)->
- getResolvedName(i).resolvedAnsiName());
- size += strlen(((ResolvedNameListPre1800 *)rnl_)->
- getResolvedName(i).resolvedAnsiName()) + 1;
- buffer += strlen(((ResolvedNameListPre1800 *)rnl_)->
- getResolvedName(i).resolvedAnsiName()) + 1;
- }
- }
- else
- {
- for (Int32 i=0; i < (Int32)(rnl_->numEntries()); i++)
- {
- strcpy((char *)buffer, rnl_->getResolvedName(i).resolvedAnsiName());
- size += strlen(rnl_->getResolvedName(i).resolvedAnsiName()) + 1;
- buffer += strlen(rnl_->getResolvedName(i).resolvedAnsiName()) + 1;
- }
- }
- result += size;
- return result;
-}
-
-void ExResolvedNameObj::unpackObj(IpcMessageObjType objType,
- IpcMessageObjVersion objVersion,
- NABoolean sameEndianness,
- IpcMessageObjSize objSize,
- IpcConstMessageBufferPtr buffer)
-{
- ex_assert(objType == ESP_LATE_NAME_INFO AND
- sameEndianness AND
- ((objVersion == CurrResolvedNameObjVersion AND
- (objSize >= baseClassPackedLength() +
- sizeof(ResolvedNameList) -
- sizeof(ResolvedName))) OR
- (objVersion == Pre1800ResolvedNameObjVersion )AND
- ( objSize >= baseClassPackedLength() +
- sizeof(ResolvedNameListPre1800) -
- sizeof(ResolvedNamePre1800) )),
- "Received incomplete ExResolvedNameObj.");
-
- unpackBaseClass(buffer);
- IpcMessageObjSize size,
- listSize = 0,
- namesSize = 0;
- if (objVersion == Pre1800ResolvedNameObjVersion)
- {
- ResolvedNameListPre1800 * rnlInMessage = (ResolvedNameListPre1800 *) buffer;
-
- // Calculate the size of the pre-v1800 format RNL as the sum of
- // a) The header + the entries ...
- listSize = sizeof(ResolvedNameListPre1800) +
- (rnlInMessage->numEntries()-1) * sizeof(ResolvedNamePre1800);
- // b) The lengths of the actual ANSI names, stored after the entries
- Int32 i;
- const char * ansiName = buffer + listSize;
- for (i=0; i<(Int32)(rnlInMessage->numEntries()); i++)
- {
- size = strlen(ansiName) + 1;
- namesSize += size;
- ansiName += size;
- }
-
- size = namesSize + listSize;
-
- ex_assert(objSize >= baseClassPackedLength() + size,
- "Received ExResolvedNameObj with too few entries.");
- ex_assert(NOT iOwnRnl_ OR rnl_ == NULL,
- "Dont't support reallocation of owned rnl_ for now.");
-
- // Calculate the difference in size of the old and new ResolvedNameObj
- IpcMessageObjSize diffSize = sizeof(ResolvedNameList) +
- ((rnlInMessage->numEntries()-1) * sizeof(ResolvedName)) -
- listSize;
-
- rnl_ = (ResolvedNameList *) new(getHeap()) char[objSize - baseClassPackedLength()+ diffSize ];
-
- // First unpack the old version of the resolved name list.
- ResolvedNameListPre1800 *ornl = (ResolvedNameListPre1800 *) new(getHeap()) char[size];
-#pragma nowarn(1506) // warning elimination
- str_cpy_all((char *) ornl, buffer, size);
-
- // Fixup the pointers to the resolved run-time ANSI names, given by the
- // data member resolvedAnsiName_, within each ResolvedName entry
- ansiName = (char *)ornl + listSize;
- for (i=0; i<(Int32)(ornl->numEntries()); i++)
- {
- ornl->getResolvedName(i).setResolvedAnsiName((char *)ansiName);
- ansiName += strlen(ansiName) + 1;
- }
-
- // Now translate this old version to the new version
-
- rnl_->translateFromOldVersion(ornl);
- iOwnRnl_ = TRUE;
- getHeap()->deallocateMemory(ornl);
-
-#pragma warn(1506) // warning elimination
-
- }
- else
- {
- ResolvedNameList * rnlInMessage = (ResolvedNameList *) buffer;
-
- size = sizeof(ResolvedNameList) +
- (rnlInMessage->numEntries()-1) * sizeof(ResolvedName);
-
- ex_assert(objSize >= baseClassPackedLength() + size,
- "Received ExResolvedNameObj with too few entries.");
- ex_assert(NOT iOwnRnl_ OR rnl_ == NULL,
- "Dont't support reallocation of owned rnl_ for now.");
- rnl_ = (ResolvedNameList *) new(getHeap()) char[objSize - baseClassPackedLength()];
-
-
- iOwnRnl_ = TRUE;
-
-#pragma nowarn(1506) // warning elimination
- str_cpy_all((char *) rnl_, buffer, size);
- buffer += size;
-
- // Fixup the pointers to the resolved run-time ANSI names, given by the
- // data member resolvedAnsiName_, within each ResolvedName entry, and
- // copy the actual name to the output buffer.
- char * rnlAnsiNameOffset = (char *)rnl_ + size;
- for (Int32 i=0; i<(Int32)(rnl_->numEntries()); i++)
- {
- Lng32 ansiNameLength = 0;
- rnl_->getResolvedName(i).setResolvedAnsiName(rnlAnsiNameOffset);
- strcpy(rnl_->getResolvedName(i).resolvedAnsiName(), (char *)buffer);
- ansiNameLength = strlen(rnl_->getResolvedName(i).resolvedAnsiName());
- rnlAnsiNameOffset = rnlAnsiNameOffset + ansiNameLength + 1;
- size += ansiNameLength + 1;
- buffer += ansiNameLength + 1; // sri gadde
- }
- }
-#pragma warn(1506) // warning elimination
-}
-
-// -----------------------------------------------------------------------
// Methods for class ExMsgFragment
// -----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/ex_frag_rt.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_frag_rt.cpp b/core/sql/executor/ex_frag_rt.cpp
index a6044e1..2c19996 100644
--- a/core/sql/executor/ex_frag_rt.cpp
+++ b/core/sql/executor/ex_frag_rt.cpp
@@ -1914,37 +1914,6 @@ void ExRtFragTable::addFixupRequestToMessage(ExMasterEspMessage *msg,
// add late name info, if present
if (getGlobals()->resolvedNameList())
{
- if (fragDir_->getPlanVersion() < COM_VERS_R2_3)
- {
- // Translate the resolved name list to the older version
- ResolvedNameListPre1800 *ornl =
- (ResolvedNameListPre1800 *)
- (new(ipcHeap)
- char[sizeof(ResolvedNameListPre1800) +
- ((getGlobals()->resolvedNameList()->numEntries() > 0 ) ?
- ((getGlobals()->resolvedNameList()->
- numEntries() - 1) * sizeof(ResolvedName)):
- 0)
- ]
- );
-
-
- ornl->translateFromNewVersion(getGlobals()->resolvedNameList());
- ExResolvedNameObj *rno =
- new(ipcHeap) ExResolvedNameObj((ResolvedNameList *)ornl,ipcHeap);
- rno->setVersion(Pre1800ResolvedNameObjVersion);
- *msg << *rno;
- rno->decrRefCount();
- }
- else
- {
- ExResolvedNameObj *rno =
- new(ipcHeap) ExResolvedNameObj(getGlobals()->resolvedNameList(),
- ipcHeap);
- *msg << *rno;
- rno->decrRefCount();
- }
-
}
// add resource info if needed
@@ -1957,8 +1926,6 @@ void ExRtFragTable::addFixupRequestToMessage(ExMasterEspMessage *msg,
ri->decrRefCount();
}
-
-
// add timeout-data if needed
if ( * getGlobals()->getTimeoutData() )
{
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/executor/ex_globals.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ex_globals.cpp b/core/sql/executor/ex_globals.cpp
index a4fee90..a931391 100644
--- a/core/sql/executor/ex_globals.cpp
+++ b/core/sql/executor/ex_globals.cpp
@@ -104,6 +104,8 @@ void ex_globals::reAllocate(short create_gui_sched)
tempList_ = NULL;
tcbList_.allocate(0);
+
+ lobGlobals_ = new(heap_) LOBglobals(heap_);
}
void ex_globals::deleteMe(NABoolean fatalError)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/exp/ExpLOBaccess.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBaccess.cpp b/core/sql/exp/ExpLOBaccess.cpp
index 93a89c9..e8e0f08 100644
--- a/core/sql/exp/ExpLOBaccess.cpp
+++ b/core/sql/exp/ExpLOBaccess.cpp
@@ -374,7 +374,9 @@ Ex_Lob_Error ExLob::dataModCheck2(
char * dirPath,
Int64 inputModTS,
Lng32 numOfPartLevels,
- Int64 &failedModTS)
+ Int64 &failedModTS,
+ char *failedLocBuf,
+ Int32 *failedLocBufLen)
{
if (numOfPartLevels == 0)
return LOB_OPER_OK;
@@ -400,6 +402,17 @@ Ex_Lob_Error ExLob::dataModCheck2(
{
failed = TRUE;
failedModTS = currModTS;
+
+ if (failedLocBuf && failedLocBufLen)
+ {
+ Lng32 failedFileLen = strlen(fileInfo.mName);
+ Lng32 copyLen = (failedFileLen > (*failedLocBufLen-1)
+ ? (*failedLocBufLen-1) : failedFileLen);
+
+ str_cpy_and_null(failedLocBuf, fileInfo.mName, copyLen,
+ '\0', ' ', TRUE);
+ *failedLocBufLen = copyLen;
+ }
}
}
}
@@ -416,7 +429,7 @@ Ex_Lob_Error ExLob::dataModCheck2(
{
hdfsFileInfo &fileInfo = fileInfos[i];
err = dataModCheck2(fileInfo.mName, inputModTS, numOfPartLevels,
- failedModTS);
+ failedModTS, failedLocBuf, failedLocBufLen);
if (err != LOB_OPER_OK)
return err;
}
@@ -433,7 +446,9 @@ Ex_Lob_Error ExLob::dataModCheck(
Int64 inputModTS,
Lng32 numOfPartLevels,
ExLobGlobals *lobGlobals,
- Int64 &failedModTS)
+ Int64 &failedModTS,
+ char *failedLocBuf,
+ Int32 *failedLocBufLen)
{
failedModTS = -1;
@@ -445,17 +460,33 @@ Ex_Lob_Error ExLob::dataModCheck(
}
Int64 currModTS = fileInfos[0].mLastMod;
- hdfsFreeFileInfo(fileInfos, 1);
if ((inputModTS > 0) &&
(currModTS > inputModTS))
{
+ hdfsFileInfo &fileInfo = fileInfos[0];
+
failedModTS = currModTS;
+
+ if (failedLocBuf && failedLocBufLen)
+ {
+ Lng32 failedFileLen = strlen(fileInfo.mName);
+ Lng32 copyLen = (failedFileLen > (*failedLocBufLen-1)
+ ? (*failedLocBufLen-1) : failedFileLen);
+
+ str_cpy_and_null(failedLocBuf, fileInfo.mName, copyLen,
+ '\0', ' ', TRUE);
+ *failedLocBufLen = copyLen;
+ }
+
+ hdfsFreeFileInfo(fileInfos, 1);
return LOB_DATA_MOD_CHECK_ERROR;
}
+ hdfsFreeFileInfo(fileInfos, 1);
if (numOfPartLevels > 0)
{
- return dataModCheck2(dirPath, inputModTS, numOfPartLevels, failedModTS);
+ return dataModCheck2(dirPath, inputModTS, numOfPartLevels,
+ failedModTS, failedLocBuf, failedLocBufLen);
}
return LOB_OPER_OK;
@@ -1457,41 +1488,6 @@ Ex_Lob_Error ExLob::closeCursor(char *handleIn, Int32 handleInLen)
return LOB_OPER_OK;
}
-#ifdef __ignore
-Ex_Lob_Error ExLob::doSanityChecks(char *dir, LobsStorage storage,
- Int32 handleInLen, Int32 handleOutLen,
- Int32 blackBoxLen)
-{
-
-#ifdef SQ_USE_HDFS
- if (!fs_)
- return LOB_HDFS_CONNECT_ERROR;
-#else
- if (fdData_ == -1)
- return LOB_DATA_FILE_OPEN_ERROR;
-#endif
-
- if (dir_.compare(dir) != 0)
- return LOB_DIR_NAME_ERROR;
-
- if (storage_ != storage)
- return LOB_STORAGE_TYPE_ERROR;
-
- if (handleInLen > MAX_HANDLE_IN_LEN) {
- return LOB_HANDLE_IN_LEN_ERROR;
- }
-
- if (handleOutLen > MAX_HANDLE_IN_LEN) {
- return LOB_HANDLE_OUT_LEN_ERROR;
- }
-
- if (blackBoxLen > MAX_HANDLE_IN_LEN) {
- return LOB_BLACK_BOX_LEN_ERROR;
- }
-
- return LOB_OPER_OK;
-}
-#endif
Ex_Lob_Error ExLob::allocateDesc(ULng32 size, Int64 &descNum, Int64 &dataOffset, Int64 lobMaxSize, Int64 lobMaxChunkMemLen, char *handleIn, Int32 handleInLen, Int64 lobGCLimit, void *lobGlobals)
{
NABoolean GCDone = FALSE;
@@ -2529,9 +2525,18 @@ Ex_Lob_Error ExLobsOper (
Int64 inputModTS = *(Int64*)blackBox;
Int32 inputNumOfPartLevels =
*(Lng32*)&((char*)blackBox)[sizeof(inputModTS)];
+ Int32 * failedLocBufLen =
+ (Int32*)&((char*)blackBox)[sizeof(inputModTS)+
+ sizeof(inputNumOfPartLevels)];
+ char * failedLocBuf = &((char*)blackBox)[sizeof(inputModTS)+
+ sizeof(inputNumOfPartLevels)+
+ sizeof(*failedLocBufLen)];
Int64 failedModTS = -1;
- err = lobPtr->dataModCheck(lobStorageLocation, inputModTS, inputNumOfPartLevels,
- lobGlobals, failedModTS);
+ err =
+ lobPtr->dataModCheck(lobStorageLocation,
+ inputModTS, inputNumOfPartLevels,
+ lobGlobals, failedModTS,
+ failedLocBuf, failedLocBufLen);
descNumOut = failedModTS;
}
break;
@@ -2996,20 +3001,9 @@ Ex_Lob_Error ExLob::deleteCursor(char *cursorName, ExLobGlobals *lobGlobals)
//*** Note - sample code to send and receive
Ex_Lob_Error ExLob::sendReqToLobServer()
{
-
- Ex_Lob_Error err;
-#ifdef __ignore
- request_.setType(Lob_Req_Get_Desc);
-
- err = request_.send();
-
- if (err != LOB_OPER_OK) {
- return err;
- }
-
- err = request_.getError();
-#endif
- return err;
+ Ex_Lob_Error err;
+
+ return err;
}
///////////////////////////////////////////////////////////////////////////////
@@ -3170,19 +3164,6 @@ void ExLobLock::wait()
waiters_--;
}
-#ifdef __ignore
-ExLobHdfsRequest::ExLobHdfsRequest(LobsHdfsRequestType reqType, hdfsFS fs,
- hdfsFile file, char *buffer, int size) :
- reqType_(reqType),
- fs_(fs),
- file_(file),
- buffer_(buffer),
- size_(size)
-{
- lobPtr_ = 0;
- error_ = LOB_OPER_OK;
-}
-#endif
ExLobHdfsRequest::ExLobHdfsRequest(LobsHdfsRequestType reqType, ExLobCursor *cursor) :
reqType_(reqType),
cursor_(cursor)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/exp/ExpLOBaccess.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBaccess.h b/core/sql/exp/ExpLOBaccess.h
index 102735d..7b0132e 100644
--- a/core/sql/exp/ExpLOBaccess.h
+++ b/core/sql/exp/ExpLOBaccess.h
@@ -488,13 +488,17 @@ class ExLob
Int64 modTS,
Lng32 numOfPartLevels,
ExLobGlobals *lobGlobals,
- Int64 &failedModTS);
+ Int64 &failedModTS,
+ char *failedLocBuf,
+ Int32 *failedLocBufLen);
Ex_Lob_Error dataModCheck2(
char * dirPath,
Int64 modTS,
Lng32 numOfPartLevels,
- Int64 &failedModTS);
+ Int64 &failedModTS,
+ char *failedLocBuf,
+ Int32 *failedLocBufLen);
Ex_Lob_Error emptyDirectory(char* dirPath, ExLobGlobals* lobGlobals);
@@ -524,9 +528,6 @@ class ExLob
ExLobStats stats_;
bool prefetchQueued_;
NAHeap *lobGlobalHeap_;
-#ifdef __ignore
- ExLobRequest request_;
-#endif
NABoolean lobTrace_;
};
@@ -540,9 +541,6 @@ typedef map<string, ExLob *>::iterator lobMap_it;
class ExLobHdfsRequest
{
public:
-#ifdef __ignore
- ExLobHdfsRequest(LobsHdfsRequestType reqType, hdfsFS fs, hdfsFile file, char *buffer, int size);
-#endif
ExLobHdfsRequest(LobsHdfsRequestType reqType, ExLobCursor *cursor);
ExLobHdfsRequest(LobsHdfsRequestType reqType, ExLob *lobPtr, ExLobCursor *cursor);
ExLobHdfsRequest(LobsHdfsRequestType reqType);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/exp/ExpLOBinterface.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBinterface.cpp b/core/sql/exp/ExpLOBinterface.cpp
index 25a7b4b..4c29194 100644
--- a/core/sql/exp/ExpLOBinterface.cpp
+++ b/core/sql/exp/ExpLOBinterface.cpp
@@ -257,7 +257,9 @@ Lng32 ExpLOBinterfaceDataModCheck(void * exLobGlob,
Lng32 lobHdfsPort,
Int64 modTS,
Lng32 numOfPartLevels,
- Int64 &failedModTS)
+ Int64 &failedModTS,
+ char * failedLocBuf, // OUT: path/name
+ Int32 &failedLocBufLen) // INOUT: buflen
{
Ex_Lob_Error err;
@@ -266,10 +268,13 @@ Lng32 ExpLOBinterfaceDataModCheck(void * exLobGlob,
Ex_Lob_Error status;
Int64 cliError = -1;
- char dirInfoBuf[100];
- *(Int64*)dirInfoBuf = modTS;
- *(Lng32*)&dirInfoBuf[sizeof(modTS)] = numOfPartLevels;
- Lng32 dirInfoBufLen = sizeof(modTS) + sizeof(numOfPartLevels);
+ Lng32 blackBoxLen =
+ sizeof(modTS) + sizeof(numOfPartLevels)
+ + sizeof(failedLocBufLen) + failedLocBufLen;
+ char blackBox[blackBoxLen];
+ *(Int64*)blackBox = modTS;
+ *(Lng32*)&blackBox[sizeof(modTS)] = numOfPartLevels;
+ *(Lng32*)&blackBox[sizeof(modTS)+sizeof(numOfPartLevels)] = failedLocBufLen;
failedModTS = -1;
err = ExLobsOper((char*)"",
NULL, 0,
@@ -287,10 +292,22 @@ Lng32 ExpLOBinterfaceDataModCheck(void * exLobGlob,
1, // waited op
exLobGlob,
0,
- dirInfoBuf, dirInfoBufLen
+ blackBox, blackBoxLen
);
if (err == LOB_DATA_MOD_CHECK_ERROR)
- return 1;
+ {
+ failedLocBufLen =
+ *(Lng32*)&blackBox[sizeof(modTS)+sizeof(numOfPartLevels)];
+
+ if (failedLocBufLen > 0)
+ {
+ str_cpy_and_null(failedLocBuf,
+ &blackBox[sizeof(modTS)+sizeof(numOfPartLevels)+sizeof(failedLocBufLen)],
+ failedLocBufLen, '\0', ' ', TRUE);
+ }
+
+ return 1;
+ }
else if (err != LOB_OPER_OK)
return -err;
else
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/exp/ExpLOBinterface.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBinterface.h b/core/sql/exp/ExpLOBinterface.h
index 4a4ede2..50efa36 100644
--- a/core/sql/exp/ExpLOBinterface.h
+++ b/core/sql/exp/ExpLOBinterface.h
@@ -295,7 +295,10 @@ Lng32 ExpLOBinterfacePurgeBackupLobDataFile(void *& lobGlob, char *hdfsServer,
// dirPath: path to needed directory (includes directory name)
// modTS is the latest timestamp on any file/dir under dirPath.
// This method validates that current modTS is not greater then input modTS.
-// On return, failedModTS contains current timestamp that caused mismatch.
+// On return:
+// failedModTS contains current timestamp that caused mismatch.
+// failedLocBuf: buffer where path/name of failed dir/file will be returned.
+// failedLocBufLen: IN: max len of buf. OUT: actual length of data.
// Return: 1, if check fails. 0, if passes. -1, if error.
Lng32 ExpLOBinterfaceDataModCheck(void * lobGlob,
char * dirPath,
@@ -303,7 +306,9 @@ Lng32 ExpLOBinterfaceDataModCheck(void * lobGlob,
Lng32 lobHdfsPort,
Int64 modTS,
Lng32 numOfPartLevels,
- Int64 &failedModTS);
+ Int64 &failedModTS,
+ char * failedLocBuf,
+ Int32 &failedLocBufLen);
Lng32 ExpLOBinterfaceEmptyDirectory(void * lobGlob,
char * lobName,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/generator/GenExplain.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenExplain.cpp b/core/sql/generator/GenExplain.cpp
index 0a6fb9a..07cf1fd 100644
--- a/core/sql/generator/GenExplain.cpp
+++ b/core/sql/generator/GenExplain.cpp
@@ -472,7 +472,7 @@ RelExpr::addExplainInfo(ComTdb * tdb,
//calls virtual subclass-specific function
addSpecificExplainInfo(explainTuple, tdb, generator);
- //finishes up the processing, used to be inside of ifndef __ignore
+ //finishes up the processing
addExplainPredicates(explainTuple, generator);
explainTuple->genExplainTupleData(space);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/generator/GenFastTransport.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenFastTransport.cpp b/core/sql/generator/GenFastTransport.cpp
index 6600934..53075f6 100644
--- a/core/sql/generator/GenFastTransport.cpp
+++ b/core/sql/generator/GenFastTransport.cpp
@@ -634,6 +634,7 @@ PhysicalFastExtract::codeGen(Generator *generator)
Int64 modTS = -1;
if ((CmpCommon::getDefault(HIVE_DATA_MOD_CHECK) == DF_ON) &&
+ (CmpCommon::getDefault(TRAF_SIMILARITY_CHECK) != DF_OFF) &&
(isHiveInsert()) &&
(getHiveTableDesc() && getHiveTableDesc()->getNATable() &&
getHiveTableDesc()->getNATable()->getClusteringIndex()))
@@ -641,8 +642,28 @@ PhysicalFastExtract::codeGen(Generator *generator)
const HHDFSTableStats* hTabStats =
getHiveTableDesc()->getNATable()->getClusteringIndex()->getHHDFSTableStats();
- modTS = hTabStats->getModificationTS();
- }
+ if ((CmpCommon::getDefault(TRAF_SIMILARITY_CHECK) == DF_ROOT) ||
+ (CmpCommon::getDefault(TRAF_SIMILARITY_CHECK) == DF_ON))
+ {
+ TrafSimilarityTableInfo * ti =
+ new(generator->wHeap()) TrafSimilarityTableInfo(
+ (char*)getHiveTableName().data(),
+ TRUE, // isHive
+ (char*)getTargetName().data(), // root dir
+ hTabStats->getModificationTS(),
+ 0,
+ NULL,
+ (char*)getHdfsHostName().data(),
+ hdfsPortNum);
+
+ generator->addTrafSimTableInfo(ti);
+ }
+ else
+ {
+ // sim check at leaf
+ modTS = hTabStats->getModificationTS();
+ }
+ } // do sim check
targetName = AllocStringInSpace(*space, (char *)getTargetName().data());
hdfsHostName = AllocStringInSpace(*space, (char *)getHdfsHostName().data());
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/generator/GenRelExeUtil.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelExeUtil.cpp b/core/sql/generator/GenRelExeUtil.cpp
index bf54220..dcf5f16 100644
--- a/core/sql/generator/GenRelExeUtil.cpp
+++ b/core/sql/generator/GenRelExeUtil.cpp
@@ -3333,11 +3333,16 @@ short ExeUtilHiveTruncate::codeGen(Generator * generator)
hiveHdfsHost =
space->AllocateAndCopyToAlignedSpace (getHiveHostName(), 0);
+ NABoolean doSimCheck = FALSE;
+ if ((CmpCommon::getDefault(HIVE_DATA_MOD_CHECK) == DF_ON) &&
+ (CmpCommon::getDefault(TRAF_SIMILARITY_CHECK) == DF_LEAF))
+ doSimCheck = TRUE;
+
ComTdbExeUtilHiveTruncate * exe_util_tdb = new(space)
ComTdbExeUtilHiveTruncate(tablename, strlen(tablename),
hiveTableLocation, partn_loc,
hiveHdfsHost, hiveHdfsPort,
- hiveModTS_,
+ (doSimCheck ? hiveModTS_ : -1),
(ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
(ex_cri_desc *)(generator->getCriDesc(Generator::DOWN)),
(queue_index)getDefault(GEN_DDL_SIZE_DOWN),
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/generator/GenRelMisc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelMisc.cpp b/core/sql/generator/GenRelMisc.cpp
index d37a8e6..6b4b074 100644
--- a/core/sql/generator/GenRelMisc.cpp
+++ b/core/sql/generator/GenRelMisc.cpp
@@ -678,94 +678,56 @@ short FirstN::codeGen(Generator * generator)
// RelRoot::genSimilarityInfo()
//
/////////////////////////////////////////////////////////
-QuerySimilarityInfo * RelRoot::genSimilarityInfo(Generator *generator)
+TrafQuerySimilarityInfo * RelRoot::genSimilarityInfo(Generator *generator)
{
ExpGenerator * exp_gen = generator->getExpGenerator();
- NABoolean disableSimCheck = FALSE;
- NABoolean internalSimCheck = FALSE;
NABoolean recompOnTSMismatch = FALSE;
NABoolean errorOnTSMismatch = FALSE;
- NABoolean disableAutoRecomp = FALSE;
// generate the similarity info.
Space * space = generator->getSpace();
- QuerySimilarityInfo * qsi = new(space) QuerySimilarityInfo(space);
- // check if sim check has been turned off by a CQD.
- // Even if it is off, sim check on individual tables may be turned
- // on by a 'control table'.
- NABoolean simCheckDisabledViaDefault =
- (CmpCommon::getDefault(SIMILARITY_CHECK) == DF_OFF);
+ NABoolean disableAutoRecomp = (CmpCommon::getDefault(AUTOMATIC_RECOMPILATION) == DF_OFF);
- disableAutoRecomp =
- (CmpCommon::getDefault(AUTOMATIC_RECOMPILATION) == DF_OFF);
+ Queue * siList = new(space) Queue(space);
+ TrafQuerySimilarityInfo * qsi = NULL;
- if (generator->aqrEnabled())
- {
- qsi->setSimilarityCheckOption(QuerySimilarityInfo::ERROR_ON_TS_MISMATCH);
- return qsi;
- }
-
- // similarity check not done if this compile is for an internal module.
- // We trust our fellow developers.
- NABoolean validateTS = TRUE;
-
- if ( ( generator->currentCmpContext()->internalCompile() == CmpContext::INTERNAL_MODULENAME ) ||
- ( CmpCommon::statement()->isSMDRecompile() ) ||
- ( NOT validateTS )
- )
- {
- qsi->setSimilarityCheckOption(QuerySimilarityInfo::INTERNAL_SIM_CHECK);
- return qsi;
- }
+ if (generator->getTrafSimTableInfoList().entries() > 0)
+ qsi = new(space) TrafQuerySimilarityInfo(siList);
- // Right now we can handle similarity checks for only
- // one base table IUD per query. If more than one, disable
- // similarity check. You can have more than one IUD of base table
- // for a query like..."insert into t select * from (delete from t)...".
- NABoolean iudSeen = FALSE;
- GenOperSimilarityInfo * iudSimInfo = NULL;
- short iudSimInfoPosition = 0;
CollIndex i = 0;
- // disable similarity check if a view was referenced in the query.
- if (getViewStoiList().entries() > 0)
- {
- recompOnTSMismatch = TRUE;
- }
-
- // if this plan is using ESP parallelism or contains pushed down plan fragments,
- // disable sim check.
- FragmentDir *compFragDir = generator->getFragmentDir();
- if ((NOT recompOnTSMismatch) &&
- (compFragDir->entries() > 0))
+ for (CollIndex i = 0; i < generator->getTrafSimTableInfoList().entries(); i++)
{
- for (CollIndex i = 0; i < compFragDir->entries(); i++)
- {
- if (compFragDir->getType(i) == FragmentDir::ESP )
- recompOnTSMismatch = TRUE;
-
- // Recompilatio the query (currently) with a pushed-down plan
- // if the timestamps on the objects associated with the query
- // change. For example, a moved partition will have a different
- // time-stamp and because we do not store the node map with
- // the plan, we should recompile the query.
- if ( compFragDir->getType(i) == FragmentDir::DP2 AND
- compFragDir->getContainsPushedDownOperators(i) == TRUE )
- recompOnTSMismatch = TRUE;
- }
+ TrafSimilarityTableInfo * genTsi =
+ (TrafSimilarityTableInfo *)(generator->getTrafSimTableInfoList()[i]);
+
+ char * genTablename =
+ space->allocateAndCopyToAlignedSpace(genTsi->tableName(), str_len(genTsi->tableName()), 0);
+ char * genRootDir =
+ space->allocateAndCopyToAlignedSpace(genTsi->hdfsRootDir(), str_len(genTsi->hdfsRootDir()), 0);
+
+ char * genHdfsHostName =
+ space->allocateAndCopyToAlignedSpace(genTsi->hdfsHostName(), str_len(genTsi->hdfsHostName()), 0);
+
+ TrafSimilarityTableInfo * si =
+ new(space) TrafSimilarityTableInfo(genTablename,
+ genTsi->isHive(),
+ genRootDir,
+ genTsi->modTS(),
+ genTsi->numPartnLevels(),
+ NULL,
+ genHdfsHostName,
+ genTsi->hdfsPort());
+ qsi->siList()->insert(si);
}
- if ((recompOnTSMismatch) && (!disableAutoRecomp))
+ if (qsi)
{
- qsi->setSimilarityCheckOption(QuerySimilarityInfo::RECOMP_ON_TS_MISMATCH);
- return qsi;
+ qsi->setDisableAutoRecomp(disableAutoRecomp);
}
- if (generator->genOperSimInfoList().entries() > 0)
- internalSimCheck = TRUE;
-
return qsi;
}
@@ -1951,12 +1913,10 @@ short RelRoot::codeGen(Generator * generator)
lnil->setViewPresent(viewPresent);
#pragma warn(1506) // warning elimination
-#pragma nowarn(1506) // warning elimination
lnil->setVariablePresent(variablePresent);
-#pragma warn(1506) // warning elimination
// Generate info to do similarity check.
- QuerySimilarityInfo * qsi = genSimilarityInfo(generator);
+ TrafQuerySimilarityInfo * qsi = genSimilarityInfo(generator);
// generate the executor fragment directory <exFragDir> (list of all
// fragments of the plan that are executed locally or are downloaded
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/generator/GenRelScan.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelScan.cpp b/core/sql/generator/GenRelScan.cpp
index 87f2cd7..d20ea91 100644
--- a/core/sql/generator/GenRelScan.cpp
+++ b/core/sql/generator/GenRelScan.cpp
@@ -1214,13 +1214,15 @@ if (hTabStats->isOrcFile())
Int64 modTS = -1;
Lng32 numOfPartLevels = -1;
Queue * hdfsDirsToCheck = NULL;
- if (CmpCommon::getDefault(HIVE_DATA_MOD_CHECK) == DF_ON)
+
+ // Right now, timestamp info is not being generated correctly for
+ // partitioned files. Skip data mod check for them.
+ // Remove this check when partitioned info is set up correctly.
+
+ if ((CmpCommon::getDefault(HIVE_DATA_MOD_CHECK) == DF_ON) &&
+ (CmpCommon::getDefault(TRAF_SIMILARITY_CHECK) != DF_OFF) &&
+ (hTabStats->numOfPartCols() <= 0))
{
- hdfsRootDir =
- space->allocateAndCopyToAlignedSpace(hTabStats->tableDir().data(),
- hTabStats->tableDir().length(),
- 0);
- modTS = hTabStats->getModificationTS();
numOfPartLevels = hTabStats->numOfPartCols();
// if specific directories are to checked based on the query struct
@@ -1229,10 +1231,33 @@ if (hTabStats->isOrcFile())
// At runtime, only these dirs will be checked for data modification.
// ** TBD **
- // Right now, timestamp info is not being generated correctly for
- // partitioned files. Skip data mod check for them.
- if (numOfPartLevels > 0)
- hdfsRootDir = NULL;
+ if ((CmpCommon::getDefault(TRAF_SIMILARITY_CHECK) == DF_ROOT) ||
+ (CmpCommon::getDefault(TRAF_SIMILARITY_CHECK) == DF_ON))
+ {
+ char * tiName = new(generator->wHeap()) char[strlen(tablename)+1];
+ strcpy(tiName, tablename);
+ TrafSimilarityTableInfo * ti =
+ new(generator->wHeap()) TrafSimilarityTableInfo(
+ tiName,
+ TRUE, // isHive
+ (char*)hTabStats->tableDir().data(), // root dir
+ hTabStats->getModificationTS(),
+ numOfPartLevels,
+ hdfsDirsToCheck,
+ hdfsHostName, hdfsPort);
+
+ generator->addTrafSimTableInfo(ti);
+ }
+ else
+ {
+ // sim check done at leaf operators.
+ hdfsRootDir =
+ space->allocateAndCopyToAlignedSpace(hTabStats->tableDir().data(),
+ hTabStats->tableDir().length(),
+ 0);
+ modTS = hTabStats->getModificationTS();
+ numOfPartLevels = hTabStats->numOfPartCols();
+ }
}
// create hdfsscan_tdb
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/generator/Generator.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/Generator.cpp b/core/sql/generator/Generator.cpp
index 77ac6d0..3381040 100644
--- a/core/sql/generator/Generator.cpp
+++ b/core/sql/generator/Generator.cpp
@@ -2891,6 +2891,22 @@ Attributes * Generator::getAttr(ItemExpr * ie)
return getMapInfo(ie->getValueId())->getAttr();
}
+void Generator::addTrafSimTableInfo(TrafSimilarityTableInfo *newST)
+{
+ for (CollIndex i = 0; i < getTrafSimTableInfoList().entries(); i++)
+ {
+ TrafSimilarityTableInfo *ti =
+ (TrafSimilarityTableInfo*)getTrafSimTableInfoList()[i];
+ if (*ti == *newST)
+ {
+ // value exists, do not add.
+ return;
+ }
+ }
+
+ getTrafSimTableInfoList().insert(newST);
+}
+
// Helper method used by caching operators to ensure a statement
// execution count is included in their characteristic input.
// The "getOrAdd" semantic is to create the ValueId if it doesn't
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/generator/Generator.h
----------------------------------------------------------------------
diff --git a/core/sql/generator/Generator.h b/core/sql/generator/Generator.h
index 22c465b..a0d7161 100644
--- a/core/sql/generator/Generator.h
+++ b/core/sql/generator/Generator.h
@@ -71,6 +71,7 @@ class GenOperSimilarityInfo;
class ComTdb;
class Attributes;
class DP2Insert;
+class TrafSimilarityTableInfo;
// this define is used to raise assertion in generator.
// Calls GeneratorAbort which does a longjmp out of the calling scope.
@@ -364,6 +365,8 @@ class Generator : public NABasicObject
LIST(const SqlTableOpenInfo*) stoiList_;
+ LIST(const TrafSimilarityTableInfo*) trafSimTableInfoList_;
+
// Some nodes in the tree may require the root node to compute
// special internal input values, such as an execution count
// or the current transaction id. The CURRENT_TIMESTAMP function
@@ -670,12 +673,19 @@ public:
lateNameInfoList_.clear();
}
+ void addTrafSimTableInfo(TrafSimilarityTableInfo *ti);
+
// Accessor and mutators for data members related to similarity check.
LIST(const GenOperSimilarityInfo*) &genOperSimInfoList()
{
return genOperSimInfoList_;
}
+ // Accessor and mutators for data members related to traf similarity check.
+ LIST(const TrafSimilarityTableInfo*) &getTrafSimTableInfoList()
+ {
+ return trafSimTableInfoList_;
+ }
LIST(const SqlTableOpenInfo*) & getSqlTableOpenInfoList()
{
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/optimizer/RelExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelExeUtil.h b/core/sql/optimizer/RelExeUtil.h
index 2040a34..e64ca7a 100644
--- a/core/sql/optimizer/RelExeUtil.h
+++ b/core/sql/optimizer/RelExeUtil.h
@@ -1124,7 +1124,7 @@ public:
// method to do code generation
virtual short codeGen(Generator*);
- virtual NABoolean aqrSupported() { return FALSE; }
+ virtual NABoolean aqrSupported() { return TRUE; }
const NAString &getHiveTableLocation() const
{
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/optimizer/RelMisc.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelMisc.h b/core/sql/optimizer/RelMisc.h
index e4632bf..cb81203 100644
--- a/core/sql/optimizer/RelMisc.h
+++ b/core/sql/optimizer/RelMisc.h
@@ -512,7 +512,8 @@ public:
NABoolean checkFirstNRowsNotAllowed(BindWA* bindWA) ;
- QuerySimilarityInfo * genSimilarityInfo(Generator *generator); // GenRelMisc
+ // defined in generator/GenRelMisc.cpp
+ TrafQuerySimilarityInfo * genSimilarityInfo(Generator *generator);
void addOneRowAggregates(BindWA * bindWA);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/parser/SqlParserAux.cpp
----------------------------------------------------------------------
diff --git a/core/sql/parser/SqlParserAux.cpp b/core/sql/parser/SqlParserAux.cpp
index dfd625c..76534c7 100644
--- a/core/sql/parser/SqlParserAux.cpp
+++ b/core/sql/parser/SqlParserAux.cpp
@@ -716,27 +716,6 @@ HostVar *makeHostVar(NAString *hvName, NAString *indName, NABoolean isDynamic)
// }
}
-
-char * getPrototypeFromLateNameInfoList(
- RecompLateNameInfoList * lniList, NAString hvarName, NAString origPtypeVal
- )
-{
- const char * prototypeVal = origPtypeVal.data();
-
- for (Int32 i = 0; i < (Int32)lniList->numEntries(); i++)
- {
- if ((strcmp(lniList->getRecompLateNameInfo(i).varName(),
- hvarName.data()) == 0))
- {
- return lniList->getRecompLateNameInfo(i).actualAnsiName();
-
- }
- }
-
- return NULL;
-}
-
-
static
NABoolean literalToNumber(NAString *strptr, char sign, NAString *cvtstr,
short &shortVal, Lng32 &longVal, Int64& i64Val,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/parser/SqlParserAux.h
----------------------------------------------------------------------
diff --git a/core/sql/parser/SqlParserAux.h b/core/sql/parser/SqlParserAux.h
index f669785..449daae 100644
--- a/core/sql/parser/SqlParserAux.h
+++ b/core/sql/parser/SqlParserAux.h
@@ -243,10 +243,6 @@ NABoolean finalizeAccessOptions(RelExpr *top,
HostVar *makeHostVar(NAString *hvName, NAString *indName,
NABoolean isDynamic = FALSE);
-char * getPrototypeFromLateNameInfoList
-(RecompLateNameInfoList * lniList, NAString hvarName, NAString origPtypeVal);
-
-
// In the next several procedures, we set up ConstValue's, in whose text
// we want negative numbers to end up with minus signs but positive numbers
// without plus signs. That is,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/parser/sqlparser.y
----------------------------------------------------------------------
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index ae288b0..af5f7a0 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -12534,40 +12534,9 @@ hostvar_and_prototype : HOSTVAR TOK_PROTOTYPE mvs_umd_option character_string_li
$$ = hv;
delete $1; // okay to delete, we made a copy in makeHostVar
-
- if ((RecompLateNameInfoList *)CmpCommon::context()->recompLateNameInfoList() && !((CmpCommon::statement()->isSMDRecompile() ) ))
-
- // don't get the prototype name from the rlnil for system module statements
- //during recompilation, instead get the original prototype name
- {
- char * newPtype = NULL;
- newPtype =
- getPrototypeFromLateNameInfoList
- ((RecompLateNameInfoList *)CmpCommon::context()->recompLateNameInfoList(),
- hv->getName(),
- *$4);
-// *$3);
-
- if (newPtype == NULL)
- {
- *SqlParser_Diags << DgSqlCode(4087)
- << DgString0(hv->getName());
- YYABORT;
-
- //yyerror(""); // emits syntax error 15001
- //YYERROR;
- }
-
- hv->setPrototypeValue(NAString(newPtype));
- }
- else
- {
-// hv->setPrototypeValue(*$3);
- hv->setPrototypeValue(*$4);
- }
-
+ hv->setPrototypeValue(*$4);
delete $4; // okay to delete, we just made a copy
-// delete $3; // okay to delete, we just made a copy
+
// Remove leading/trailing blanks from string literal --
// the token(s) within the literal is the real proto value
TrimNAStringSpace(hv->getPrototypeValue());
@@ -12577,9 +12546,8 @@ hostvar_and_prototype : HOSTVAR TOK_PROTOTYPE mvs_umd_option character_string_li
YYERROR;
}
- if (TRUE == $3) //MVS
- hv->setSpecialType(ExtendedQualName::MVS_UMD);
-
+ if (TRUE == $3) //MVS
+ hv->setSpecialType(ExtendedQualName::MVS_UMD);
AllHostVars->insert($$);
TheHostVarRoles->addARole(HV_IS_INPUT);
@@ -12606,31 +12574,7 @@ param_and_prototype : PARAMETER TOK_PROTOTYPE character_string_literal
$$ = hv;
delete $1; // okay to delete, we made a copy in makeHostVar
- if ((RecompLateNameInfoList *)CmpCommon::context()->recompLateNameInfoList())
- {
- char * newPtype = NULL;
- newPtype =
- getPrototypeFromLateNameInfoList
- ((RecompLateNameInfoList *)CmpCommon::context()->recompLateNameInfoList(),
- hv->getName(),
- *$3);
-
- if (newPtype == NULL)
- {
- *SqlParser_Diags << DgSqlCode(4087)
- << DgString0(hv->getName());
- // YYABORT;
- yyerror(""); // emits syntax error 15001
- YYERROR;
- }
-
- hv->setPrototypeValue(NAString(newPtype));
- }
- else
- {
- hv->setPrototypeValue(*$3);
- }
-
+ hv->setPrototypeValue(*$3);
delete $3; // okay to delete, we just made a copy
// Remove leading/trailing blanks from string literal --
@@ -23070,28 +23014,8 @@ set_table_name: table_name // includes the case of hostvar WITH a prototype
HostVar *hv = makeHostVar($1,NULL);
delete $1; // okay to delete, a copy made in makeHostVar
- RecompLateNameInfoList *rlnil = (RecompLateNameInfoList *)
- CmpCommon::context()->recompLateNameInfoList();
-
- if ( rlnil ) {
- char * newPtype = NULL;
- newPtype =
- getPrototypeFromLateNameInfoList( rlnil ,
- hv->getName(),
- "DUMMY");
-
- if (newPtype == NULL) {
- *SqlParser_Diags << DgSqlCode(4087)
- << DgString0(hv->getName());
- YYABORT;
- }
-
- hv->setPrototypeValue(NAString(newPtype));
- }
- else {
- // fake a dummy prototype
- hv->setPrototypeValue("DUMMY");
- }
+ // fake a dummy prototype
+ hv->setPrototypeValue("DUMMY");
// Remove leading/trailing blanks from string literal --
// the token(s) within the literal is the real proto value
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/regress/tools/regress-filter-linux
----------------------------------------------------------------------
diff --git a/core/sql/regress/tools/regress-filter-linux b/core/sql/regress/tools/regress-filter-linux
index 2238f86..64e91c2 100755
--- a/core/sql/regress/tools/regress-filter-linux
+++ b/core/sql/regress/tools/regress-filter-linux
@@ -435,7 +435,7 @@ s/^ ObjectUIDs \.\.\.\.\.\.\.\.\.\.\.\.\. [0-9,]*$/ ObjectUIDs filtered/g
s/qid MXID11.*$/qid filtered/g
s/ID MXID11.*$/qid filtered/g
-s/DataModMismatchDetails:[ 0-9a-zA-Z:,=]*/DataModMismatchDetails: removed/g
+s/DataModMismatchDetails:[ 0-9a-zA-Z:,=_\/]*/DataModMismatchDetails: removed/g
" $sedInput
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultConstants.h b/core/sql/sqlcomp/DefaultConstants.h
index a6270c9..be53281 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -1414,7 +1414,6 @@ enum DefaultConstants
//How many blocks do we read ahead for a sequential scan of a file.
READ_AHEAD_MAX_BLOCKS,
- SIMILARITY_CHECK,
SYNCDEPTH,
TABLELOCK,
TIMEOUT,
@@ -3858,6 +3857,9 @@ enum DefaultConstants
// create it.
TRAF_AUTO_CREATE_SCHEMA,
+ // controls if sim check is to be done and where (root or leaf)
+ TRAF_SIMILARITY_CHECK,
+
// This enum constant must be the LAST one in the list; it's a count,
// not an Attribute (it's not IN DefaultDefaults; it's the SIZE of it)!
__NUM_DEFAULT_ATTRIBUTES
@@ -3940,6 +3942,7 @@ enum DefaultToken {
DF_KEYINDEXES,
DF_LASTROW,
DF_LATEST,
+ DF_LEAF,
DF_LOADNODUP,
DF_LOCAL,
DF_LOCAL_NODE,
@@ -3975,6 +3978,7 @@ enum DefaultToken {
DF_REPSEL,
DF_RESOURCES,
DF_RETURN,
+ DF_ROOT,
DF_SAMPLE,
DF_SERIALIZABLE,
DF_SHORTANSI,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index d001ce6..7b65e0d 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -3163,7 +3163,6 @@ SDDflt0_(QUERY_CACHE_SELECTIVITY_TOLERANCE, "0"),
DDkwd__(SHOWWARN_OPT, "ON"),
DDkwd__(SHOW_MEMO_STATS, "OFF"),
- DDkwd__(SIMILARITY_CHECK, "ON "),
DDkwd__(SIMPLE_COST_MODEL, "ON"),
XDDkwd__(SKEW_EXPLAIN, "ON"),
@@ -3371,6 +3370,8 @@ XDDkwd__(SUBQUERY_UNNESTING, "ON"),
DD_____(TRAF_SAMPLE_TABLE_LOCATION, "/sample/"),
DDint__(TRAF_SEQUENCE_CACHE_SIZE, "-1"),
+ DDkwd__(TRAF_SIMILARITY_CHECK, "ROOT"),
+
DDkwd__(TRAF_STORE_OBJECT_DESC, "OFF"),
DDkwd__(TRAF_STRING_AUTO_TRUNCATE, "OFF"),
@@ -4040,9 +4041,6 @@ void NADefaults::initCurrentDefaultsWithDefaultDefaults()
if(resetNeoDefaults)
{
- // turn similarity check OFF stats during regressions run.
- currentDefaults_[SIMILARITY_CHECK] = "OFF";
-
// turn on ALL stats during regressions run.
currentDefaults_[COMP_BOOL_157] = "ON";
@@ -5739,7 +5737,6 @@ enum DefaultConstants NADefaults::validateAndInsert(const char *attrName,
{
if (value == "ON")
{
- insert(SIMILARITY_CHECK, "OFF", errOrWarn);
insert(COMP_BOOL_157, "ON", errOrWarn);
insert(SHOWDDL_DISPLAY_FORMAT, "INTERNAL", errOrWarn);
insert(MODE_SPECIAL_1, "OFF", errOrWarn);
@@ -5756,7 +5753,6 @@ enum DefaultConstants NADefaults::validateAndInsert(const char *attrName,
}
else
{
- insert(SIMILARITY_CHECK, "ON", errOrWarn);
insert(COMP_BOOL_157, "OFF", errOrWarn);
insert(SHOWDDL_DISPLAY_FORMAT, "EXTERNAL", errOrWarn);
@@ -6306,6 +6302,7 @@ const char *NADefaults::keywords_[DF_lastToken] = {
"KEYINDEXES",
"LASTROW",
"LATEST",
+ "LEAF",
"LOADNODUP",
"LOCAL",
"LOCAL_NODE",
@@ -6341,6 +6338,7 @@ const char *NADefaults::keywords_[DF_lastToken] = {
"REPSEL",
"RESOURCES",
"RETURN",
+ "ROOT",
"SAMPLE",
"SERIALIZABLE",
"SHORTANSI",
@@ -6954,6 +6952,12 @@ DefaultToken NADefaults::token(Int32 attrEnum,
case USE_HIVE_SOURCE:
isValid = TRUE;
break;
+
+ case TRAF_SIMILARITY_CHECK:
+ if (tok == DF_ROOT || tok == DF_LEAF || tok == DF_ON || tok == DF_OFF)
+ isValid = TRUE;
+ break;
+
case TRAF_TABLE_SNAPSHOT_SCAN:
if (tok == DF_NONE || tok == DF_SUFFIX || tok == DF_LATEST)
isValid = TRUE;
[6/8] incubator-trafodion git commit: Merge remote branch
'origin/master' into ansharma_simcheck_br
Posted by an...@apache.org.
Merge remote branch 'origin/master' into ansharma_simcheck_br
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/a164c4b7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/a164c4b7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/a164c4b7
Branch: refs/heads/master
Commit: a164c4b727a8f8314130e75cc30c5022aab776e4
Parents: 3d41ee0 5cd718a
Author: Anoop Sharma <an...@esgyn.com>
Authored: Thu Oct 6 20:39:19 2016 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Thu Oct 6 20:39:19 2016 +0000
----------------------------------------------------------------------
core/conn/jdbc_type2/native/SQLMXDriver.cpp | 13 ----------
core/sqf/commonLogger/CommonLogger.cpp | 5 +++-
core/sqf/commonLogger/CommonLogger.h | 2 ++
core/sql/cli/CliExtern.cpp | 15 +++++++++++-
core/sql/cli/ExSqlComp.cpp | 2 +-
core/sql/common/Ipc.cpp | 22 ++++++++++++-----
core/sql/common/Ipc.h | 2 +-
core/sql/executor/ex_frag_rt.cpp | 30 +++---------------------
core/sql/exp/exp_conv.cpp | 2 +-
core/sql/qmscommon/QRLogger.cpp | 8 ++++++-
core/sql/sqlmxevents/logmxevent_traf.cpp | 8 +++----
11 files changed, 53 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a164c4b7/core/sql/cli/CliExtern.cpp
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a164c4b7/core/sql/cli/ExSqlComp.cpp
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a164c4b7/core/sql/executor/ex_frag_rt.cpp
----------------------------------------------------------------------
[2/8] incubator-trafodion git commit: similarity check changes,
commit #1
Posted by an...@apache.org.
similarity check changes, commit #1
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/074428ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/074428ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/074428ed
Branch: refs/heads/master
Commit: 074428ed74a9b90a3c131007e7ecdeac6720ea99
Parents: 70f7fc0
Author: Anoop Sharma <an...@esgyn.com>
Authored: Mon Oct 3 18:55:39 2016 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Mon Oct 3 18:55:39 2016 +0000
----------------------------------------------------------------------
core/sql/arkcmp/CmpContext.cpp | 1 -
core/sql/arkcmp/CmpContext.h | 8 -
core/sql/arkcmp/CmpStatement.cpp | 5 +-
core/sql/cli/Cli.cpp | 99 --
core/sql/cli/Cli.h | 16 -
core/sql/cli/CliExtern.cpp | 51 -
core/sql/cli/ExSqlComp.cpp | 8 +-
core/sql/cli/Statement.cpp | 1310 ++--------------------
core/sql/cli/Statement.h | 44 +-
core/sql/comexe/CmpMessage.cpp | 28 +-
core/sql/comexe/CmpMessage.h | 7 +-
core/sql/comexe/ComTdbRoot.cpp | 9 +-
core/sql/comexe/ComTdbRoot.h | 9 +-
core/sql/comexe/LateBindInfo.cpp | 391 ++-----
core/sql/comexe/LateBindInfo.h | 679 ++---------
core/sql/executor/ExExeUtilMisc.cpp | 5 +-
core/sql/executor/ExFastTransport.cpp | 13 +-
core/sql/executor/ExFastTransport.h | 4 +-
core/sql/executor/ExHdfsScan.cpp | 5 +-
core/sql/executor/Ex_esp_msg.h | 40 -
core/sql/executor/ex_control.cpp | 2 +-
core/sql/executor/ex_ddl.cpp | 3 -
core/sql/executor/ex_esp_frag_dir.cpp | 11 -
core/sql/executor/ex_esp_msg.cpp | 243 ----
core/sql/executor/ex_frag_rt.cpp | 33 -
core/sql/executor/ex_globals.cpp | 2 +
core/sql/exp/ExpLOBaccess.cpp | 119 +-
core/sql/exp/ExpLOBaccess.h | 14 +-
core/sql/exp/ExpLOBinterface.cpp | 31 +-
core/sql/exp/ExpLOBinterface.h | 9 +-
core/sql/generator/GenExplain.cpp | 2 +-
core/sql/generator/GenFastTransport.cpp | 25 +-
core/sql/generator/GenRelExeUtil.cpp | 7 +-
core/sql/generator/GenRelMisc.cpp | 102 +-
core/sql/generator/GenRelScan.cpp | 45 +-
core/sql/generator/Generator.cpp | 16 +
core/sql/generator/Generator.h | 10 +
core/sql/optimizer/RelExeUtil.h | 2 +-
core/sql/optimizer/RelMisc.h | 3 +-
core/sql/parser/SqlParserAux.cpp | 21 -
core/sql/parser/SqlParserAux.h | 4 -
core/sql/parser/sqlparser.y | 90 +-
core/sql/regress/tools/regress-filter-linux | 2 +-
core/sql/sqlcomp/DefaultConstants.h | 6 +-
core/sql/sqlcomp/nadefaults.cpp | 16 +-
45 files changed, 583 insertions(+), 2967 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/arkcmp/CmpContext.cpp
----------------------------------------------------------------------
diff --git a/core/sql/arkcmp/CmpContext.cpp b/core/sql/arkcmp/CmpContext.cpp
index 33da08b..1ff5c9c 100644
--- a/core/sql/arkcmp/CmpContext.cpp
+++ b/core/sql/arkcmp/CmpContext.cpp
@@ -175,7 +175,6 @@ CmpContext::CmpContext(UInt32 f, CollHeap * h)
diags_ = ComDiagsArea::allocate(heap_);
SqlParser_Diags = diags_;
- recompLateNameInfoList_ = NULL;
char* streamName;
outFstream_ = NULL;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/arkcmp/CmpContext.h
----------------------------------------------------------------------
diff --git a/core/sql/arkcmp/CmpContext.h b/core/sql/arkcmp/CmpContext.h
index eaed39a..37d2df7 100644
--- a/core/sql/arkcmp/CmpContext.h
+++ b/core/sql/arkcmp/CmpContext.h
@@ -351,8 +351,6 @@ public :
CursorSelectColumns staticCursors_;
CollIndex saveRetrievedCols_;
- void * &recompLateNameInfoList() { return recompLateNameInfoList_; };
-
// get/set storage for SQLMX_REGRESS environment variable
Int32 getSqlmxRegress() const { return sqlmxRegress_; }
void setSqlmxRegress(Int32 regressEnvVar) { sqlmxRegress_ = regressEnvVar; }
@@ -535,12 +533,6 @@ private:
// See methods isInternalMdf and isInternalModName in arkcmp/StaticCompiler.C.
InternalCompileEnum internalCompile_;
- // pointer to class executor/ex_latebind.h/RecompLateNameInfoList.
- // Used to get to the actual name of a host/env var at recomp time
- // that was originally specified
- // as a PROTOTYPE value for table name at compile time.
- void * recompLateNameInfoList_;
-
// Node and Disk autonomy must distinguish run-time compiles.
NABoolean isRuntimeCompile_;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/arkcmp/CmpStatement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/arkcmp/CmpStatement.cpp b/core/sql/arkcmp/CmpStatement.cpp
index 070a1a5..5067d41 100644
--- a/core/sql/arkcmp/CmpStatement.cpp
+++ b/core/sql/arkcmp/CmpStatement.cpp
@@ -326,13 +326,10 @@ static NABoolean processRecvdCmpCompileInfo(CmpStatement *cmpStmt,
NABoolean &aqrPrepare,
NABoolean &standaloneQuery)
{
- RecompLateNameInfoList * rlnil = NULL;
char * catSchStr = NULL;
- cmpInfo->getUnpackedFields(sqlStr, rlnil, catSchStr, recompControlInfo);
+ cmpInfo->getUnpackedFields(sqlStr, catSchStr, recompControlInfo);
sqlStrLen = cmpInfo->getSqlTextLen();
- context->recompLateNameInfoList() = rlnil;
-
catSchNameRecvd = FALSE;
nametypeNsk = FALSE;
odbcProcess = FALSE;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/cli/Cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Cli.cpp b/core/sql/cli/Cli.cpp
index 8f2189b..c57f650 100644
--- a/core/sql/cli/Cli.cpp
+++ b/core/sql/cli/Cli.cpp
@@ -11000,105 +11000,6 @@ Lng32 SQLCLI_LOBddlInterface
return 0;
}
-#ifdef __ignore
-Lng32 SQLCLI_LOBloader2sqlInterface
-(
- /*IN*/ CliGlobals *cliGlobals,
- /*IN*/ char * lobHandle,
- /*IN*/ Lng32 lobHandleLen,
- /*IN*/ char * lobInfo,
- /*IN*/ Lng32 lobInfoLen,
- /*IN*/ LOBcliQueryType qType,
- /*INOUT*/ char * dataLoc, /* IN: for load, OUT: for extract */
- /*INOUT*/ Int64 &dataLen, /* length of data. 0 indicates EOD */
- /*INOUT*/ void* *cliInterface /* INOUT: if returned, save it and
- pass it back in on the next call */
-
- )
-{
- ContextCli & currContext = *(cliGlobals->currContext());
- ComDiagsArea & diags = currContext.diags();
-
- if (! currContext.currLobGlobals())
- {
- currContext.currLobGlobals() =
- new(currContext.exHeap()) LOBglobals(currContext.exHeap());
- ExpLOBoper::initLOBglobal
- (currContext.currLobGlobals()->lobAccessGlobals(), currContext.exHeap(),currContext);
- }
- void * lobGlobs = currContext.currLobGlobals()->lobAccessGlobals();
- Int16 flags;
- Lng32 lobType, lobNum;
- Int64 uid, inDescSyskey, descPartnKey;
- short schNameLen;
- char schName[512];
- ExpLOBoper::extractFromLOBhandle(&flags, &lobType, &lobNum, &uid,
- &inDescSyskey, &descPartnKey,
- &schNameLen, schName,
- lobHandle);
-
- char tgtLobNameBuf[100];
- char * tgtLobName =
- ExpLOBoper::ExpGetLOBname(uid, lobNum, tgtLobNameBuf, 100);
-
- Lng32 cliRC = 0;
-
- LOBcliQueryType saveQtype = qType;
-
- switch (qType)
- {
- case LOB_DATA_LOAD:
- {
- // temp until lobStorageLocation is passed in.
- char llb[100];
- strcpy(llb, lobInfo);
- char * lobLoc = llb;
-
- Int64 descSyskey = -1;
- Int64 requestTag = -1;
- Lng32 cliError = 0;
- cliRC = ExpLOBInterfaceInsert(lobGlobs,
- tgtLobName,
- lobLoc,
- lobType,
- NULL, 0,
-
- lobHandleLen, lobHandle,
- NULL, NULL,
- 0, NULL,
- requestTag,
- 0,
- inDescSyskey,
- Lob_InsertDataSimple,
- &cliError,
- Lob_Memory,
-
- 1, // waited
- dataLoc,
- dataLen);
-
- if (cliRC < 0)
- {
- Lng32 intParam1 = -cliRC;
- ComDiagsArea * da = &diags;
- ExRaiseSqlError(currContext.exHeap(), &da,
- (ExeErrorCode)(8442), NULL, &intParam1,
- &cliError, NULL, (char*)"ExpLOInterfaceInsert",
- getLobErrStr(intParam1));
- goto error_return;
- }
-
- }
- break;
-
- } // switch
-
- // normal return. Fall down to deallocate of structures.
-
- error_return:
- return (cliRC < 0 ? cliRC : 0);
-}
-#endif
/*
Int32 SQLCLI_SWITCH_TO_COMPILER_TYPE(CliGlobals * cliGlobals,
Int32 compiler_class_type)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/cli/Cli.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/Cli.h b/core/sql/cli/Cli.h
index 1e48be1..86ddaca 100644
--- a/core/sql/cli/Cli.h
+++ b/core/sql/cli/Cli.h
@@ -940,22 +940,6 @@ Lng32 SQLCLI_LOBddlInterface
/*IN*/ NABoolean lobTrace
);
-#ifdef __ignore
-Lng32 SQLCLI_LOBloader2sqlInterface
-(
- /*IN*/ CliGlobals *cliGlobals,
- /*IN*/ char * lobHandle,
- /*IN*/ Lng32 lobHandleLen,
- /*IN*/ char * lobInfo,
- /*IN*/ Lng32 lobInfoLen,
- /*IN*/ LOBcliQueryType qType,
- /*INOUT*/ char * dataLoc, /* IN: for load, OUT: for extract */
- /*INOUT*/ Int64 &dataLen, /* length of data. 0 indicates EOD */
- /*INOUT*/ void* *cliInterface /* INOUT: if returned, save it and
- pass it back in on the next call */
-
- );
-#endif
Int32 SQLCLI_SWITCH_TO_COMPILER_TYPE
(
/*IN*/ CliGlobals* cliGlobals,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/cli/CliExtern.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/CliExtern.cpp b/core/sql/cli/CliExtern.cpp
index 380b0fc..b635e66 100644
--- a/core/sql/cli/CliExtern.cpp
+++ b/core/sql/cli/CliExtern.cpp
@@ -7483,57 +7483,6 @@ Lng32 SQL_EXEC_LOBddlInterface
return retcode;
}
-#ifdef __ignore
-Lng32 SQL_EXEC_LOBloader2sqlInterface
-(
- /*IN*/ char * lobHandle,
- /*IN*/ Lng32 lobHandleLen,
- /*IN*/ char * lobInfo,
- /*IN*/ Lng32 lobInfoLen,
- /*IN*/ LOBcliQueryType qType,
- /*INOUT*/ char * dataLoc, /* IN: for load, OUT: for extract */
- /*INOUT*/ Int64 &dataLen, /* length of data. 0 indicates EOD */
- /*INOUT*/ void* *cliInterface /* INOUT: if returned, save it and
- pass it back in on the next call */
- )
-{
- Lng32 retcode;
- CLISemaphore *tmpSemaphore;
- ContextCli *threadContext;
- CLI_NONPRIV_PROLOGUE(retcode);
- try
- {
- tmpSemaphore = getCliSemaphore(threadContext);
- tmpSemaphore->get();
- threadContext->incrNumOfCliCalls();
- retcode = SQLCLI_LOBloader2sqlInterface(GetCliGlobals(),
- lobHandle,
- lobHandleLen,
- lobInfo,
- lobInfoLen,
- qType,
- dataLoc,
- dataLen,
- cliInterface);
- }
- catch(...)
- {
- retcode = -CLI_INTERNAL_ERROR;
-#if defined(_THROW_EXCEPTIONS)
- if (cliWillThrow())
- {
- threadContext->decrNumOfCliCalls();
- tmpSemaphore->release();
- throw;
- }
-#endif
- }
- threadContext->decrNumOfCliCalls();
- tmpSemaphore->release();
- RecordError(NULL, retcode);
- return retcode;
-}
-#endif
Int32 SQL_EXEC_SWITCH_TO_COMPILER_TYPE
(
/*IN*/ Int32 cmpCntxtType
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/cli/ExSqlComp.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/ExSqlComp.cpp b/core/sql/cli/ExSqlComp.cpp
index c1650aa..6f7f97a 100644
--- a/core/sql/cli/ExSqlComp.cpp
+++ b/core/sql/cli/ExSqlComp.cpp
@@ -581,7 +581,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resetAllDefaults(){
Lng32 len = str_len(buf[i])+1;
CmpCompileInfo c((char *)buf[i], len,
(Lng32)SQLCHARSETCODE_UTF8
- , NULL, 0, NULL, 0, NULL, 0, 0, 0);
+ , NULL, 0, NULL, 0, 0, 0);
size_t dataLen = c.getLength();
char * data = new(h_) char[dataLen];
c.pack(data);
@@ -607,7 +607,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resetRemoteDefaults(){
Lng32 len = str_len(buf[i])+1;
CmpCompileInfo c((char *)buf[i], len,
(Lng32)SQLCHARSETCODE_UTF8
- , NULL, 0, NULL, 0,NULL,0, 0, 0);
+ , NULL, 0,NULL,0, 0, 0);
size_t dataLen = c.getLength();
char * data = new(h_) char[dataLen];
c.pack(data);
@@ -745,7 +745,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
str_len(GetControlDefaults::GetExternalizedDefaultsStmt())+1;
CmpCompileInfo c(buf, len,
(Lng32)SQLCHARSETCODE_UTF8
- , NULL, 0, NULL, 0, NULL, 0, 0, 0);
+ , NULL, 0, NULL, 0, 0, 0);
size_t dataLen = c.getLength();
char * data = new(h_) char[dataLen];
c.pack(data);
@@ -825,7 +825,7 @@ ExSqlComp::ReturnStatus ExSqlComp::resendControls(NABoolean ctxSw) // Genesis
Lng32 len = ctl->getSqlTextLen()+1;
CmpCompileInfo c(buf, len,
(Lng32)SQLCHARSETCODE_UTF8
- , NULL, 0, NULL, 0, NULL, 0, 0, 0);
+ , NULL, 0, NULL, 0, 0, 0);
size_t dataLen = c.getLength();
char * data = new(h_) char[dataLen];
c.pack(data);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/cli/Statement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Statement.cpp b/core/sql/cli/Statement.cpp
index 8502e76..c38cd0a 100644
--- a/core/sql/cli/Statement.cpp
+++ b/core/sql/cli/Statement.cpp
@@ -79,6 +79,7 @@
#include "logmxevent.h"
+#include "ExpLOBinterface.h"
#include "ExUdrServer.h"
#include "wstr.h"
@@ -1631,8 +1632,6 @@ RETCODE Statement::prepare2(char *source, ComDiagsArea &diagsArea,
char * data = NULL;
ULng32 dataLen = 0;
ExSqlComp::Operator op;
- char * rlnilBuf = NULL;
- ULng32 rlnilLen = 0;
while (retry)
{
if (newOperation)
@@ -1641,36 +1640,9 @@ RETCODE Statement::prepare2(char *source, ComDiagsArea &diagsArea,
// Build request and send to arkcmp.
if ((reComp) || (aqRetry && deCache))
{
- if ((reComp) && (root_tdb))
- {
- if (root_tdb->getLateNameInfoList())
- if ((root_tdb->getPlanVersion() < COM_VERS_R2_3) ||
- (versionToUse_ < COM_VERS_R2_3))
-
- {
- rlnilLen= root_tdb->getLateNameInfoList()->
- getRecompLateNameInfoListLenPre1800();
-
- rlnilBuf = new(&heap_) char[rlnilLen];
- root_tdb->getLateNameInfoList()->
- getRecompLateNameInfoListPre1800(rlnilBuf);
- }
- else
- {
- rlnilLen =
- root_tdb->getLateNameInfoList()->getRecompLateNameInfoListLen();
-
- rlnilBuf = new(&heap_) char[rlnilLen];
- root_tdb->getLateNameInfoList()->
- getRecompLateNameInfoList(rlnilBuf);
- }
- }
-
CmpCompileInfo c((reComp ? source_str : source),
(reComp ? sourceLenplus1() : octetLenplus1(source, charset)),
(Lng32) (reComp ? charset_ : charset),
- (RecompLateNameInfoList *)rlnilBuf,
- (Lng32) rlnilLen,
schemaName_, schemaNameLength_+1,
recompControlInfo_, recompControlInfoLen_,
getInputArrayMaxsize(), (short)rsa);
@@ -1700,9 +1672,6 @@ RETCODE Statement::prepare2(char *source, ComDiagsArea &diagsArea,
data = (char *)dealloc.getAddr
(new(dealloc.setHeap(&heap_)) char[dataLen]);
c.pack(data);
- if (rlnilBuf)
- NADELETEBASIC(rlnilBuf, &heap_);
- rlnilBuf = NULL;
// Release the existing TDB tree if one exists
assignRootTdb(NULL);
@@ -1728,7 +1697,7 @@ RETCODE Statement::prepare2(char *source, ComDiagsArea &diagsArea,
else
{
CmpCompileInfo c(source, octetLenplus1(source, charset), (Lng32) charset,
- NULL, 0, NULL, 0, NULL, 0,
+ NULL, 0, NULL, 0,
getInputArrayMaxsize(), (short)rsa);
if (aqRetry)
@@ -2102,526 +2071,60 @@ Statement * Statement::getCurrentOfCursorStatement(char * cursorName)
}
-///////////////////////////////////////////////////////////////////////
-// RETURN: doSimCheck: if true, do similarity check.
-// doFixup: if true and doSimCheck is false, do fixup again.
-// Note: fixup is always done after sim check so if
-// doSimCheck is returned as true, then doFixup
-// is ignored.
-///////////////////////////////////////////////////////////////////////
-RETCODE Statement::resolveNames(LateNameInfoList * lnil,
- Descriptor * inputDesc,
- ComDiagsArea &diagsArea,
- NABoolean &doSimCheck,
- NABoolean &doFixup)
+RETCODE Statement::doHiveTableSimCheck(TrafSimilarityTableInfo *si,
+ void * lobGlob,
+ NABoolean &simCheckFailed,
+ ComDiagsArea &diagsArea)
{
- doSimCheck = FALSE;
- doFixup = FALSE;
- Lng32 curAnsiNameLen = 0;
- char * curAnsiName = 0;
- NABoolean contextChanged = FALSE;
- AnsiOrNskName *curName = NULL;
- Int16 retCode;
- char * parts[4];
- Lng32 numParts;
- bool isNskName = FALSE;
- char * fullyQualifiedSchemaName = schemaName_;
-
- if (lnil->definePresent())
- {
- // if this is the first time names are being resolved, then
- // do it even if the define context has not changed.
- unsigned short defcon = context_->getCurrentDefineContext();
- if ((NOT firstResolveDone()) ||
- (defcon != defineContext()))
- {
- contextChanged = TRUE;
- }
- defineContext() = defcon;
- }
-
- for (Int32 l = 0; l < (Int32) (lnil->getNumEntries()); l++)
- {
- LateNameInfo * lni = &(lnil->getLateNameInfo(l));
-
- lni->setAnsiNameChange(0);
-
-
- if (lni->isVariable())
- {
-
- if (lni->isDefine())
- {
- }
- else if (lni->isEnvVar())
- {
- // get name from env var.
- char envName[ComMAX_3_PART_EXTERNAL_UTF8_NAME_LEN_IN_BYTES+1];
- curAnsiName = cliGlobals_->getEnv(lni->variableName());
-
- if ((! curAnsiName)||
- ((curAnsiNameLen = str_len(curAnsiName)) >
- ComMAX_3_PART_EXTERNAL_UTF8_NAME_LEN_IN_BYTES))
- {
-
- diagsArea << DgSqlCode(-EXE_INVALID_DEFINE_OR_ENVVAR)
- <<DgString0(lni->variableName());
- return ERROR;
- }
- str_cpy_all(envName,curAnsiName,str_len(curAnsiName));
- envName[curAnsiNameLen] = '\0';
-
- curName = new (&heap_) AnsiOrNskName(envName);
- if (curName->convertAnsiOrNskName())
- {
- diagsArea << DgSqlCode(-CLI_INVALID_SQL_ID)<<DgString0(envName);
- delete curName;
- return ERROR;
- }
- } //endif env var
-
- else if (lni->isCachedParam())
- {
- // cached params are only resolved on the first execute after
- // prepare. These values are set from constants and
- // cannot change for multiple executions of the same stmt.
- if (firstResolveDone())
- continue; // Go back to the for loop to continue with the next lni
-
- curAnsiName =
- &root_tdb->getParameterBuffer()
- [lni->getCachedParamOffset()];
- curName = new (&heap_) AnsiOrNskName(curAnsiName);
- if (curName->convertAnsiOrNskName())
- {
- diagsArea << DgSqlCode(-CLI_INVALID_SQL_ID)<<DgString0(curAnsiName);
- delete curName;
- return ERROR;
- }
-
- } //endif cached param
- else // hvar or param
- {
- // Here we need to validate what the hvar contains
- // We need to make sure it is a string hvar and we call
- // convDoIt so that we only get the length of the
- // string that we need.
-
- char *source= 0;
- Lng32 sourceLen = 0;
- Lng32 sourceType = 0;
- Lng32 sourceCharset = CharInfo::UnknownCharSet;
- void *var_ptr = 0;
-
- inputDesc->getDescItem(lni->getInputListIndex(),
- SQLDESC_VAR_PTR, &var_ptr,
- 0, 0, 0, 0);
- inputDesc->getDescItem(lni->getInputListIndex(),
- SQLDESC_LENGTH, &sourceLen,
- 0,0,0,0);
-
- inputDesc->getDescItem(lni->getInputListIndex(),
- SQLDESC_TYPE_FS, &sourceType,
- 0,0,0,0);
-
- // Check if input is a string type
-
- if ((sourceType>=REC_MIN_CHARACTER) &&
- (sourceType <= REC_MAX_CHARACTER))
- {
- inputDesc->getDescItem(lni->getInputListIndex(),
- SQLDESC_CHAR_SET, &sourceCharset,
- 0,0,0,0);
-
- if (sourceCharset == CharInfo::UnknownCharSet &&
- (sourceType == REC_BYTE_F_ASCII ||
- sourceType == REC_BYTE_V_ASCII ||
- sourceType == REC_BYTE_V_ANSI))
- {
- // some clients aren't accustomed yet to setting the
- // charset of the SQL statement, treat those as ISO88591
- // for single-byte based data types
- sourceCharset = CharInfo::ISO88591;
- }
-
- if (stmt_type == STATIC_STMT &&
- sourceCharset == CharInfo::ISO88591)
- {
- // our convention is to pass UTF-8 or UCS2 for
- // names in embedded programs. However, embedded
- // SQL does not support UTF-8 at this time.
- // Temporary fix: Set input charset to UTF-8
- // here until UTF-8 host varables are supported
- // in embedded programs (if that ever happens)
- sourceCharset = CharInfo::UTF8;
- }
- }
- else
- {
- diagsArea << DgSqlCode(-CLI_INVALID_OBJECTNAME);
- return ERROR;
- }
- source = (char *)var_ptr;
-
- if (DFS2REC::isSQLVarChar(sourceType))
- {
- // the first 2 bytes of data are actually the variable
- // length indicator
- short VCLen;
- str_cpy_all((char *) &VCLen, source, sizeof(short));
- sourceLen = (Lng32) VCLen;
- source = &source[sizeof(short)];
- }
-
- ComDiagsArea *diagsPtr = NULL;
- char targetName[ComMAX_3_PART_EXTERNAL_UTF8_NAME_LEN_IN_BYTES + 1];
- short retcode = convDoIt(source,
- sourceLen,
- (short) sourceType,
- 0,
- sourceCharset, // passed in as scale
- targetName,
- sizeof(targetName) - 1,
- REC_BYTE_V_ANSI, // short targetType
- 0, // Lng32 targetPrecision
- (Lng32) SQLCHARSETCODE_UTF8, // Lng32 targetScale - also used as targetCharSet for CharType
- 0,
- 0,
- &heap_,
- &diagsPtr);
- if (diagsPtr)
- {
- diagsArea.mergeAfter(*diagsPtr);
- diagsPtr->decrRefCount();
- diagsPtr = NULL;
- }
- if (retcode != ex_expr::EXPR_OK)
- {
- diagsArea << DgSqlCode(-EXE_CONVERT_STRING_ERROR);
- char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
- memset(hexstr, 0 , sizeof(hexstr) );
- diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
-
- return ERROR;
- }
-
- if (! fullyQualifiedSchemaName)
- fullyQualifiedSchemaName = lni->compileTimeAnsiName();
-
- curName = new (&heap_) AnsiOrNskName(targetName);
- if (curName->convertAnsiOrNskName())
- {
- diagsArea << DgSqlCode(-CLI_INVALID_SQL_ID)
- <<DgString0(targetName);
- delete curName;
- return ERROR;
-
- }
- } // end if hvar
-
- if (NOT lni->isMPalias())
- {
- if (lni->isAvoidSimCheck()) // Host Variable in SET TABLE TIMEOUT command without
- // Prototype clause will have the NAME_ONLY and VARIABLE bit is set
- // So,we will need at least 3 parts
- // If nsk name, system name will be filled in
- {
- if (curName->extractParts(numParts, parts))
- {
- diagsArea << DgSqlCode(-CLI_INVALID_SQL_ID)
- << DgString0(curName->getExternalName());
- delete curName;
- return ERROR;
- }
- if (numParts < 3)
- {
- diagsArea << DgSqlCode(-CLI_INVALID_SQL_ID)
- << DgString0(curName->getExternalName());
- delete curName;
- return ERROR;
- }
- isNskName = curName->isNskName(); // will be set to False
- }
- else
- isNskName = TRUE;
- if (isNskName)
- {
- curAnsiName = curName->getInternalName();
- curAnsiNameLen = str_len(curAnsiName);
- if (curAnsiName[0] != '\\')
- {
-
- }
- }
- }
-
- if (lni->isMPalias() && NOT (lni->isAnsiPhySame())) {
- // if MPAlias flag is set, then we compiled for an MX table, or an MP table with
- // a MPAlias defined on it See comment in GenRelMisc.cpp PartitionAccess::codeGen
- // method where the mpalias flag is set. If that flag is set only for an MPAlias
- // and not for MX tables then this else statement condition will have to be modified.
- // The code below should be executed for MX tables and for MP tables access through
- // their MPAlias. The code below is also not needed for accessing resource forks whose
- // ansi name is same as their physical name.
-
- if (curName->extractParts(numParts, parts))
- {
- diagsArea << DgSqlCode(-CLI_INVALID_SQL_ID)
- << DgString0(curName->getExternalName());
- delete curName;
- return ERROR;
- }
- if (numParts != 3) {
- if (curName->fillInMissingParts(fullyQualifiedSchemaName) == -1)
- {
- diagsArea << DgSqlCode(-CLI_INVALID_SQL_ID)
- << DgString0(curName->getExternalName());
- delete curName;
- return ERROR;
- }
- } // end if numParts != 3
-
- } // end isMPAlias && isAnsiPhySame
-
- // if current ansi name is different than the last ansi name,
- // resolve the current ansi name. Remember this in lni.
- retCode = lni->getLastUsedName(&heap_)->equals(curName);
- if (retCode == -1)
- {
- diagsArea << DgSqlCode(-CLI_INTERNAL_ERROR);
- delete curName;
- return ERROR;
- }
- else
- if (retCode == 0)
- {
- lni->setAnsiNameChange(1);
- lni->setLastUsedName(curName);
- // If similarity check is to be avoided: Map the physical name
- // right here (otherwise done during the similarity check.)
- if ( lni->isAvoidSimCheck() )
- {
- if (! isNskName)
- {
- if (mapAnsiToGuaName(lni, diagsArea) == ERROR)
- return ERROR;
- }
- else
- strcpy(lni->resolvedPhyName(), curName->getInternalName());
- doFixup = TRUE; // fixup needs to be done again to
- // be able to use the new name.
- }
- else
- if (NOT doSimCheck)
- {
- doSimCheck = TRUE;
-
- // if this is a view name that has changed, mark it
- // in the latenameinfo struct. This will be used later
- // when similarity check is done in doQuerySimilarityCheck.
- if (lni->isView())
- {
- lni->setViewNameChange(1);
- }
- }
- }
- else
- {
- if (curName)
- {
- delete curName;
- curName = NULL;
- }
-
-
- }
-
- } // variable
-
- } // for
-
- if (NOT firstResolveDone())
- {
- setFirstResolveDone(TRUE);
- }
-
- return SUCCESS;
-}
-
-
-////////////////////////////////////////////////////////////////////
-// This method performs similarity check between the information
-// generated at compile time (si) and the information retrieved at
-// runtime for table specified via tableName.
-// RETURNS: ERROR: if an error occured.
-// SUCCESS, otherwise.
-// if sim check fails, then this is indicated by
-// the return param, simCheckFailed, set to TRUE.
-/////////////////////////////////////////////////////////////////////
-RETCODE Statement::doSimilarityCheck(SimilarityInfo * si,
- LateNameInfo * lni,
- char * tableName,
- NABoolean &simCheckFailed,
- ComDiagsArea &diagsArea
- )
-{
- return SUCCESS;
-}
+ simCheckFailed = FALSE;
+ Lng32 retcode = 0;
-RETCODE Statement::doIUDSimilarityCheck(SimilarityInfo * si,
- LateNameInfo * lni,
- char * tableName,
- Queue * indexInfoList,
- NABoolean &simCheckFailed,
- ComDiagsArea &diagsArea)
-{
- return SUCCESS;
-}
+ if ((si->hdfsRootDir() == NULL) || (si->modTS() == -1))
+ return SUCCESS;
-RETCODE Statement::getMatchingIndex(Queue * indexInfoList,
- char * indexAnsiName,
- char * indexPhyName,
- ComDiagsArea &diagsArea)
-{
- indexInfoList->position();
- for (Int32 i = 0; i < indexInfoList->numEntries(); i++)
+ Int64 failedModTS = -1;
+ Lng32 failedLocBufLen = 1000;
+ char failedLocBuf[failedLocBufLen];
+ retcode = ExpLOBinterfaceDataModCheck
+ (lobGlob,
+ si->hdfsRootDir(),
+ si->hdfsHostName(),
+ si->hdfsPort(),
+ si->modTS(),
+ si->numPartnLevels(),
+ failedModTS,
+ failedLocBuf, failedLocBufLen);
+ if (retcode < 0)
{
- IndexInfo * ii = (IndexInfo*)(indexInfoList->getNext());
-
- if (str_cmp(indexAnsiName, ii->indexAnsiName(),
- str_len(indexAnsiName)) == 0)
- {
- strcpy(indexPhyName, ii->indexPhyName());
- return SUCCESS;
- }
+ Lng32 intParam1 = -retcode;
+ diagsArea << DgSqlCode(-EXE_ERROR_FROM_LOB_INTERFACE)
+ << DgString0("HDFS")
+ << DgString1("ExpLOBInterfaceDataModCheck")
+ << DgString2(getLobErrStr(intParam1))
+ << DgInt0(intParam1)
+ << DgInt1(0);
+ return ERROR;
}
- return SUCCESS;
-}
-
-RETCODE Statement::mapAnsiToGuaName(LateNameInfo * lni,
- ComDiagsArea &diagsArea)
-{
- return ERROR;
-}
-
-// this method resolves all table names that are used in this query.
-RETCODE Statement::forceMapAllNames(LateNameInfoList * lnil,
- ComDiagsArea &diagsArea)
-{
- for (Int32 i = 0; i < (Int32) (lnil->getNumEntries()); i++)
+ if (retcode == 1) // check failed
{
- LateNameInfo * lni = &(lnil->getLateNameInfo(i));
-
- lni->setAnsiNameChange(1);
-
- char *lastUsedAnsiName = lni->lastUsedAnsiName();
-
- // NA_NSK_REL1 - need to change for ansi names
- NABoolean isGuardianName =
- (lastUsedAnsiName && lastUsedAnsiName[0] == '\\') ? TRUE : FALSE;
-
- if (lni->isAnsiPhySame() || isGuardianName)
- {
-
- // If ansi name is really a phys name, copy it to resolvedPhyName.
- // For the first release on NSK, all internal table names, such as
- // histograms, histints, etc, will have resolved physical names as
- // their ANSI name.
- str_cpy(lni->resolvedPhyName(), lni->lastUsedAnsiName(),
- str_len(lni->lastUsedAnsiName()) + 1, '\0');
- }
- else
- {
- // VO, Metadata indexes
- // If all of the following is true:
- // - the lni represents an index
- // - the query is from a system module,
- // THEN the generator has set the last used ansi name to the
- // compile time name of the base table. We will use that to find
- // the index runtime ANSI name.
- LateNameInfo * baseTableLni = NULL;
- if ( (lni->getNameSpace() == COM_INDEX_NAME) &&
- (systemModuleStmt())
- )
- {
- if (lni->isVariable())
- {
- // resolve names has put the runtime name of the table in this lni
- baseTableLni = lni;
- }
- else
- {
- // iterate over the lnil to find the entry for the index' base table
- for (Int32 ix = 0; ix < (Int32) (lnil->getNumEntries()); ix++)
- {
- LateNameInfo * lni2 = &(lnil->getLateNameInfo(ix));
- if (!strcmp (lni2->compileTimeAnsiName(), lni->lastUsedAnsiName()))
- {
- baseTableLni = lni2;
- break;
- }
- }
- }
-
- if (baseTableLni == NULL)
- {
- // didn't find the base table in the lnil - quit!
- diagsArea << DgSqlCode(-CLI_INTERNAL_ERROR);
- return ERROR;
- }
-
- // Construct the runtime index name from
- // - the runtime catalog and schema name parts of the base table
- // - the compile time object name part of the index
- char * indexParts[4];
- char * tableParts[4];
- Lng32 numIndexParts = -1, numTableParts = -1;
- AnsiOrNskName * indexCompileTimeAnsiName = new (&heap_) AnsiOrNskName(lni->compileTimeAnsiName());
- baseTableLni->getLastUsedName(&heap_)->extractParts (numTableParts, tableParts);
- indexCompileTimeAnsiName->extractParts (numIndexParts, indexParts);
-
- if ( (numIndexParts != 3) || (numTableParts != 3))
- {
- // Something rotten here ...
- delete indexCompileTimeAnsiName;
- diagsArea << DgSqlCode(-CLI_INTERNAL_ERROR);
- return ERROR;
- }
-
- char indexExtName[ComMAX_3_PART_EXTERNAL_UTF8_NAME_LEN_IN_BYTES + 1];
- ComBuildANSIName (tableParts[0], tableParts[1], indexParts[2], indexExtName);
- delete indexCompileTimeAnsiName;
-
- AnsiOrNskName * indexName = new (&heap_) AnsiOrNskName(indexExtName);
- lni->setLastUsedName (indexName);
- }
+ char errStr[200];
+ str_sprintf(errStr, "compiledModTS = %Ld, failedModTS = %Ld, failedLoc = %s",
+ si->modTS(), failedModTS,
+ (failedLocBufLen > 0 ? failedLocBuf : si->hdfsRootDir()));
+
+ diagsArea << DgSqlCode(-EXE_HIVE_DATA_MOD_CHECK_ERROR)
+ << DgString0(errStr);
- RETCODE retcode = mapAnsiToGuaName(lni, diagsArea);
- if (baseTableLni != NULL && !lni->isVariable())
- // need to reset the last used ANSI name for a metadata index to that of the
- // compile time base table. Otherwise, the next name mapping will fail.
- lni->setLastUsedName (new (&heap_) AnsiOrNskName (baseTableLni->compileTimeAnsiName()));
+ simCheckFailed = TRUE;
- if (retcode != SUCCESS)
- return ERROR;
-
- }
+ return ERROR;
}
-
+
return SUCCESS;
}
-/////////////////////////////////////////////////////////////////////////
-// This method does similarity checks on all tables for which
-// the flag, doSimCheck(), is set.
-// RETURNS: ERROR: if an error occured.
-// SUCCESS, otherwise.
-// if sim check fails, then this is indicated by
-// the return param, simCheckFailed, set to TRUE.
-/////////////////////////////////////////////////////////////////////////
-RETCODE Statement::doQuerySimilarityCheck(QuerySimilarityInfo * qsi,
- LateNameInfoList * lnil,
+RETCODE Statement::doQuerySimilarityCheck(TrafQuerySimilarityInfo * qsi,
NABoolean &simCheckFailed,
ComDiagsArea &diagsArea
)
@@ -2629,248 +2132,48 @@ RETCODE Statement::doQuerySimilarityCheck(QuerySimilarityInfo * qsi,
RETCODE retcode;
simCheckFailed = FALSE;
+ if ((! qsi) ||
+ (qsi->disableSimCheck()) ||
+ (! qsi->siList()) ||
+ (qsi->siList()->numEntries() == 0))
+ return SUCCESS;
- if (! qsi)
- return ERROR;
-
- NABoolean aqr = root_tdb->aqrEnabled();
- if (aqr)
- {
- diagsArea << DgSqlCode(-EXE_SIM_CHECK_FAILED)
- << DgString0("Similarity check should not be reached with aqr enabled.");
-
- return ERROR;
- }
-
- // if similarity check is being done due to a view name change that
- // was passed thru an identifier, then recompile.
- if (lnil->viewPresent())
- {
- CollIndex i = 0;
- while (i < (Int32) lnil->getNumEntries())
- {
-#pragma nowarn(1506) // warning elimination
- LateNameInfo * lni = &(lnil->getLateNameInfo(i));
-#pragma warn(1506) // warning elimination
-
- if (lni->isViewNameChange())
- {
- lni->setViewNameChange(0);
-
- simCheckFailed = TRUE;
- return SUCCESS;
-
- }
- i++;
- }
- }
-
- switch (qsi->getSimilarityCheckOption())
- {
- case QuerySimilarityInfo::INTERNAL_SIM_CHECK:
- {
- // accessing internal tables(catalog). Just resolve names. Similarity
- // check always passes for these tables.
- retcode = forceMapAllNames(lnil, diagsArea);
- if (retcode == ERROR)
- return ERROR;
-
- for (Int32 i = 0; i < (Int32) (lnil->getNumEntries()); i++)
- {
- // ignore TS mismatch on the next open since similarity
- // check has succeeded.
- lnil->getLateNameInfo(i).setIgnoreTS(1);
- }
-
- return SUCCESS;
- }
- break;
-
- case QuerySimilarityInfo::RECOMP_ON_TS_MISMATCH:
- {
- if (aqr)
- {
- diagsArea << DgSqlCode(-EXE_SIM_CHECK_FAILED)
- << DgString0("Similarity check should not be reached.");
-
- return ERROR;
- }
-
- simCheckFailed = TRUE;
- return SUCCESS;
- }
- break;
-
- case QuerySimilarityInfo::ERROR_ON_TS_MISMATCH:
- {
- diagsArea << DgSqlCode(-EXE_SIM_CHECK_FAILED)
- << DgString0("Similarity check disabled.");
-
- return ERROR;
- }
- break;
-
- case QuerySimilarityInfo::SIM_CHECK_AND_RECOMP_ON_FAILURE:
- case QuerySimilarityInfo::SIM_CHECK_AND_ERROR_ON_FAILURE:
- {
- if (aqr)
- {
- diagsArea << DgSqlCode(-EXE_SIM_CHECK_FAILED)
- << DgString0("Similarity check should not be reached.");
-
- return ERROR;
- }
-
- // do sim check in both these cases. If it passes, do
- // nothing. If it fails, then recompile or return error.
- }
- break;
- }
-
- qsi->siList()->position();
- SimilarityInfo * si;
-
- // index info list is set up for the target IUD'd table in an
- // IUD(Insert/Update/Delete) query. There may not be any indices
- // on the IUD'd table at compile time. In that case, the method
- // doIUDSimilarityCheck validates that there are no indices on the
- // runtime IUD's table as well.
-#pragma warning( disable : 4018 )
- if (qsi->indexInfoList() &&
- (qsi->namePosition() < lnil->getNumEntries()))
-#pragma warning( default: 4018 )
- {
- si = (SimilarityInfo *)(qsi->siList()->get(qsi->namePosition()));
- LateNameInfo * lni = &lnil->getLateNameInfo(qsi->namePosition());
-
- retcode = mapAnsiToGuaName(lni, diagsArea);
- if (retcode == ERROR)
- return ERROR;
-
- simCheckFailed = FALSE;
- if (NOT si->simCheckDisable())
- {
- if (doIUDSimilarityCheck(si,
- lni,
- lni->resolvedPhyName(),
- qsi->indexInfoList(),
- simCheckFailed, diagsArea) == ERROR)
- return ERROR;
- }
-
- if (simCheckFailed)
- {
- if (qsi->getSimilarityCheckOption() ==
- QuerySimilarityInfo::SIM_CHECK_AND_ERROR_ON_FAILURE)
- {
- diagsArea << DgSqlCode(-EXE_SIM_CHECK_FAILED)
- << DgString0("Automatic recompilation disabled.");
-
- return ERROR;
- }
- else
- return SUCCESS;
- }
-
- // at this point we have validated that the runtime table and the
- // compile time table have matching indices which are in the same
- // order.
- lni->setIgnoreTS(1);
- }
-
- Int32 i = 0;
+ void * lobGlob = NULL; //getRootTcb()->getGlobals()->getExLobGlobal();
+ NABoolean lobGlobInitialized = FALSE;
qsi->siList()->position();
-#pragma warning( disable: 4018 )
- while (((si = (SimilarityInfo *)(qsi->siList()->getNext())) != NULL) &&
- (i < lnil->getNumEntries()))
-#pragma warning( default: 4018 )
+ for (Lng32 i = 0; i < qsi->siList()->numEntries(); i++)
{
- LateNameInfo * lni = &lnil->getLateNameInfo(i);
+ TrafSimilarityTableInfo *si =
+ (TrafSimilarityTableInfo *)qsi->siList()->getCurr();
- if (si->internalSimCheck())
- {
- // do nothing. An internal system table is being accessed(a metadata
- // table) and the timestamp info on those tables is not maintained.
- // Consider the similarity check to pass in this case.
- lni->setIgnoreTS(1);
- }
- else if (si->simCheckDisable())
- {
- lni->setIgnoreTS(0);
- simCheckFailed = TRUE;
- }
- else if (si->getMatchingIndex())
- {
- if (getMatchingIndex(qsi->indexInfoList(),
- lni->compileTimeAnsiName(),
- lni->resolvedPhyName(), diagsArea) == ERROR)
- return ERROR;
-
- // ignore TS mismatch on the next open since similarity
- // check has succeeded.
- lni->setIgnoreTS(1);
- }
- else if ((qsi->indexInfoList()) &&
- (i == qsi->namePosition()))
- {
- // This is the target IUD'd table.
- // Nothing needs to be done here, this check has already
- // been done before.
- lni->setIgnoreTS(1);
- }
- else
- {
- retcode = mapAnsiToGuaName(lni, diagsArea);
- if (retcode == ERROR)
- return ERROR;
-
- retcode = doSimilarityCheck(si, lni, lni->resolvedPhyName(),
- simCheckFailed, diagsArea);
-#ifdef _DEBUG
- {
- char * envPtr = getenv ("SQLMX_DISPLAY_CATMAP");
- if (envPtr && *envPtr == '1')
+ simCheckFailed = FALSE;
+ if (si->isHive())
+ {
+ if ((NOT lobGlobInitialized) &&
+ (lobGlob == NULL))
{
- diagsArea << DgSqlCode (DISTRIBUTION_DEBUG_WARNING)
- << DgString0 (lni->lastUsedAnsiName())
- << DgString1 ("maps to")
- << DgString2 (lni->resolvedPhyName());
+ ExpLOBinterfaceInit
+ (lobGlob, &heap_, context_,
+ TRUE, si->hdfsHostName(), si->hdfsPort());
+ lobGlobInitialized = TRUE;
}
- }
-
-#endif
- if (retcode == ERROR)
- return ERROR;
-
- if (simCheckFailed)
- {
- if (qsi->getSimilarityCheckOption() ==
- QuerySimilarityInfo::SIM_CHECK_AND_ERROR_ON_FAILURE)
- {
- diagsArea << DgSqlCode(-EXE_SIM_CHECK_FAILED)
- << DgString0("Automatic recompilation disabled.");
-
- return ERROR;
- }
- else
- return SUCCESS;
- }
-
- // ignore TS mismatch on the next open since similarity
- // check has succeeded.
- lni->setIgnoreTS(1);
- }
- // Fix for 10-010614-3437: When we get here, we have found and
- // restored similar index information for the IUD stmt, so
- // don't compare the timestamps.
- //if (qsi->indexInfoList() && lni->isIndex())
- // lni->setIgnoreTS(1);
+ retcode = doHiveTableSimCheck(si, lobGlob, simCheckFailed, diagsArea);
+ if (retcode == ERROR)
+ {
+ goto error_return; // diagsArea is set
+ }
+ }
+ } // for
- i++;
- }
-
+ if (lobGlob)
+ ExpLOBinterfaceCleanup(lobGlob, &heap_);
return SUCCESS;
+
+ error_return:
+ if (lobGlob)
+ ExpLOBinterfaceCleanup(lobGlob, &heap_);
+ return ERROR;
}
RETCODE Statement::fixup(CliGlobals * cliGlobals, Descriptor * input_desc,
@@ -2890,24 +2193,7 @@ RETCODE Statement::fixup(CliGlobals * cliGlobals, Descriptor * input_desc,
if (fixupState() != 0)
return ERROR;
- if (!donePrepare)
- {
- // Don't check visibility if the statement has just been prepared
- switch (doVisibilityCheck ( root_tdb->getLateNameInfoList(), diagsArea))
- {
- case WARNING:
- doSimCheck = TRUE;
- return SUCCESS;
- case ERROR:
- return ERROR;
- default:
- break;
- }
- }
-
/* fixup the generated code */
- // statementGlobals_->resolvedNameList() =
- // (lnil_ ? lnil_ : root_tdb->getLateNameInfoList());
statementGlobals_->setStartAddr((void *)root_tdb);
statementGlobals_->setCliGlobals(cliGlobals_);
@@ -2992,10 +2278,7 @@ RETCODE Statement::fixup(CliGlobals * cliGlobals, Descriptor * input_desc,
// fixup time.
if (((diagsArea.contains(-EXE_TIMESTAMP_MISMATCH)) &&
(NOT tsMismatched()))
- || ((diagsArea.contains(-EXE_TABLE_NOT_FOUND)) &&
- (root_tdb->querySimilarityInfo()->getSimilarityCheckOption() !=
- QuerySimilarityInfo::INTERNAL_SIM_CHECK)))
-
+ || (diagsArea.contains(-EXE_TABLE_NOT_FOUND)))
{
setTsMismatched(TRUE);
doSimCheck = TRUE;
@@ -3033,14 +2316,6 @@ RETCODE Statement::fixup(CliGlobals * cliGlobals, Descriptor * input_desc,
return ERROR;
}
}
-
- // clear all runtime flags in statementGlobals_->latenameinfolist()->
- // getLateNameInfo(i)
- if (root_tdb->getLateNameInfoList())
- {
- // statementGlobals_->resolvedNameList()->resetFlags();
- root_tdb->getLateNameInfoList()->resetRuntimeFlags();
- }
setFixupState(-1);
@@ -3187,11 +2462,7 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
while (readyToReturn == FALSE)
{
#ifdef _DEBUG
- if ((getenv("SHOW_STATE")) &&
- ((! root_tdb) ||
- ((root_tdb) &&
- (root_tdb->querySimilarityInfo()->getSimilarityCheckOption() !=
- QuerySimilarityInfo::INTERNAL_SIM_CHECK))))
+ if (getenv("SHOW_STATE"))
{
char buf[40];
@@ -3468,234 +2739,37 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
}
setTsMismatched(FALSE);
- state_ = RESOLVE_NAMES_;
+ state_ = DO_SIM_CHECK_;
}
break;
- case RESOLVE_NAMES_:
- {
- NABoolean doSimCheck = FALSE;
- NABoolean doFixup = FALSE;
-
- retcode = resolveNames(root_tdb->getLateNameInfoList(),
- input_desc, diagsArea,
- doSimCheck, doFixup);
- if (retcode == ERROR)
- {
- statementGlobals_->takeGlobalDiagsArea(diagsArea);
- state_ = ERROR_;
- break;
- }
-
- if (doSimCheck) // do sim check due to name change
- {
- state_ = DO_SIM_CHECK_;
- }
- else
- {
- if (doFixup)
- {
- setFixupState(0);
- }
- state_ = CHECK_DYNAMIC_SETTINGS_;
- }
- }
- break;
-
- case DO_SIM_CHECK_:
- {
- // This DO_SIM_CHECK_ state handles two distinct
- // tasks. One task is metadata lookups to discover
- // available partition names following a "partition not
- // available" error. The other task is the similarity
- // check. Right now the code does only one of these tasks
- // but never both. Might be best to break these two tasks
- // out into separate states.
-
- if (partitionUnavailable)
- {
- // We are getting ready to call catman code, and that code
- // will recur into this CLI code. The recursion doesn't work
- // if any errors are in the context Diags Area - i.e, formal
- // parameter diagsArea. So we will clear the context
- // diagsArea, but before clearing, we save off the conditions
- // for two reasons:
- // 1. If error is not fixed by catman, we want to return the
- // original conditions (and any new conditions raise by catman)
- // in the proper chronological order.
- // 2. Also, in case a warning was raised before the availability
- // error (especially, EXE_RECOMPILE), we need to report that,
- // even if catman is able to find an available partition.
- //
- ComDiagsArea *saveContextDiagsArea = diagsArea.copy();
- diagsArea.clear();
-
- // Make a new diags area for catman to accumulate new conditions
- // into.
- ComDiagsArea *catmanDiagsArea =
- ComDiagsArea::allocate(context_->exHeap());
- retcode = forceMapAllNames( lnil_ ?
- lnil_ :
- root_tdb->getLateNameInfoList(), *catmanDiagsArea);
-
- // Clear any new conditions have been added to the context diagsArea
- // They will have copies in the catmanDiagsArea.
- diagsArea.clear();
-
- // Now, construct a final diagsArea, with the pre-catman
- // Conditions first, followed by the Conditions raised by the
- // catman. But if there is no error from the catman, clear the
- // pre-catman errors, because they are no longer relevant.
-
- if (retcode != ERROR)
- {
- Lng32 numErrors = saveContextDiagsArea->getNumber(DgSqlCode::ERROR_);
- while (numErrors--)
- {
- saveContextDiagsArea->deleteError(numErrors);
- }
- }
-
- diagsArea.mergeAfter(*saveContextDiagsArea);
- saveContextDiagsArea->deAllocate();
- diagsArea.mergeAfter(*catmanDiagsArea);
- catmanDiagsArea->deAllocate();
-
- if (retcode == ERROR)
- {
- partitionAvailabilityChecked = TRUE;
-
- // If this is the first time the name lookups failed,
- // continue with a recompile. Otherwise stop working
- // and report the error.
- NABoolean reportTheError = FALSE;
- if (partitionNameLookupsFailed)
- reportTheError = TRUE;
-
-#ifdef NA_DEBUG_C_RUNTIME
- // In the debug build an environment setting can force
- // us to report the error here
- if (getenv("NO_RECOMP_WHEN_PART_UNAVAIL"))
- reportTheError = TRUE;
-#endif
-
- partitionNameLookupsFailed = TRUE;
- if (reportTheError)
- {
- state_ = ERROR_;
- }
- else
- {
- // Clear earlier errors from diags area, but leave warnings.
- Lng32 numErrors = diagsArea.getNumber(DgSqlCode::ERROR_);
- while (numErrors--)
- {
- diagsArea.deleteError(numErrors);
- }
- state_ = RECOMPILE_;
- }
-
- // This breaks us out of the DO_SIM_CHECK_ state
- break;
- }
- else
+ case DO_SIM_CHECK_:
+ {
+ if ((! root_tdb) || (! root_tdb->querySimilarityInfo()))
{
- // At this point, all names are resolved to available
- // partitions, if at all possible. If some names
- // still have no available partitions, we must
- // remember this fact so that the error (to be
- // discovered in the FIXUP_ state) will be returned to
- // the user.
- partitionAvailabilityChecked = TRUE;
- partitionUnavailable = FALSE;
state_ = CHECK_DYNAMIC_SETTINGS_;
-
- } // if (retcode == ERROR) else ...
- } // if (partitionUnavailable)
-
- else
- {
- NABoolean simCheckFailed = FALSE;
-
- if (root_tdb->querySimilarityInfo()->getSimilarityCheckOption() !=
- QuerySimilarityInfo::ERROR_ON_TS_MISMATCH)
- {
- // Clear earlier errors from diags area, but leave warnings.
- Lng32 numErrors = diagsArea.getNumber(DgSqlCode::ERROR_);
- while (numErrors--)
- {
- diagsArea.deleteError(numErrors);
- }
- }
-
- ComDiagsArea * diagsCopy = NULL;
- // If the diagsArea is populated, and this is not a recursive call into CLI,
- // then save a copy and re-instate after doQuerySimilarityCheck.
- // Clear the original diags area to avoid duplicate errors/warnings.
- if ((diagsArea.mainSQLCODE()) &&
- (context_->getNumOfCliCalls() == 1)
- )
- {
- diagsCopy = diagsArea.copy();
- diagsArea.clear();
+ break;
}
- retcode =
- doQuerySimilarityCheck(root_tdb->querySimilarityInfo(),
- (lnil_ ? lnil_ : root_tdb->
- getLateNameInfoList()),
- simCheckFailed, diagsArea);
-
- if (diagsCopy)
+ NABoolean simCheckFailed = FALSE;
+ retcode =
+ doQuerySimilarityCheck(root_tdb->querySimilarityInfo(),
+ simCheckFailed, diagsArea);
+ if (retcode == ERROR)
{
- // We saved something ...
- if (diagsArea.mainSQLCODE())
- {
- // ... and doQuerySimilarityCheck also produced something, add to diagsCopy
- diagsCopy->mergeAfter (diagsArea);
- diagsArea.clear();
- }
- // Put things back where they belong and get rid of the copy
- diagsArea.mergeAfter (*diagsCopy);
- diagsCopy->deAllocate();
+ state_ = ERROR_;
+ break;
}
+
+ state_ = CHECK_DYNAMIC_SETTINGS_;
+ }
+ break;
- if (retcode == ERROR)
- {
- state_ = ERROR_;
- break;
- }
-
- setFixupState(0);
-
- if (simCheckFailed)
- {
- state_ = RECOMPILE_;
- recompileReason[0] = EXE_SIM_CHECK_FAILED;
- }
- else
- {
- recompWarn = returnRecompWarn();
- if (recompWarn &&
- ((root_tdb->querySimilarityInfo()->getSimilarityCheckOption()
- == QuerySimilarityInfo::SIM_CHECK_AND_RECOMP_ON_FAILURE) ||
- (root_tdb->querySimilarityInfo()->getSimilarityCheckOption()
- == QuerySimilarityInfo::SIM_CHECK_AND_ERROR_ON_FAILURE)))
-
- {
- // similarity check passed. Return a warning indicating
- // this. This is a temporary warning for testing.
- diagsArea << DgSqlCode(EXE_SIM_CHECK_PASSED);
- }
- state_ = CHECK_DYNAMIC_SETTINGS_;
- }
- }
- }
- break;
-
case COMPILE_:
case RECOMPILE_:
{
+ ex_assert(0, " COMPILE_ and RECOMPILE_ are obsolete");
+
// We want to ignore any errors that occur as part of dealloc
// when called from here.
// So, we mark the DiagsArea before making the call to dealloc(),
@@ -3894,70 +2968,6 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
setFixupState(0);
- // move resolved names from LateNameInfoList to
- // ResolvedNameList which will be shipped to PA's
- if (root_tdb->getLateNameInfoList())
- {
- ResolvedNameList *&rnl =
- statementGlobals_->resolvedNameList();
- if (rnl && (rnl->numEntries() < root_tdb->getLateNameInfoList()->getNumEntries()))
- {
- // deallocate the previously allocated rnl
- heap_.deallocateMemory(rnl);
- rnl = NULL;
- }
-
- if (! rnl)
- rnl =
- (ResolvedNameList *)
- (new(&heap_)
- char[sizeof(ResolvedNameList) +
- ((root_tdb->getLateNameInfoList()->
- getNumEntries() > 0 ) ?
- ((root_tdb->getLateNameInfoList()->
- getNumEntries() - 1) * sizeof(ResolvedName)):
- 0)]);
-
- rnl->numEntries() =
- root_tdb->getLateNameInfoList()->getNumEntries();
- rnl->resetFlags();
-
- for (Int32 i = 0;
- i < (Int32) (root_tdb->getLateNameInfoList()->
- getNumEntries());
- i++)
- {
- strcpy(rnl->getResolvedName(i).resolvedGuardianName(),
- root_tdb->getLateNameInfoList()->
- getLateNameInfo(i).resolvedPhyName());
-
- short ignore = (short) root_tdb->getLateNameInfoList()->
- getLateNameInfo(i).ignoreTS();
- rnl->getResolvedName(i).setIgnoreTS(ignore);
-
- rnl->getResolvedName(i).setResolvedAnsiName(
- root_tdb->getLateNameInfoList()->
- getLateNameInfo(i).getLastUsedName(&heap_)->getExternalName());
- }
-
- // if this is an IUD query,
- // move the number of indices defined on the target
- // table to the latenameinfo entry for that table.
- // At open time, if this is an sql/mp table and no timestamp
- // mismatch is detected, the number of indices will be
- // validate. See call to doArkOpen in file ex_sql_table.cpp,
- // method SqlTable::SqlTable.
- QuerySimilarityInfo * qsi = root_tdb->querySimilarityInfo();
- if ((qsi->getSimilarityCheckOption() != QuerySimilarityInfo::INTERNAL_SIM_CHECK) &&
- (qsi->indexInfoList()))
- {
- rnl->getResolvedName(qsi->namePosition()).setValidateNumIndexes(TRUE);
- rnl->getResolvedName(
- qsi->namePosition()).setNumIndexes(
- (short)qsi->indexInfoList()->numEntries());
- }
- } // lateNameInfoList present
-
StmtDebug1("[BEGIN fixup] %p", this);
NABoolean doSimCheck = FALSE;
@@ -4108,6 +3118,7 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
state_ = EXECUTE_;
}
break;
+
case EXECUTE_:
{
if (masterStats != NULL)
@@ -4154,8 +3165,6 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
}
}
-
- // BertBert VV
// in case this is a holdable cursor propagate flag to master executor
// leaf nodes
if (isPubsubHoldable() &&
@@ -5268,10 +4277,10 @@ RETCODE Statement::doOltExecute(CliGlobals *cliGlobals,
if (stmt_state != CLOSE_)
{
- // trying to execute a statement which is already in open
- // state
- diagsArea << DgSqlCode(- CLI_STMT_NOT_CLOSE);
- return ERROR;
+ // trying to execute a statement which is already in open
+ // state
+ diagsArea << DgSqlCode(- CLI_STMT_NOT_CLOSE);
+ return ERROR;
}
ExMasterStats * masterStats = NULL;
@@ -5296,7 +4305,7 @@ RETCODE Statement::doOltExecute(CliGlobals *cliGlobals,
masterStats-> setElapsedStartTime(jts);
masterStats->setFixupStartTime(-1);
masterStats->setFreeupStartTime(-1);
- masterStats->setExeStartTime(aqrInitialExeStartTime_ == -1 ? jts :
+ masterStats->setExeStartTime(aqrInitialExeStartTime_ == -1 ? jts :
aqrInitialExeStartTime_);
masterStats->setSqlErrorCode(0);
masterStats->setStmtState(STMT_EXECUTE_);
@@ -5336,7 +4345,7 @@ RETCODE Statement::doOltExecute(CliGlobals *cliGlobals,
if (root_tdb->aqrEnabled())
{
// return error. AQR will handle recompile and retry.
- return(ERROR);
+ return(ERROR);
}
else
{
@@ -5385,7 +4394,20 @@ RETCODE Statement::doOltExecute(CliGlobals *cliGlobals,
statsArea->restoreDop();
}
}
-
+
+ // do similarity check
+ if (root_tdb && root_tdb->querySimilarityInfo())
+ {
+ NABoolean simCheckFailed = FALSE;
+ retcode =
+ doQuerySimilarityCheck(root_tdb->querySimilarityInfo(),
+ simCheckFailed, diagsArea);
+
+ if (retcode == ERROR)
+ {
+ return ERROR;
+ }
+ }
ComDiagsArea* diagsPtr = NULL;
if (! fixupState()) // first time
@@ -5406,55 +4428,6 @@ RETCODE Statement::doOltExecute(CliGlobals *cliGlobals,
setFixupState(0);
- // move resolved names from LateNameInfoList to
- // ResolvedNameList which will be shipped to PA's
- if (root_tdb->getLateNameInfoList())
- {
- ResolvedNameList *&rnl =
- statementGlobals_->resolvedNameList();
- if (rnl && (rnl->numEntries() < root_tdb->getLateNameInfoList()->getNumEntries()))
- {
- // deallocate the previously allocated rnl
- heap_.deallocateMemory(rnl);
- rnl = NULL;
- }
-
- if (! rnl)
- rnl =
- (ResolvedNameList *)
- (new(&heap_)
- char[sizeof(ResolvedNameList) +
- ((root_tdb->getLateNameInfoList()->
- getNumEntries() > 0 ) ?
- ((root_tdb->getLateNameInfoList()->
- getNumEntries() - 1) * sizeof(ResolvedName)):
- 0)]);
-
- rnl->numEntries() =
- root_tdb->getLateNameInfoList()->getNumEntries();
- rnl->resetFlags();
-
- for (UInt32 i = 0;
- i < root_tdb->getLateNameInfoList()->getNumEntries();
- i++)
- {
- strcpy(rnl->getResolvedName((Int32) i).resolvedGuardianName(),
- root_tdb->getLateNameInfoList()->
- getLateNameInfo((Int32) i).resolvedPhyName());
-
- short ignore = (short) root_tdb->getLateNameInfoList()->
- getLateNameInfo((Int32) i).ignoreTS();
-
- rnl->getResolvedName((Int32) i).setIgnoreTS(ignore);
-
-#pragma nowarn(1506) // warning elimination
- rnl->getResolvedName(i).setResolvedAnsiName(
- root_tdb->getLateNameInfoList()->
- getLateNameInfo(i).getLastUsedName(&heap_)->getExternalName());
-#pragma warn(1506) // warning elimination
- }
- }
-
if (processDp2Xns)
{
implicitTransNeeded();
@@ -6705,55 +5678,6 @@ short Statement::rollbackTransaction(ComDiagsArea & diagsArea,
return 0;
}
-
-RETCODE Statement::doVisibilityCheck (LateNameInfoList * lnil,
- ComDiagsArea &diagsArea)
-{
- RETCODE retcode = SUCCESS;
-
- // Visibility Checks disabled for (10-081016-6563)
- //
- const NABoolean disableVisCheck = TRUE;
-
- if(disableVisCheck)
- return retcode;
-
- for (Int32 l = 0; l < (Int32) (lnil->getNumEntries()); l++)
- {
- LateNameInfo * lni = &(lnil->getLateNameInfo(l));
- if ( !lni->isAnsiPhySame() // the name is not a physical name
- && !lni->isAnsiNameChange() // has not been resolved via catman call
- && !lni->isView() ) // vis checks for views done elsewhere
- {
- retcode = checkObjectVisibility(lni->getLastUsedName(&heap_),
- lni->getNameSpace(),
- lni->resolvedPhyName(),
- diagsArea);
- if (retcode != SUCCESS )
- break;
- }
- }
-
- if (retcode == WARNING)
- {
- // Catalog is visible on local node, but either not visible or
- // unrelated on remote node. Force name mapping.
- retcode = forceMapAllNames (lnil, diagsArea);
- // Return WARNING so that the caller can force similarity check
- if (retcode != ERROR)
- retcode = WARNING;
- }
- return retcode;
-}
-
-RETCODE Statement::checkObjectVisibility( AnsiOrNskName *ansiName,
- const ComAnsiNameSpace nameSpace,
- char *guardianName,
- ComDiagsArea &diagsArea)
-{
- return ERROR;
-}
-
static
const NAWchar* get_name_mode(Lng32 name_mode)
{
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/cli/Statement.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/Statement.h b/core/sql/cli/Statement.h
index 3b354bc..8babe27 100644
--- a/core/sql/cli/Statement.h
+++ b/core/sql/cli/Statement.h
@@ -452,17 +452,6 @@ private:
ex_root_tdb *assignRootTdb(ex_root_tdb *new_root_tdb);
-
- RETCODE getMatchingIndex(Queue * indexInfoList,
- char * indexAnsiName,
- char * indexPhyName,
- ComDiagsArea &diagsArea);
- RETCODE doVisibilityCheck (LateNameInfoList * lnil,
- ComDiagsArea &diagsArea);
- RETCODE checkObjectVisibility( AnsiOrNskName *ansiName,
- const ComAnsiNameSpace nameSpace,
- char *guardianName,
- ComDiagsArea &diagsArea);
NABoolean implicitTransNeeded(void);
void turnOffAutoCommit(void);
void resetAutoCommit(void);
@@ -550,33 +539,12 @@ public:
RETCODE getProxySyntax(char *proxy, Lng32 maxlength, Lng32 *spaceRequired,
const char *prefix, const char *suffix);
- RETCODE resolveNames(LateNameInfoList * lnil,
- Descriptor * input_desc,
- ComDiagsArea &diagsArea,
- NABoolean &doSimCheck,
- NABoolean &doFixup);
-
- RETCODE mapAnsiToGuaName(LateNameInfo * lni,
- ComDiagsArea &diagsArea);
-
- RETCODE forceMapAllNames(LateNameInfoList * lnil,
- ComDiagsArea &diagsArea);
-
- RETCODE doSimilarityCheck(SimilarityInfo * si,
- LateNameInfo * lni,
- char * guaName,
- NABoolean &simCheckFailed,
- ComDiagsArea &diagsArea);
-
- RETCODE doIUDSimilarityCheck(SimilarityInfo * si,
- LateNameInfo * lni,
- char * guaName,
- Queue * indexInfoList,
- NABoolean &simCheckFailed,
- ComDiagsArea &diagsArea);
-
- RETCODE doQuerySimilarityCheck(QuerySimilarityInfo * qsi,
- LateNameInfoList * lnil,
+ RETCODE doHiveTableSimCheck(TrafSimilarityTableInfo *si,
+ void* lobGlob,
+ NABoolean &simCheckFailed,
+ ComDiagsArea &diagsArea);
+
+ RETCODE doQuerySimilarityCheck(TrafQuerySimilarityInfo * qsi,
NABoolean &simCheckFailed,
ComDiagsArea &diagsArea);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/comexe/CmpMessage.cpp
----------------------------------------------------------------------
diff --git a/core/sql/comexe/CmpMessage.cpp b/core/sql/comexe/CmpMessage.cpp
index a375b36..38d7a19 100644
--- a/core/sql/comexe/CmpMessage.cpp
+++ b/core/sql/comexe/CmpMessage.cpp
@@ -261,15 +261,12 @@ void CmpMessageReplyBasic::unpackMyself(IpcMessageObjType objType,
CmpCompileInfo::CmpCompileInfo(char * sourceStr, Lng32 sourceStrLen,
Lng32 sourceStrCharSet,
- RecompLateNameInfoList * recompLateNameInfoList,
- Lng32 rlnilLen,
char * schemaName, Lng32 schemaNameLen,
char * recompControlInfo, Lng32 recompControlInfoLen,
ULng32 inputArrayMaxsize, short atomicity)
: flags_(0),
sqltext_(sourceStr), sqlTextLen_(sourceStrLen),
sqlTextCharSet_(sourceStrCharSet),
- rlnil_(recompLateNameInfoList), rlnilLen_(rlnilLen),
schemaName_(schemaName), schemaNameLen_(schemaNameLen),
recompControlInfo_(recompControlInfo), recompControlInfoLen_(recompControlInfoLen),
inputArrayMaxsize_(inputArrayMaxsize)
@@ -292,8 +289,6 @@ CmpCompileInfo::CmpCompileInfo()
sqltext_(NULL),
sqlTextLen_(0),
sqlTextCharSet_(0),
- rlnil_(NULL),
- rlnilLen_(0),
schemaName_(NULL),
schemaNameLen_(0),
recompControlInfo_(NULL),
@@ -309,8 +304,6 @@ void CmpCompileInfo::init()
sqltext_ = NULL;
sqlTextLen_ = 0;
sqlTextCharSet_ = 0;
- rlnil_ = NULL;
- rlnilLen_ = 0;
schemaName_ = NULL;
schemaNameLen_ = 0;
recompControlInfo_ = NULL;
@@ -328,7 +321,7 @@ Lng32 CmpCompileInfo::getLength()
Lng32 CmpCompileInfo::getVarLength()
{
return ROUND8(sqlTextLen_) +
- ROUND8(rlnilLen_) + ROUND8(schemaNameLen_)
+ ROUND8(schemaNameLen_)
+ ROUND8(recompControlInfoLen_);
}
@@ -342,13 +335,6 @@ void CmpCompileInfo::packVars(char * buffer, CmpCompileInfo *ci,
nextOffset += ROUND8(sqlTextLen_);
}
- if (rlnil_ && (rlnilLen_ > 0))
- {
- str_cpy_all(&buffer[nextOffset], (char *)rlnil_, rlnilLen_);
- ci->rlnil_ = (RecompLateNameInfoList *)nextOffset;
- nextOffset += ROUND8(rlnilLen_);
- }
-
if (schemaName_ && (schemaNameLen_ > 0))
{
str_cpy_all(&buffer[nextOffset], (char *)schemaName_, schemaNameLen_);
@@ -384,11 +370,6 @@ void CmpCompileInfo::unpack(char * base)
sqltext_ = base + (Lng32)((Long)sqltext_);
}
- if (rlnil_)
- {
- rlnil_ = (RecompLateNameInfoList *)(base + (Lng32)(Long)rlnil_);
- }
-
if (schemaName_)
{
schemaName_ = base + (Lng32)(Long)schemaName_;
@@ -401,7 +382,6 @@ void CmpCompileInfo::unpack(char * base)
}
void CmpCompileInfo::getUnpackedFields(char* &sqltext,
- RecompLateNameInfoList* &rlnil,
char* &schemaName,
char* &recompControlInfo)
{
@@ -412,11 +392,6 @@ void CmpCompileInfo::getUnpackedFields(char* &sqltext,
sqltext = base + (Lng32)(Long)sqltext_;
}
- if (rlnil_)
- {
- rlnil = (RecompLateNameInfoList *)(base + (Lng32)(Long)rlnil_);
- }
-
if (schemaName_)
{
schemaName = base + (Lng32)(Long)schemaName_;
@@ -474,7 +449,6 @@ CmpDDLwithStatusInfo::CmpDDLwithStatusInfo(char * sourceStr, Lng32 sourceStrLen,
char * schemaName, Lng32 schemaNameLen,
char * recompControlInfo, Lng32 recompControlInfoLen)
: CmpCompileInfo(sourceStr, sourceStrLen, sourceStrCharSet,
- NULL, 0,
schemaName, schemaNameLen,
recompControlInfo, recompControlInfoLen,
0, 0)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/comexe/CmpMessage.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/CmpMessage.h b/core/sql/comexe/CmpMessage.h
index 5e284f3..8b5037d 100644
--- a/core/sql/comexe/CmpMessage.h
+++ b/core/sql/comexe/CmpMessage.h
@@ -64,7 +64,6 @@ class CmpMessageCompileStmt;
class ex_expr;
class sql_buffer;
-class RecompLateNameInfoList;
class FragmentDir;
// -----------------------------------------------------------------------
@@ -310,8 +309,6 @@ class CmpCompileInfo
public:
CmpCompileInfo(char * sourceStr, Lng32 sourceStrLen,
Lng32 sourceStrCharSet,
- RecompLateNameInfoList * recompLateNameInfoList,
- Lng32 rlnilLen,
char * schemaName, Lng32 schemaNameLen,
char * recompControlInfo, Lng32 recompControlInfoLen,
ULng32 inputArrayMaxsize,
@@ -329,7 +326,6 @@ public:
void unpack(char * base);
void getUnpackedFields(char* &sqltext,
- RecompLateNameInfoList* &rlnil,
char* &schemaName,
char* &recompControlInfo);
@@ -419,8 +415,7 @@ protected:
char * sqltext_; // 00-03
Lng32 sqlTextLen_; // 04-07
- RecompLateNameInfoList * rlnil_; // 08-11
- Lng32 rlnilLen_; // 12-15
+ Lng32 unused_; // 12-15
char * schemaName_; // 16-19
Lng32 schemaNameLen_; // 20-23
ULng32 inputArrayMaxsize_; // 24-27
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/comexe/ComTdbRoot.cpp
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbRoot.cpp b/core/sql/comexe/ComTdbRoot.cpp
index b66e19d..511e991 100644
--- a/core/sql/comexe/ComTdbRoot.cpp
+++ b/core/sql/comexe/ComTdbRoot.cpp
@@ -100,7 +100,7 @@ void ComTdbRoot::init(ComTdb * child_tdb,
SqlTableOpenInfo **stoiList,
LateNameInfoList * lateNameInfoList,
Queue *viewStoiList,
- QuerySimilarityInfo * qsi,
+ TrafQuerySimilarityInfo * qsi,
Space *space,
Lng32 uniqueExecuteIdOffset, // ++Triggers -
Lng32 triggersStatusOffset,
@@ -542,6 +542,13 @@ void ComTdbRoot::displayContents(Space * space,ULng32 flag)
space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
}
+ if (querySimilarityInfo() && querySimilarityInfo()->siList())
+ {
+ str_sprintf(buf,"querySimilarityInfo()->siList()->numEntries() = %d ",
+ querySimilarityInfo()->siList()->entries());
+ space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
+ }
+
Lng32 fragOffset;
Lng32 fragLen;
Lng32 topNodeOffset;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/comexe/ComTdbRoot.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbRoot.h b/core/sql/comexe/ComTdbRoot.h
index f7662fe..3f3b6ce 100644
--- a/core/sql/comexe/ComTdbRoot.h
+++ b/core/sql/comexe/ComTdbRoot.h
@@ -51,7 +51,7 @@ class Descriptor;
class TransMode;
class ExFragDir;
class LateNameInfoList;
-class QuerySimilarityInfo;
+class TragQuerySimilarityInfo;
class Queue;
typedef NABasicPtrTempl<Int64> Int64Ptr; // Needed for triggersList_
@@ -456,8 +456,7 @@ protected:
LateNameInfoListPtr lateNameInfoList_; // 120-127
// contains info used to perform similarity info at runtime.
- QuerySimilarityInfoPtr qsi_; // 128-135
-
+ TrafQuerySimilarityInfoPtr qsi_; // 128-135
// contains the name of the cursor
NABasicPtr fetchedCursorName_; // 136-143
@@ -659,7 +658,7 @@ public:
SqlTableOpenInfo **stoiList,
LateNameInfoList * lateNameInfoList,
Queue *viewStoiList,
- QuerySimilarityInfo * qsi,
+ TrafQuerySimilarityInfo * qsi,
Space *space,
Lng32 uniqueExecuteIdOffset, //++Triggers -
Lng32 triggersStatusOffset,
@@ -863,7 +862,7 @@ public:
Queue* getViewStoiList() {return viewStoiList_; }
- QuerySimilarityInfo * querySimilarityInfo() { return qsi_; };
+ TrafQuerySimilarityInfo * querySimilarityInfo() { return qsi_; };
UninitializedMvName * uninitializedMvList() { return uninitializedMvList_; }
short uninitializedMvCount() { return uninitializedMvCount_; }
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/074428ed/core/sql/comexe/LateBindInfo.cpp
----------------------------------------------------------------------
diff --git a/core/sql/comexe/LateBindInfo.cpp b/core/sql/comexe/LateBindInfo.cpp
index 0422c7b..8574ea1 100644
--- a/core/sql/comexe/LateBindInfo.cpp
+++ b/core/sql/comexe/LateBindInfo.cpp
@@ -194,55 +194,6 @@ static void extractPartsLocal(char * invalue, char *inVal[], short inValLen[])
}
-NABoolean LateNameInfo::applyMPAliasDefaults(char * invalue,
- char * outvalue,
- char * defValString)
-{
-
- char * defVal[3] = {NULL, NULL, NULL};
- short defValLen[3] = {0, 0, 0};
- char * inVal[3] = {NULL, NULL, NULL};
- short inValLen[3] = {0, 0, 0};
-
- // extract cat and schema name from defValString
- extractPartsLocal(defValString, defVal, defValLen);
-
- // extract parts from invalue
- extractPartsLocal(invalue, inVal, inValLen);
-
- // fill in the missing parts of invalue and create outvalue
- Int32 outlen=0;
- if (inVal[0] == NULL)
- {
- outlen = defValLen[0] + 1;
- str_cpy_all(outvalue, defVal[0], outlen);
- }
- else
- {
- outlen = inValLen[0] + 1;
- str_cpy_all(outvalue, inVal[0], outlen);
- }
-
- if (inVal[1] == NULL)
- {
- str_cpy_all(&outvalue[outlen], defVal[1], defValLen[1]+1);
- outlen += defValLen[1]+1;
- }
- else
- {
- str_cpy_all(&outvalue[outlen], inVal[1], inValLen[1]+1);
- outlen += inValLen[1]+1;
- }
-
- str_cpy_all(&outvalue[outlen], inVal[2], inValLen[2]);
- outlen += inValLen[2];
-
- outvalue[outlen] = 0;
-
- return TRUE;
-}
-// LCOV_EXCL_STOP
-
Long LateNameInfoList::pack(void *space)
{
#pragma nowarn(1506) // warning elimination
@@ -259,227 +210,6 @@ Lng32 LateNameInfoList::unpack(void * base, void * reallocator)
return NAVersionedObject::unpack(base, reallocator);
}
-// returns the length of total info that needs to be sent to compiler
-// at recomp time. This info is used to get to the actual tablename
-// (and not the prototype name) that was specified thru a hvar/param/env
-// var.
-ULng32 LateNameInfoList::getRecompLateNameInfoListLen()
-{
- ULng32 numEntriesToSend = 0;
- for (ULng32 i = 0; i < getNumEntries(); i++)
- {
- if (lateNameInfo_[i]->isVariable())
- numEntriesToSend++;
- }
-
- if (numEntriesToSend > 0)
- return sizeof(RecompLateNameInfoList) +
- ((numEntriesToSend-1) * sizeof(RecompLateNameInfo));
- else
- return 0;
-}
-
-// puts recomp info into 'buffer'. Space is to be allocated by caller.
-void LateNameInfoList::getRecompLateNameInfoList(char * buffer)
-{
- RecompLateNameInfoList * rlnil = (RecompLateNameInfoList *)buffer;
-
- Int32 j = 0;
- for (UInt32 i = 0; i < getNumEntries(); i++)
- {
- if (lateNameInfo_[i]->isVariable())
- {
- str_cpy_and_null(rlnil->getRecompLateNameInfo(j).varName(),
- lateNameInfo_[i]->variableName(),
- str_len(lateNameInfo_[i]->variableName()) + 1);
-
- str_cpy_and_null(rlnil->getRecompLateNameInfo(j).compileTimeAnsiName(),
- lateNameInfo_[i]->compileTimeAnsiName(),
- str_len(lateNameInfo_[i]->compileTimeAnsiName())+1);
-
- str_cpy_and_null(rlnil->getRecompLateNameInfo(j).actualAnsiName(),
- lateNameInfo_[i]->lastUsedExtAnsiName(),
- str_len(lateNameInfo_[i]->lastUsedExtAnsiName())+1);
-
-#pragma nowarn(1506) // warning elimination
- rlnil->getRecompLateNameInfo(j).setMPalias(lateNameInfo_[i]->isMPalias());
-#pragma warn(1506) // warning elimination
-
- j++;
- } // if
-
- } // for
-
- if (j > 0)
- rlnil->numEntries() = j;
-}
-
-ULng32 LateNameInfoList::getRecompLateNameInfoListLenPre1800()
-{
- ULng32 numEntriesToSend = 0;
- for (ULng32 i = 0; i < getNumEntries(); i++)
- {
- if (lateNameInfo_[i]->isVariable())
- numEntriesToSend++;
- }
-
- if (numEntriesToSend > 0)
- return sizeof(RecompLateNameInfoListPre1800) +
- ((numEntriesToSend-1) * sizeof(RecompLateNameInfoPre1800));
- else
- return 0;
-}
-
-
-// puts recomp info into 'buffer'. Space is to be allocated by caller.
-void LateNameInfoList::getRecompLateNameInfoListPre1800(char * buffer)
-{
- RecompLateNameInfoListPre1800 * rlnil = (RecompLateNameInfoListPre1800 *)buffer;
-
- Int32 j = 0;
- for (UInt32 i = 0; i < getNumEntries(); i++)
- {
- if (lateNameInfo_[i]->isVariable())
- {
- str_cpy_and_null(rlnil->getRecompLateNameInfo(j).varName(),
- lateNameInfo_[i]->variableName(),
- str_len(lateNameInfo_[i]->variableName()) + 1);
-
- str_cpy_and_null(rlnil->getRecompLateNameInfo(j).compileTimeAnsiName(),
- lateNameInfo_[i]->compileTimeAnsiName(),
- str_len(lateNameInfo_[i]->compileTimeAnsiName())+1);
-
-
- str_cpy_and_null(rlnil->getRecompLateNameInfo(j).actualAnsiName(),
- lateNameInfo_[i]->lastUsedExtAnsiName(),
- str_len(lateNameInfo_[i]->lastUsedExtAnsiName())+1);
-
-#pragma nowarn(1506) // warning elimination
- rlnil->getRecompLateNameInfo(j).setMPalias(lateNameInfo_[i]->isMPalias());
-#pragma warn(1506) // warning elimination
-
- j++;
- } // if
-
- } // for
-
- if (j > 0)
- rlnil->numEntries() = j;
-}
-
-
-void LateNameInfoList::resetRuntimeFlags()
-{
- for (UInt32 i = 0; i < getNumEntries(); i++)
- {
- lateNameInfo_[i]->resetRuntimeFlags();
- }
-}
-
-
-
-SimilarityTableInfo::SimilarityTableInfo()
- : NAVersionedObject(-1)
-{
- flags_ = 0;
-}
-
-SimilarityTableInfo::~SimilarityTableInfo()
-{
-}
-
-Long SimilarityTableInfo::pack(void * space)
-{
- return NAVersionedObject::pack(space);
-}
-
-Lng32 SimilarityTableInfo::unpack(void * base, void * reallocator)
-{
- return 0;
-}
-
-SimilarityInfo::SimilarityInfo(CollHeap * heap)
- : NAVersionedObject(-1)
-{
- tupleDesc_ = 0;
- colNameList_ = 0;
- sti_ = 0;
- runtimeFlags_ = 0;
- compiletimeFlags_ = 0;
- mvAttributesBitmap_ = 0;
-
-}
-
-SimilarityInfo::~SimilarityInfo()
-{
-}
-
-Long SimilarityInfo::pack(void * space)
-{
- return NAVersionedObject::pack(space);
-}
-
-Lng32 SimilarityInfo::unpack(void * base, void * reallocator)
-{
- // ------------------------------------------------------------------------
- // Notice that objects referenced by keyClass_ and indexMapArray_ have been
- // packed based on a different base (see SimilarityInfo::pack()). Hence,
- // they have to be unpacked correspondingly.
- // ------------------------------------------------------------------------
- if(tupleDesc_.unpack(base, reallocator)) return -1;
- if(colNameList_.unpack(base, reallocator)) return -1;
- if(sti_.unpack(base, reallocator)) return -1;
- return NAVersionedObject::unpack(base, reallocator);
-}
-
-QuerySimilarityInfo::QuerySimilarityInfo()
- : heap_(NULL), option_(RECOMP_ON_TS_MISMATCH), NAVersionedObject(-1), siList_(NULL),
- indexInfoList_(NULL)
-{
-}
-
-QuerySimilarityInfo::QuerySimilarityInfo(CollHeap * heap)
- : heap_(heap), option_(RECOMP_ON_TS_MISMATCH), NAVersionedObject(-1)
-{
- siList_ = new(heap) Queue(heap);
- indexInfoList_ = 0;
-}
-
-QuerySimilarityInfo::~QuerySimilarityInfo()
-{
-
-}
-
-Long QuerySimilarityInfo::pack(void * space)
-{
- PackQueueOfNAVersionedObjects(siList_,space,SimilarityInfo);
-
- //PackQueueOfNonNAVersionedObjects(indexInfoList_,space,IndexInfo);
- PackQueueOfNAVersionedObjects(indexInfoList_,space,IndexInfo);
-
- return NAVersionedObject::pack(space);
-}
-
-Lng32 QuerySimilarityInfo::unpack(void * base, void * reallocator)
-{
- UnpackQueueOfNAVersionedObjects(siList_,base,SimilarityInfo,reallocator);
-
- //UnpackQueueOfNonNAVersionedObjects(indexInfoList_,base,IndexInfo);
- UnpackQueueOfNAVersionedObjects(indexInfoList_,base,IndexInfo,reallocator);
-
- return NAVersionedObject::unpack(base, reallocator);
-}
-
-Long IndexInfo::pack(void * space)
-{
- return NAVersionedObject::pack(space);
-}
-
-Lng32 IndexInfo::unpack(void * base, void * reallocator)
-{
- return NAVersionedObject::unpack(base, reallocator);
-}
-
AnsiOrNskName::AnsiOrNskName(char *inName)
{
Int32 len;
@@ -1319,37 +1049,102 @@ Int16 AnsiOrNskName::quoteNSKExtName()
return 0;
}
-void ResolvedNameListPre1800::translateFromNewVersion(ResolvedNameList *newrnl)
+///////////////////////////////////////////////////////////////////
+// class TrafSimilarityTableInfo
+///////////////////////////////////////////////////////////////////
+TrafSimilarityTableInfo::TrafSimilarityTableInfo(char * tableName,
+ NABoolean isHive,
+ char * hdfsRootDir,
+ Int64 modTS, Int32 numPartnLevels,
+ Queue * hdfsDirsToCheck,
+ char * hdfsHostName,
+ Int32 hdfsPort)
+ : NAVersionedObject(-1),
+ tableName_(tableName),
+ hdfsRootDir_(hdfsRootDir),
+ modTS_(modTS), numPartnLevels_(numPartnLevels),
+ hdfsDirsToCheck_(hdfsDirsToCheck),
+ hdfsHostName_(hdfsHostName), hdfsPort_(hdfsPort)
{
- this->numEntries()= newrnl->numEntries();
- this->resetFlags();
- for (Int32 i = 0; i < (Int32) (newrnl->numEntries());i++)
- {
- strcpy(this->getResolvedName(i).resolvedGuardianName(),
- newrnl->getResolvedName(i).resolvedGuardianName());
-
- this->getResolvedName(i).setIgnoreTS((short)newrnl->getResolvedName(i).ignoreTS());
- this->getResolvedName(i).setResolvedAnsiName(newrnl->getResolvedName(i).resolvedAnsiName());
- this->getResolvedName(i).setValidateNumIndexes((short)newrnl->getResolvedName(i).validateNumIndexes());
- this->getResolvedName(i).setNumIndexes(newrnl->getResolvedName(i).numIndexes());
- }
+ if (isHive)
+ setIsHive(TRUE);
}
-void ResolvedNameList::translateFromOldVersion(ResolvedNameListPre1800 *oldrnl)
+TrafSimilarityTableInfo::TrafSimilarityTableInfo()
+ : NAVersionedObject(-1),
+ tableName_(NULL),
+ hdfsRootDir_(NULL),
+ modTS_(-1), numPartnLevels_(-1),
+ hdfsDirsToCheck_(NULL),
+ hdfsHostName_(NULL), hdfsPort_(NULL)
{
- this->numEntries() = oldrnl->numEntries();
- this->resetFlags();
- this->resetFiller();
- for (Int32 i = 0; i < (Int32) (oldrnl->numEntries());i++)
- {
- strcpy(this->getResolvedName(i).resolvedGuardianName(),
- oldrnl->getResolvedName(i).resolvedGuardianName());
-
- this->getResolvedName(i).setIgnoreTS((short)oldrnl->getResolvedName(i).ignoreTS());
- this->getResolvedName(i).setResolvedAnsiName(oldrnl->getResolvedName(i).resolvedAnsiName());
- this->getResolvedName(i).setValidateNumIndexes((short)oldrnl->getResolvedName(i).validateNumIndexes());
- this->getResolvedName(i).setNumIndexes(oldrnl->getResolvedName(i).numIndexes());
- }
- }
+}
+
+TrafSimilarityTableInfo::~TrafSimilarityTableInfo()
+{
+}
+
+NABoolean TrafSimilarityTableInfo::operator==(TrafSimilarityTableInfo &o)
+{
+ return ((isHive() == o.isHive()) &&
+ (strcmp(tableName(), ((TrafSimilarityTableInfo&)o).tableName()) == 0));
+}
+
+Long TrafSimilarityTableInfo::pack(void * space)
+{
+ tableName_.pack(space);
+ hdfsRootDir_.pack(space);
+ hdfsHostName_.pack(space);
+
+ hdfsDirsToCheck_.pack(space);
+
+ return NAVersionedObject::pack(space);
+}
+
+Lng32 TrafSimilarityTableInfo::unpack(void * base, void * reallocator)
+{
+ if(tableName_.unpack(base)) return -1;
+ if(hdfsRootDir_.unpack(base)) return -1;
+ if(hdfsHostName_.unpack(base)) return -1;
+
+ if(hdfsDirsToCheck_.unpack(base, reallocator)) return -1;
+
+ return NAVersionedObject::unpack(base, reallocator);
+}
+
+///////////////////////////////////////////////////////////////////
+// class TrafQuerySimilarityInfo
+///////////////////////////////////////////////////////////////////
+TrafQuerySimilarityInfo::TrafQuerySimilarityInfo(Queue * siList)
+ : NAVersionedObject(-1),
+ siList_(siList)
+{
+}
+
+TrafQuerySimilarityInfo::TrafQuerySimilarityInfo()
+ : NAVersionedObject(-1),
+ siList_(NULL)
+{
+}
+
+TrafQuerySimilarityInfo::~TrafQuerySimilarityInfo()
+{
+}
+
+Long TrafQuerySimilarityInfo::pack(void * space)
+{
+ PackQueueOfNAVersionedObjects(siList_,space,TrafSimilarityTableInfo);
+
+ return NAVersionedObject::pack(space);
+}
+
+Lng32 TrafQuerySimilarityInfo::unpack(void * base, void * reallocator)
+{
+ UnpackQueueOfNAVersionedObjects(siList_,base,TrafSimilarityTableInfo,reallocator);
+
+ return NAVersionedObject::unpack(base, reallocator);
+}
+
+
// End
[7/8] incubator-trafodion git commit: changes based on review comments
Posted by an...@apache.org.
changes based on review comments
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/72487258
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/72487258
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/72487258
Branch: refs/heads/master
Commit: 72487258a9cffea46b41499853bb028773d41b9e
Parents: a164c4b
Author: Anoop Sharma <an...@esgyn.com>
Authored: Fri Oct 7 19:54:07 2016 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Fri Oct 7 19:54:07 2016 +0000
----------------------------------------------------------------------
core/sql/cli/Statement.cpp | 3 +--
core/sql/comexe/CmpMessage.h | 25 +++++++++++++------------
core/sql/comexe/LateBindInfo.cpp | 6 ++++--
3 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72487258/core/sql/cli/Statement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Statement.cpp b/core/sql/cli/Statement.cpp
index 910a473..93a03cb 100644
--- a/core/sql/cli/Statement.cpp
+++ b/core/sql/cli/Statement.cpp
@@ -2108,7 +2108,7 @@ RETCODE Statement::doHiveTableSimCheck(TrafSimilarityTableInfo *si,
if (retcode == 1) // check failed
{
- char errStr[200];
+ char errStr[2000];
str_sprintf(errStr, "compiledModTS = %Ld, failedModTS = %Ld, failedLoc = %s",
si->modTS(), failedModTS,
(failedLocBufLen > 0 ? failedLocBuf : si->hdfsRootDir()));
@@ -3396,7 +3396,6 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
case RE_EXECUTE_:
{
- // save lnil & stuff
// if input descriptor was passed in at execute time, recreate
// the input data
// Setting the boolean reExecute to true, will cause the
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72487258/core/sql/comexe/CmpMessage.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/CmpMessage.h b/core/sql/comexe/CmpMessage.h
index 8b5037d..7822fce 100644
--- a/core/sql/comexe/CmpMessage.h
+++ b/core/sql/comexe/CmpMessage.h
@@ -413,18 +413,19 @@ protected:
HBASE_DDL = 0x0800
};
- char * sqltext_; // 00-03
- Lng32 sqlTextLen_; // 04-07
- Lng32 unused_; // 12-15
- char * schemaName_; // 16-19
- Lng32 schemaNameLen_; // 20-23
- ULng32 inputArrayMaxsize_; // 24-27
- ULng32 flags_; // 28-31
-
- char * recompControlInfo_; // 32-35
- Lng32 recompControlInfoLen_; // 36-39
- Lng32 sqlTextCharSet_; // 40-43
- char fillerBytes_[FILLERSIZE]; // 44-99
+ char * sqltext_; // 00-07
+ Lng32 sqlTextLen_; // 08-11
+ Lng32 unused_; // 12-15
+ char * schemaName_; // 16-23
+ Lng32 schemaNameLen_; // 24-27
+ Lng32 unused2_; // 28-31
+ ULng32 inputArrayMaxsize_; // 32-35
+ ULng32 flags_; // 36-39
+
+ char * recompControlInfo_; // 40-43
+ Lng32 recompControlInfoLen_; // 44-47
+ Lng32 sqlTextCharSet_; // 48-51
+ char fillerBytes_[FILLERSIZE]; // 52-107
};
#pragma warn(1506) // warning elimination
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72487258/core/sql/comexe/LateBindInfo.cpp
----------------------------------------------------------------------
diff --git a/core/sql/comexe/LateBindInfo.cpp b/core/sql/comexe/LateBindInfo.cpp
index 8574ea1..e96d75f 100644
--- a/core/sql/comexe/LateBindInfo.cpp
+++ b/core/sql/comexe/LateBindInfo.cpp
@@ -1064,7 +1064,8 @@ TrafSimilarityTableInfo::TrafSimilarityTableInfo(char * tableName,
hdfsRootDir_(hdfsRootDir),
modTS_(modTS), numPartnLevels_(numPartnLevels),
hdfsDirsToCheck_(hdfsDirsToCheck),
- hdfsHostName_(hdfsHostName), hdfsPort_(hdfsPort)
+ hdfsHostName_(hdfsHostName), hdfsPort_(hdfsPort),
+ flags_(0)
{
if (isHive)
setIsHive(TRUE);
@@ -1076,7 +1077,8 @@ TrafSimilarityTableInfo::TrafSimilarityTableInfo()
hdfsRootDir_(NULL),
modTS_(-1), numPartnLevels_(-1),
hdfsDirsToCheck_(NULL),
- hdfsHostName_(NULL), hdfsPort_(NULL)
+ hdfsHostName_(NULL), hdfsPort_(NULL),
+ flags_(0)
{
}
[4/8] incubator-trafodion git commit: Merge remote branch
'origin/master' into ansharma_simcheck_br
Posted by an...@apache.org.
Merge remote branch 'origin/master' into ansharma_simcheck_br
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/5eca1883
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/5eca1883
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/5eca1883
Branch: refs/heads/master
Commit: 5eca1883817ce0af756e976c6563250cdaa73979
Parents: 667cf65 6841be9
Author: Anoop Sharma <an...@esgyn.com>
Authored: Wed Oct 5 01:25:24 2016 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Wed Oct 5 01:25:24 2016 +0000
----------------------------------------------------------------------
core/sql/generator/GenRelUpdate.cpp | 150 ++-----------------
core/sql/optimizer/NormRelExpr.cpp | 29 ++--
core/sql/optimizer/RelExpr.cpp | 8 +
core/sql/optimizer/RelJoin.h | 2 +-
core/sql/optimizer/RelMisc.h | 1 +
core/sql/regress/compGeneral/EXPECTED011.SB | 22 ++-
core/sql/regress/seabase/EXPECTED020 | 23 +++
core/sql/regress/seabase/TEST020 | 10 ++
docs/src/site/markdown/index.md | 21 +--
docs/src/site/site.xml | 2 +-
install/installer/traf_cloudera_mods | 11 +-
.../phoenix/end2end/MultiCfQueryExecTest.java | 9 --
.../end2end/SaltedTableUpsertSelectTest.java | 2 +-
13 files changed, 95 insertions(+), 195 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5eca1883/core/sql/optimizer/RelMisc.h
----------------------------------------------------------------------
[8/8] incubator-trafodion git commit: Merge [TRAFODION-2263] PR-746
Similarity check changes
Posted by an...@apache.org.
Merge [TRAFODION-2263] PR-746 Similarity check changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/dd5ea5ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/dd5ea5ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/dd5ea5ae
Branch: refs/heads/master
Commit: dd5ea5ae8d9cf3c3fe2e7e6ac720734e900aa6f2
Parents: 5cd718a 7248725
Author: Anoop Sharma <an...@esgyn.com>
Authored: Fri Oct 7 23:05:19 2016 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Fri Oct 7 23:05:19 2016 +0000
----------------------------------------------------------------------
core/sql/arkcmp/CmpContext.cpp | 1 -
core/sql/arkcmp/CmpContext.h | 8 -
core/sql/arkcmp/CmpStatement.cpp | 5 +-
core/sql/cli/Cli.cpp | 110 +-
core/sql/cli/Cli.h | 16 -
core/sql/cli/CliExtern.cpp | 51 -
core/sql/cli/ExSqlComp.cpp | 8 +-
core/sql/cli/Statement.cpp | 1893 +++-------------------
core/sql/cli/Statement.h | 50 +-
core/sql/comexe/CmpMessage.cpp | 28 +-
core/sql/comexe/CmpMessage.h | 30 +-
core/sql/comexe/ComTdbRoot.cpp | 9 +-
core/sql/comexe/ComTdbRoot.h | 9 +-
core/sql/comexe/LateBindInfo.cpp | 393 ++---
core/sql/comexe/LateBindInfo.h | 679 +-------
core/sql/executor/ExExeUtilMisc.cpp | 5 +-
core/sql/executor/ExFastTransport.cpp | 13 +-
core/sql/executor/ExFastTransport.h | 4 +-
core/sql/executor/ExHdfsScan.cpp | 5 +-
core/sql/executor/Ex_esp_msg.h | 40 -
core/sql/executor/ex_control.cpp | 2 +-
core/sql/executor/ex_ddl.cpp | 3 -
core/sql/executor/ex_esp_frag_dir.cpp | 11 -
core/sql/executor/ex_esp_msg.cpp | 243 ---
core/sql/executor/ex_frag_rt.cpp | 33 -
core/sql/executor/ex_globals.cpp | 2 +
core/sql/exp/ExpLOBaccess.cpp | 119 +-
core/sql/exp/ExpLOBaccess.h | 14 +-
core/sql/exp/ExpLOBinterface.cpp | 31 +-
core/sql/exp/ExpLOBinterface.h | 9 +-
core/sql/generator/GenExplain.cpp | 2 +-
core/sql/generator/GenFastTransport.cpp | 25 +-
core/sql/generator/GenRelExeUtil.cpp | 7 +-
core/sql/generator/GenRelMisc.cpp | 102 +-
core/sql/generator/GenRelScan.cpp | 45 +-
core/sql/generator/Generator.cpp | 16 +
core/sql/generator/Generator.h | 10 +
core/sql/optimizer/RelExeUtil.h | 2 +-
core/sql/optimizer/RelMisc.h | 3 +-
core/sql/parser/SqlParserAux.cpp | 21 -
core/sql/parser/SqlParserAux.h | 4 -
core/sql/parser/sqlparser.y | 90 +-
core/sql/regress/tools/regress-filter-linux | 2 +-
core/sql/sqlcomp/DefaultConstants.h | 6 +-
core/sql/sqlcomp/nadefaults.cpp | 16 +-
45 files changed, 701 insertions(+), 3474 deletions(-)
----------------------------------------------------------------------
[5/8] incubator-trafodion git commit: jira TRAFODION-2263 Similarity
check changes and obsolete code removal.
Posted by an...@apache.org.
jira TRAFODION-2263 Similarity check changes and obsolete code removal.
-- similarity check for tables now done at root operator before start of
query execution. Done only for hive tables by detecting data
dir modification time change.
-- the older leaf data mod check is still available and
can be enabled by a cqd. This is temporary and will be removed
once the newer code has stabilized.
-- data mod mismatch now also returns the runtime dir which caused it.
-- removed obsolete code related to query recompilation from pre-AQR days
-- removed obsolete code related to runtime query execution in cli
-- removed obsolete code related to runtime table name resolution,
visibility checks and recompile late name list handling
-- removed other dead or ifdefd out code
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/3d41ee0f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/3d41ee0f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/3d41ee0f
Branch: refs/heads/master
Commit: 3d41ee0f0bfac5af8db1f485b5369787a382c97e
Parents: 5eca188
Author: Anoop Sharma <an...@esgyn.com>
Authored: Wed Oct 5 01:53:19 2016 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Wed Oct 5 01:53:19 2016 +0000
----------------------------------------------------------------------
core/sql/cli/Cli.cpp | 11 +-
core/sql/cli/Statement.cpp | 530 ++++++----------------------------------
core/sql/cli/Statement.h | 6 +-
3 files changed, 78 insertions(+), 469 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/3d41ee0f/core/sql/cli/Cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Cli.cpp b/core/sql/cli/Cli.cpp
index c57f650..9d79d90 100644
--- a/core/sql/cli/Cli.cpp
+++ b/core/sql/cli/Cli.cpp
@@ -3155,21 +3155,12 @@ Lng32 SQLCLI_PerformTasks(
// if we do have something to set... the output descriptor
// had better be available by the time we call local_SetDescPointers
//
- //LCOV_EXCL_START
if (!output_desc)
{
diags << DgSqlCode(-CLI_DESC_NOT_EXISTS);
return SQLCLI_ReturnCode(&currContext,-CLI_DESC_NOT_EXISTS);
}
- //LCOV_EXCL_STOP
- /*
-#ifdef NA_64BIT
- // dg64 - the old way won't compile on 64-bit
- va_list cpy;
- va_copy(cpy, ap);
- va_end(ap);
-#endif
-*/
+
retcode = local_SetDescPointers(output_desc, 1,
#ifdef NA_64BIT
// dg64 - the old way won't compile on 64-bit
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/3d41ee0f/core/sql/cli/Statement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Statement.cpp b/core/sql/cli/Statement.cpp
index c38cd0a..910a473 100644
--- a/core/sql/cli/Statement.cpp
+++ b/core/sql/cli/Statement.cpp
@@ -2469,18 +2469,11 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
switch (state_)
{
case INITIAL_STATE_: strcpy(buf, "INITIAL_STATE_"); break;
- case RESOLVE_NAMES_: strcpy(buf, "RESOLVE_NAMES_"); break;
case DO_SIM_CHECK_: strcpy(buf, "DO_SIM_CHECK_"); break;
- case RECOMPILE_: strcpy(buf, "RECOMPILE_"); break;
- case COMPILE_: strcpy(buf, "COMPILE_"); break;
- case CHECK_DYNAMIC_SETTINGS_:
- strcpy(buf, "CHECK_DYNAMIC_SETTINGS_");
- break;
+ case CHECK_DYNAMIC_SETTINGS_: strcpy(buf, "CHECK_DYNAMIC_SETTINGS_"); break;
case FIXUP_: strcpy(buf, "FIXUP_"); break;
case FIXUP_DONE_: strcpy(buf, "FIXUP_DONE_"); break;
case EXECUTE_: strcpy(buf, "EXECUTE_"); break;
- case RE_EXECUTE_: strcpy(buf, "RE_EXECUTE_"); break;
- case RE_EXECUTE_AFTER_RECOMPILE_: strcpy(buf, "RE_EXECUTE_AFTER_RECOMPILE_");
case ERROR_: strcpy(buf, "ERROR_"); break;
case ERROR_RETURN_: strcpy(buf, "ERROR_RETURN_"); break;
default: strcpy(buf, "Unknown state!"); break;
@@ -2637,12 +2630,7 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
break;
}
- state_ = COMPILE_;
- recompileReason[0] = SQL_EOF; // eof here means EMPTY
-
- //diagsArea << DgSqlCode(EXE_RECOMPILE) // a warning only
- // << DgInt0(recompileReason[0]);
-
+ state_ = ERROR_;
break;
}
else if ((root_tdb->transactionReqd() || root_tdb->isLRUOperation())
@@ -2659,22 +2647,11 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
}
else
{
- if (diagsArea.contains(-CLI_TRANS_MODE_MISMATCH))
- diagsArea.clear();
-
- state_ = COMPILE_;
- recompileReasonIsTransMode(
- root_tdb,
- context_->getTransaction(),
- recompileReason);
- diagsArea << DgSqlCode(recompileReason[0]) // a warning only
- << DgInt0(recompileReason[1])
- << DgInt1(recompileReason[2]);
+ state_ = ERROR_;
}
break;
}
-
if (root_tdb->inMemoryObjectDefn())
{
// trying to executed a query which refers to an inMemory
@@ -2685,7 +2662,6 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
break;
}
-
// if statistics were previously returned for this statement
// (could happen for multiple executions of the same prepared
// or an embedded static statement), then re-initizalize the stat
@@ -2733,7 +2709,6 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
{
retcode = ERROR;
state_ = ERROR_RETURN_;
- // readyToReturn = TRUE;
break;
}
}
@@ -2765,152 +2740,6 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
}
break;
- case COMPILE_:
- case RECOMPILE_:
- {
- ex_assert(0, " COMPILE_ and RECOMPILE_ are obsolete");
-
- // We want to ignore any errors that occur as part of dealloc
- // when called from here.
- // So, we mark the DiagsArea before making the call to dealloc(),
- // and then rewind
- // back to there afterwards.
- Lng32 oldDiagsAreaMark = diagsArea.mark();
- Lng32 oldGlobalDiagsAreaMark = 0;
- if (statementGlobals_->getDiagsArea())
- {
- oldGlobalDiagsAreaMark = statementGlobals_->getDiagsArea()->mark();
- }
-
- if (dealloc())
- {
- //Leave the diagsArea as it is in case of error during the dealloc().
- state_ = ERROR_;
- break;
- }
-
- // Rewind to ignore all errors that occurred during a successful dealloc()
- if (statementGlobals_->getDiagsArea())
- {
- statementGlobals_->getDiagsArea()->rewind(oldGlobalDiagsAreaMark, TRUE);
- }
- diagsArea.rewind(oldDiagsAreaMark, TRUE);
-
- Int64 startTime = 0;
- Int64 time = 0;
-
- Int32 transactionReqdPriorToRecompile = 0;
- NABoolean rootTdbExistsPriorToRecompile = TRUE;
-
- if (root_tdb)
- transactionReqdPriorToRecompile = root_tdb->transactionReqd();
- else
- rootTdbExistsPriorToRecompile = FALSE;
-
- if (root_tdb &&
- (root_tdb->getCollectStatsType() == ComTdb::MEASURE_STATS))
- startTime = NA_JulianTimestamp();
-
- // similarity check not to be done or failed. Recompile.
- // recompWarn = (root_tdb ? returnRecompWarn() : 0);
- ULng32 flags = PREPARE_RECOMP;
- if (isCloned())
- {
- ex_assert(clonedFrom_, "Invalid clonedFrom_ pointer");
- retcode = clonedFrom_->prepare(NULL, diagsArea, NULL, 0,
- SQLCHARSETCODE_ISO88591 /* this setting does not matter because source - the 1st param - is set to NULL */, TRUE,
- flags);
- }
- else
- {
- retcode = prepare(NULL, diagsArea, NULL, 0,
- SQLCHARSETCODE_ISO88591 /* this setting does not matter because source - the 1st param - is set to NULL */, TRUE,
- flags);
- }
-
- if ((retcode == ERROR) || (! root_tdb))
- {
- if (! diagsArea.contains(-CLI_STMT_NOT_PREPARED))
- diagsArea << DgSqlCode(- CLI_STMT_NOT_PREPARED);
-
- state_ = ERROR_;
- break;
- }
-
- // After a successful compile or recompile, we need to be
- // able to react to a subsequent availability error on the
- // new plan by calling runtime metadata lookups that are
- // guaranteed to return the name of an available partition
- // if one can be found. By resetting these local variables
- // we become able to do the lookups again if necessary. If
- // we do not reset these variables, then after a recompile
- // if we encounter an unavailable partition we might
- // return an error to the application immediately which is
- // not the right thing to do. Instead we may need to do the
- // lookups again and try to use an available partition.
- partitionUnavailable = FALSE;
- partitionAvailabilityChecked = FALSE;
-
- // The following stmt does not work since root_tdb changed after
- // prepare and the collectStatsType not setup correctly.
- if ((root_tdb->getCollectStatsType() == ComTdb::MEASURE_STATS) &&
- (startTime != 0))
- {
- time = NA_JulianTimestamp();
- reCompileTime = time - startTime;
-
- // update Measure sql process recompile counters.
- // Statement counters cannot be updated here since
- // stats area not allocated until fixup time.
- if (cliGlobals->getMeasProcCntrs() != NULL)
- {
- cliGlobals->getMeasProcCntrs()->incSqlStmtRecompiles(1);
- cliGlobals->getMeasProcCntrs()->incSqlStmtRecompileTime(reCompileTime);
- }
- };
-
- // if (!recompWarn)
- recompWarn = returnRecompWarn();
- if (recompWarn)
- {
- diagsArea << DgSqlCode(EXE_RECOMPILE) // a warning only
- ;
-
- }
-
- issuePlanVersioningWarnings (diagsArea);
- // For a cloned statement, the recomp was done on the original
- // statement, and warnings may be saved there too.
- if (isCloned())
- clonedFrom_->issuePlanVersioningWarnings (diagsArea);
-
- if (!transactionReqdPriorToRecompile &&
- rootTdbExistsPriorToRecompile &&
- root_tdb->transactionReqd())
- // If the statement is being recompiled, and did not need
- // a transaction before, but needs one now, start one,
- // after committing any implicit transaction started earlier
- // for visibility checking etc. This can only happen if the
- // table being accessed went from non-audited to audited.
- commitImplicitTransAndResetTmodes();
-
- // Start a transaction, if needed and one not already running.
- if (beginTransaction(diagsArea))
- {
- state_ = ERROR_;
- break;
- }
-
- // Indicate to subsequent states that we have prepared the query.
- donePrepare = TRUE;
-
- if (state_ == COMPILE_ )
- state_ = RESOLVE_NAMES_;
- else
- state_ = CHECK_DYNAMIC_SETTINGS_;
- }
- break;
-
case CHECK_DYNAMIC_SETTINGS_:
{
if (fixupState())
@@ -2992,19 +2821,7 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
if ((retcode == ERROR) ||
(partitionUnavailable && partitionAvailabilityChecked))
{
- // VO, Genesis solution 10-051125-2802:
- // We may have gotten a plan version error from ESP assignment
- if ( diagsArea.contains (-VERSION_COMPILER_VERSION_LOWER_THAN_OLDEST_SUPPORTED) ||
- diagsArea.contains (-VERSION_COMPILER_USED_TO_COMPILE_QUERY)
- )
- {
- // Get rid of these errors - recompile will re-issue if we have an
- // incurable incompatibility
- diagsArea.clear();
- state_ = RECOMPILE_;
- }
- else
- state_ = ERROR_;
+ state_ = ERROR_;
break;
}
@@ -3526,61 +3343,58 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
}
}
-
-
-
}
- // done deciding if this query needs to be monitored and
- // registered with WMS.
- // now execute it.
- if (masterStats != NULL)
- {
- masterStats->setIsBlocking();
- masterStats->setStmtState(STMT_EXECUTE_);
- }
- Int32 rc = root_tcb->execute(cliGlobals, statementGlobals_,
- input_desc, diagsPtr, reExecute);
-
- if (masterStats != NULL)
- masterStats->setNotBlocking();
- if (rc < 0)
- retcode = ERROR;
- // "diagsPtr" is modified by the foregoing call.
- // If "diagsPtr" is NULL, there are no diags to merge
- // into "diagsArea". Otherwise, "diagsPtr" is not NULL and does
- // point to a diags area from which we: 1) avoid the SQL function
- // 2) copy the ComCondition objects over. Then we decrement
- // the reference count to indicate we're done with that
- // ComDiagsArea.
+ // done deciding if this query needs to be monitored and
+ // registered with WMS.
+ // now execute it.
+ if (masterStats != NULL)
+ {
+ masterStats->setIsBlocking();
+ masterStats->setStmtState(STMT_EXECUTE_);
+ }
+
+ Int32 rc = root_tcb->execute(cliGlobals, statementGlobals_,
+ input_desc, diagsPtr, reExecute);
+
+ if (masterStats != NULL)
+ masterStats->setNotBlocking();
+ if (rc < 0)
+ retcode = ERROR;
+ // "diagsPtr" is modified by the foregoing call.
+ // If "diagsPtr" is NULL, there are no diags to merge
+ // into "diagsArea". Otherwise, "diagsPtr" is not NULL and does
+ // point to a diags area from which we: 1) avoid the SQL function
+ // 2) copy the ComCondition objects over. Then we decrement
+ // the reference count to indicate we're done with that
+ // ComDiagsArea.
- if (diagsPtr)
- {
- diagsArea.mergeAfter(*diagsPtr);
- diagsPtr->decrRefCount();
- diagsPtr = NULL;
- }
+ if (diagsPtr)
+ {
+ diagsArea.mergeAfter(*diagsPtr);
+ diagsPtr->decrRefCount();
+ diagsPtr = NULL;
+ }
- if (retcode == ERROR)
- {
- root_tcb->cancel(statementGlobals_,diagsPtr);
- state_ = ERROR_;
- break;
- }
- else
- {
- if (retcode == 0 && diagsArea.mainSQLCODE() > 0)
- // It's a warning. So return 1.
- retcode = (RETCODE)1;
- setState(OPEN_);
- readyToReturn = TRUE;
- break;
- }
- }
- break;
-
- case RE_EXECUTE_: // on error 60
- case RE_EXECUTE_AFTER_RECOMPILE_: // on plan version error
+ if (retcode == ERROR)
+ {
+ root_tcb->cancel(statementGlobals_,diagsPtr);
+ state_ = ERROR_;
+ break;
+ }
+ else
+ {
+ if (retcode == 0 && diagsArea.mainSQLCODE() > 0)
+ // It's a warning. So return 1.
+ retcode = (RETCODE)1;
+ setState(OPEN_);
+ readyToReturn = TRUE;
+ break;
+ }
+ }
+ break;
+
+ case RE_EXECUTE_:
{
// save lnil & stuff
// if input descriptor was passed in at execute time, recreate
@@ -3601,10 +3415,7 @@ RETCODE Statement::execute(CliGlobals * cliGlobals, Descriptor * input_desc,
setFixupState(0);
reExecute=TRUE;
- if (state_ == RE_EXECUTE_)
- state_ = CHECK_DYNAMIC_SETTINGS_;
- else
- state_ = RECOMPILE_;
+ state_ = CHECK_DYNAMIC_SETTINGS_;
}
break;
@@ -3706,17 +3517,6 @@ RETCODE Statement::fetch(CliGlobals * cliGlobals, Descriptor * output_desc,
}
timeout = -1 ;
-#ifdef NA_DEBUG_C_RUNTIME
- if (output_desc)
- {
- Lng32 outputRowsetSize = 0;
- output_desc->getDescItem(0, SQLDESC_ROWSET_SIZE, &outputRowsetSize,
- 0, 0, 0, 0);
- if (outputRowsetSize > 1)
- StmtDebug1(" Output rowset size: %d", outputRowsetSize);
- }
-#endif
-
// Check for suspended query. The other check called in the
// Scheduler::work. We do it here simply because some users
// expect if the query is suspended while the client is not
@@ -3771,7 +3571,7 @@ RETCODE Statement::fetch(CliGlobals * cliGlobals, Descriptor * output_desc,
}
}
-StmtDebug1(" root_tcb->fetch() returned %s",
+ StmtDebug1(" root_tcb->fetch() returned %s",
RetcodeToString((RETCODE) retcode));
}
@@ -3779,159 +3579,6 @@ StmtDebug1(" root_tcb->fetch() returned %s",
if (masterStats)
masterStats->setNotBlocking();
- Statement::ExecState execute_state;
- while ((retcode < 0) &&
- (diagsPtr != NULL) &&
- ( // Handle lost open by trying to close/reopen the table
- (diagsPtr->contains(-EXE_LOST_OPEN)) ||
- (diagsPtr->contains(-EXE_PARTITION_UNAVAILABLE)) ||
- // Handle plan versioning errors by trying to recompile the query
- (diagsPtr->contains(-VERSION_PLAN_VERSION_HIGHER_THAN_MXV)) ||
- (diagsPtr->contains(-VERSION_PLAN_VERSION_OLDER_THAN_OLDEST_SUPPORTED))
- )
- )
- {
-#ifdef NA_DEBUG_C_RUNTIME
- StmtDebug1(" stmt state %s", stmtState(getState()));
- if (diagsPtr)
- {
- if (diagsPtr->contains(-EXE_LOST_OPEN))
- StmtDebug0(" diags contains -EXE_LOST_OPEN");
- if (diagsPtr->contains(-EXE_PARTITION_UNAVAILABLE))
- StmtDebug0(" diags contains -EXE_PARTITION_UNAVAILABLE");
- }
- StmtDebug1(" this %s a retryable stmt",
- (root_tdb->retryableStmt() ? "IS" : "IS NOT"));
-#endif
-
- if (root_tdb->retryableStmt() && (getState() != FETCH_))
- {
- // A retryable statement in a retryable state
- short currentCompilerVersion = COM_VERS_UNKNOWN;
- short index;
- if ((diagsPtr->contains(-EXE_LOST_OPEN)) ||
- (diagsPtr->contains(-EXE_PARTITION_UNAVAILABLE)))
- execute_state = RE_EXECUTE_;
- else
- {
- // Plan version error. Set the state to RE_EXECUTE_AFTER_RECOMPILE_ and figure out what
- // version compiler to use, depending upon the actual error.
- // Save the current default compiler version, so we can reset it after preparing the query.
- currentCompilerVersion = getContext()->getVersionOfCompiler();
- if (diagsPtr->contains(-VERSION_PLAN_VERSION_HIGHER_THAN_MXV))
- {
- // plan version is too high, recompile with required downrev compiler
- retcode = getContext()->setOrStartCompiler((short)(*diagsPtr)[1].getOptionalInteger(1), NULL, index);
- }
- else
- {
- // plan version is too low, recompile with the current version compiler
- retcode = getContext()->setOrStartCompiler(COM_VERS_COMPILER_VERSION, NULL, index);
- }
-
- execute_state = RE_EXECUTE_AFTER_RECOMPILE_;
- if (retcode == ERROR)
- {
- // OK no to reset the compiler version, because we didnt actually set it
- setState(CLOSE_);
- diagsPtr->decrRefCount();
- return ERROR;
- }
-
- // Save the error information so that we can report it later as a warning
- fetchErrorCode_ = (VersionErrorCode) ABS(diagsPtr->mainSQLCODE()); // turn into warning
- fetchPlanVersion_ = (COM_VERSION) (*diagsPtr)[1].getOptionalInteger(0);
- fetchSupportedVersion_ = (COM_VERSION) (*diagsPtr)[1].getOptionalInteger(1);
- fetchNode_ = (*diagsPtr)[1].getOptionalString(0);
- }
-
- diagsArea.clear();
-
- retcode = root_tcb->cancel(statementGlobals_,diagsPtr);
-
- setState(CLOSE_);
-
- retcode = execute(cliGlobals, NULL, diagsArea, execute_state);
- StmtDebug1(" root_tcb->execute() returned %s",
- RetcodeToString((RETCODE) retcode));
-
- if (retcode == ERROR)
- {
- if (currentCompilerVersion != COM_VERS_UNKNOWN)
- // Error path must also reset the current compiler version
- retcode = getContext()->setOrStartCompiler(currentCompilerVersion,NULL,index);
-
- setState(CLOSE_);
- diagsPtr->decrRefCount();
- return ERROR;
- }
-
- if (currentCompilerVersion != COM_VERS_UNKNOWN)
- {
- // Reset the current compiler version if we requested a downrev compiler
- retcode = getContext()->setOrStartCompiler(currentCompilerVersion,NULL,index);
- if (retcode == ERROR)
- {
- setState(CLOSE_);
- diagsPtr->decrRefCount();
- return ERROR;
- }
- }
-
- diagsPtr->decrRefCount();
- diagsPtr = NULL;
-
- // if bulk move info needs to be recomputed, set that flag
- // in the output descriptor.
- // This could happen if the previous execute call caused an
- // auto recomp and some output information got changed.
- if ((output_desc) && (computeOutputDescBulkMoveInfo()))
- {
- output_desc->reComputeBulkMoveInfo();
- setComputeOutputDescBulkMoveInfo(FALSE);
- }
-
- if (masterStats)
- masterStats->setIsBlocking();
-
- // $$$ in no-waited case, might want to consider reducing
- // timeout by time spent (down to a minimum of 0 of course)
- closeCursorOnError = TRUE;
-
- retcode = root_tcb->fetch(cliGlobals, statementGlobals_,
- output_desc, diagsPtr,
- timeout, TRUE,
- closeCursorOnError);
- StmtDebug1(" root_tcb->fetch() returned %s",
- RetcodeToString((RETCODE) retcode));
- if (masterStats)
- masterStats->setNotBlocking();
-
- } // if (retryable and state == FETCH)
- else
- {
- // Non-retryable statement/statement that already has fetched something.
- if ( diagsPtr->contains(-EXE_LOST_OPEN) ||
- diagsPtr->contains(-EXE_PARTITION_UNAVAILABLE)
- )
- {
- // An open was lost. Set the fixup state to 0 which will cause
- // the next execution to do fixup again; this will re-open the table.
- setFixupState(0);
- }
- else
- {
- // A plan version error. Set the root_tdb to NULL so that
- // the next execution will unconditionally recompile the query.
- assignRootTdb (NULL);
-
- }
- break;
-
- } // if (retryable and state == FETCH) else ...
- }
-
-
// "diagsPtr" is modified by the foregoing call.
// If "diagsPtr" is NULL, there are no diags to merge
// into "diagsArea". Otherwise, "diagsPtr" is not NULL and does
@@ -4261,14 +3908,6 @@ RETCODE Statement::doOltExecute(CliGlobals *cliGlobals,
{
Int32 retcode;
- NABoolean processDp2Xns = FALSE;
- if ((! context_->getTransaction()->xnInProgress()) &&
- (context_->getTransaction()->autoCommit()) &&
- (root_tdb->getDp2XnsEnabled()))
- {
- processDp2Xns = TRUE;
- }
-
if (!root_tdb)
{
diagsArea << DgSqlCode(-CLI_STMT_NOT_EXISTS);
@@ -4319,16 +3958,10 @@ RETCODE Statement::doOltExecute(CliGlobals *cliGlobals,
// Start a transaction, if needed and one not already running.
if (root_tdb->transactionReqd())
{
- if (processDp2Xns)
- {
- // if this query could be evaluated using dp2/tse transactions,
- // then let the query proceed
- }
-
// A user started transaction must be present for olt execution.
// if no user started transaction, then return and do normal
// execution.
- else if ((! context_->getTransaction()->xnInProgress()) ||
+ if ((! context_->getTransaction()->xnInProgress()) ||
((context_->getTransaction()->exeStartedXn()) &&
(context_->getTransaction()->implicitXn())))
{
@@ -4340,21 +3973,21 @@ RETCODE Statement::doOltExecute(CliGlobals *cliGlobals,
{
if (compareTransModes(root_tdb, context_->getTransaction(),
(root_tdb->aqrEnabled() ? &diagsArea : NULL))
- && !systemModuleStmt() )
- {
- if (root_tdb->aqrEnabled())
- {
- // return error. AQR will handle recompile and retry.
- return(ERROR);
- }
- else
- {
- doNormalExecute = TRUE;
- reExecute = FALSE;
- return SUCCESS;
- }
- }
-
+ && !systemModuleStmt() )
+ {
+ if (root_tdb->aqrEnabled())
+ {
+ // return error. AQR will handle recompile and retry.
+ return(ERROR);
+ }
+ else
+ {
+ doNormalExecute = TRUE;
+ reExecute = FALSE;
+ return SUCCESS;
+ }
+ }
+
// move the transid from executor globals to statement globals,
// if a transaction is running.
statementGlobals_->getTransid() =
@@ -4370,10 +4003,10 @@ RETCODE Statement::doOltExecute(CliGlobals *cliGlobals,
}
}
}
-
- ExStatisticsArea *statsArea = getStatsArea();
- if (statsArea != NULL &&
- statsArea->getCollectStatsType() != ComTdb::MEASURE_STATS)
+
+ ExStatisticsArea *statsArea = getStatsArea();
+ if (statsArea != NULL &&
+ statsArea->getCollectStatsType() != ComTdb::MEASURE_STATS)
{
StatsGlobals *statsGlobals = cliGlobals->getStatsGlobals();
if (statsGlobals != NULL)
@@ -4428,21 +4061,6 @@ RETCODE Statement::doOltExecute(CliGlobals *cliGlobals,
setFixupState(0);
- if (processDp2Xns)
- {
- implicitTransNeeded();
-
- short taRetcode =
- context_->getTransaction()->beginTransaction();
-
- if (taRetcode != 0)
- {
- diagsArea << DgSqlCode(- CLI_BEGIN_TRANSACTION_ERROR);
- // cliGlobals_->setJmpBufPtr(oldJmpBufPtr);
- return ERROR;
- }
- }
-
NABoolean doSimCheck = FALSE;
NABoolean partitionUnavailable = FALSE;
retcode = fixup(cliGlobals, input_desc, diagsArea, doSimCheck, partitionUnavailable, FALSE);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/3d41ee0f/core/sql/cli/Statement.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/Statement.h b/core/sql/cli/Statement.h
index 8babe27..047b53a 100644
--- a/core/sql/cli/Statement.h
+++ b/core/sql/cli/Statement.h
@@ -205,11 +205,11 @@ public:
{UNSPECIFIED_ = 0, ATOMIC_ = 1, NOT_ATOMIC_ = 2};
enum ExecState
- {INITIAL_STATE_, RESOLVE_NAMES_, DO_SIM_CHECK_, COMPILE_, RECOMPILE_,
+ {INITIAL_STATE_, DO_SIM_CHECK_,
CHECK_DYNAMIC_SETTINGS_, VALIDATE_SECURITY_,
- FIXUP_, EXECUTE_, RE_EXECUTE_, ERROR_, ERROR_RETURN_,
+ FIXUP_, EXECUTE_, ERROR_, ERROR_RETURN_,
FIXUP_DONE_, FIXUP_DONE_START_XN_,
- RE_EXECUTE_AFTER_RECOMPILE_};
+ RE_EXECUTE_};
static const char *stmtState(State state);
[3/8] incubator-trafodion git commit: Merge remote branch
'origin/master' into ansharma_simcheck_br
Posted by an...@apache.org.
Merge remote branch 'origin/master' into ansharma_simcheck_br
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/667cf65f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/667cf65f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/667cf65f
Branch: refs/heads/master
Commit: 667cf65f80ef97df5a5148756d2d04978c64ee4e
Parents: 074428e b8dc6da
Author: Anoop Sharma <an...@esgyn.com>
Authored: Tue Oct 4 19:36:59 2016 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Tue Oct 4 19:36:59 2016 +0000
----------------------------------------------------------------------
.../main/java/org/trafodion/dtm/TmAuditTlog.java | 7 +++----
core/sql/ustat/hs_globals.cpp | 2 +-
docs/src/site/resources/images/carousel/meetup.png | Bin 81640 -> 0 bytes
3 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------