From 43984c46cc9ea2cfc0e816080e93e0dc7e61369a Mon Sep 17 00:00:00 2001 From: Anoop Sharma Date: Mon, 2 Apr 2018 16:40:16 +0000 Subject: [PATCH] various fixes -- JIRA 2980 support for INSTR function. INSTR(source_string, pattern, startPos, occurrence) Search for pattern in source_string. Start at startPos'th character. Optional, default 1 Return occurrence'th occurrence. Optional, default 1 (exp/exp_function.cpp/h, exp/ExpPCodeClauseGen.cpp, generator/GenItemFunc.cpp, optimizer/BindItemExpr.cpp, ItemExpr.cpp, optimizer/ItemFunc.h, SynthType.cpp, parser/sqlparser.y) -- hivemd returns precision, scale, display_datatype (comexe/ComTdbExeUtil.h, common/BaseTypes.cpp,NAType.cpp/h, executor/ExExeUtilGet.cpp, ExExeUtil.h) -- hive decimal type is treated as sql NUMERIC for performance. (common/NAType.cpp) -- hive select from hivemd with prepare and multiple executes work (executor/ExExeUtilGet.cpp) -- fix for crash in sql buffer pool when allocating large size rows. (executor/sql_buffer.cpp) -- SIGN(op) now returns error if op is not numeric (BindItemExpr.cpp) -- strings of length zero are no longer cached. Caching them causes problem during backpatching. (optimizer/ItemCache.cpp) --- compile time predicates on constants were not being created correctly in some cases. That has been fixed. (ValueDesc.cpp) -- trim now supported on scaled numeric, float and bignum datatypes (BindItemExpr.cpp) -- CASE is now supported on scaled numerics, float, bignum (BindItemExpr.cpp) -- char_length is now supported on numerics (ItemFunc.h, BindItemExpr.cpp) -- DAYOFMONTH now allowed only on datetime datatypes (common/OperTypeEnum.h, sqlparser.y, BindItemExpr.cpp, ItemExpr.cpp) -- TO_TIME now allowed only on 'datetime with time' or character datatypes. (BindItemExpr.cpp, bin/SqlciErrors.txt) -- updated expected file for compGeneral/test042 --- core/sql/bin/SqlciErrors.txt | 2 +- core/sql/comexe/ComTdbExeUtil.h | 32 +- core/sql/common/BaseTypes.cpp | 3 +- core/sql/common/NAType.cpp | 12 +- core/sql/common/NAType.h | 3 +- core/sql/common/OperTypeEnum.h | 1 + core/sql/executor/ExExeUtil.h | 12 +- core/sql/executor/ExExeUtilGet.cpp | 121 ++-- core/sql/executor/sql_buffer.cpp | 3 +- core/sql/exp/ExpPCodeClauseGen.cpp | 4 + core/sql/exp/exp_function.cpp | 249 ++++++-- core/sql/exp/exp_function.h | 30 +- core/sql/generator/GenItemFunc.cpp | 6 +- core/sql/optimizer/BindItemExpr.cpp | 300 ++++++++-- core/sql/optimizer/ItemCache.cpp | 8 + core/sql/optimizer/ItemExpr.cpp | 7 +- core/sql/optimizer/ItemFunc.h | 12 +- core/sql/optimizer/SynthType.cpp | 41 +- core/sql/optimizer/ValueDesc.cpp | 57 +- core/sql/parser/sqlparser.y | 39 +- core/sql/regress/compGeneral/EXPECTED006.SB | 10 +- core/sql/regress/compGeneral/EXPECTED042 | 139 ++--- core/sql/regress/core/EXPECTED038.LINUX | 26 +- core/sql/regress/executor/EXPECTED012 | 598 +++++++++++++++++++- core/sql/regress/executor/TEST012 | 103 +++- core/sql/regress/hive/EXPECTED005 | 112 ++-- core/sql/regress/seabase/EXPECTED002 | 288 ++++++---- core/sql/regress/seabase/EXPECTED030 | 14 + core/sql/regress/seabase/EXPECTED031 | 44 +- core/sql/regress/seabase/TEST002 | 41 +- core/sql/regress/seabase/TEST030 | 4 + core/sql/regress/seabase/TEST031 | 10 + 32 files changed, 1758 insertions(+), 573 deletions(-) diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt index e66e17012e..981dabc498 100644 --- a/core/sql/bin/SqlciErrors.txt +++ b/core/sql/bin/SqlciErrors.txt @@ -1047,7 +1047,7 @@ $1~String1 -------------------------------- 3412 ZZZZZ 99999 BEGINNER MAJOR DBADMIN IDENTITY column $0~ColumnName must be the primary key or must have a unique index on it. 3413 ZZZZZ 99999 BEGINNER MAJOR DBADMIN The NOT NULL constraint on IDENTITY column $0~ColumnName must be NOT DROPPABLE. 3414 ZZZZZ 99999 BEGINNER MAJOR DBADMIN For an IDENTITY column $0~ColumnName, the tuple list cannot have mixed user specified and DEFAULT values. Specify values for all or specify DEFAULT for all. -3415 42000 99999 BEGINNER MAJOR DBADMIN The first operand of function $0~string0 is not valid. +3415 42000 99999 BEGINNER MAJOR DBADMIN The first operand of function $0~string0 is not valid.$1~String1 3416 42000 99999 BEGINNER MAJOR DBADMIN The last operand of function $0~string0 must not be NULL. 3417 ZZZZZ 99999 BEGINNER MINOR DBADMIN Invalid DISK POOL $0~Int0 as the maximum number of pools allowed is $1~Int1. 3418 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Local Number of Partitions clause is not allowed with DISK POOL clause. diff --git a/core/sql/comexe/ComTdbExeUtil.h b/core/sql/comexe/ComTdbExeUtil.h index fba4d7b855..9024afe0ab 100644 --- a/core/sql/comexe/ComTdbExeUtil.h +++ b/core/sql/comexe/ComTdbExeUtil.h @@ -3187,21 +3187,22 @@ static const ComTdbVirtTableColumnInfo hiveMDColumnsColInfo[] = { "COLUMN_NAME", 3, COM_USER_COLUMN, REC_BYTE_F_ASCII, 256, FALSE, SQLCHARSETCODE_UTF8, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, { "SQL_DATA_TYPE", 4, COM_USER_COLUMN, REC_BYTE_F_ASCII, 32, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, { "FS_DATA_TYPE", 5, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "HIVE_DATA_TYPE", 6, COM_USER_COLUMN, REC_BYTE_F_ASCII, 32, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "COLUMN_SIZE", 7, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "CHARACTER_SET", 8, COM_USER_COLUMN, REC_BYTE_F_ASCII, 40, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "COLUMN_PRECISION", 9, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "COLUMN_SCALE", 10, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "DT_CODE", 11, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "NULLABLE", 12, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "COLUMN_NUMBER", 13, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "PART_COL_NUMBER", 14, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "BUCKET_COL_NUMBER", 15, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "SORT_COL_NUMBER", 16, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "DATETIME_QUALIFIER", 17, COM_USER_COLUMN, REC_BYTE_F_ASCII, 28, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "DATETIME_START_FIELD", 18, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "DATETIME_END_FIELD", 19, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, - { "DEFAULT_VALUE", 20, COM_USER_COLUMN, REC_BYTE_F_ASCII, 240, FALSE, SQLCHARSETCODE_UTF8, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "DISPLAY_DATA_TYPE", 6, COM_USER_COLUMN, REC_BYTE_F_ASCII, 96, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "HIVE_DATA_TYPE", 7, COM_USER_COLUMN, REC_BYTE_F_ASCII, 32, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "COLUMN_SIZE", 8, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "CHARACTER_SET", 9, COM_USER_COLUMN, REC_BYTE_F_ASCII, 40, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "COLUMN_PRECISION", 10, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "COLUMN_SCALE", 11, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "DT_CODE", 12, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "NULLABLE", 13, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "COLUMN_NUMBER", 14, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "PART_COL_NUMBER", 15, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "BUCKET_COL_NUMBER", 16, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "SORT_COL_NUMBER", 17, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "DATETIME_QUALIFIER", 18, COM_USER_COLUMN, REC_BYTE_F_ASCII, 28, FALSE, SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "DATETIME_START_FIELD", 19, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "DATETIME_END_FIELD", 20, COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE, SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, + { "DEFAULT_VALUE", 21, COM_USER_COLUMN, REC_BYTE_F_ASCII, 240, FALSE, SQLCHARSETCODE_UTF8, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "" ,NULL,NULL,COM_UNKNOWN_DIRECTION_LIT, 0}, }; struct HiveMDColumnsColInfoStruct @@ -3212,6 +3213,7 @@ struct HiveMDColumnsColInfoStruct char colName[256]; char sqlDatatype[32]; Lng32 fsDatatype; + char displayDatatype[96]; char hiveDatatype[32]; Lng32 colSize; char charSet[40]; diff --git a/core/sql/common/BaseTypes.cpp b/core/sql/common/BaseTypes.cpp index 0b22550f3e..91ac01d62a 100644 --- a/core/sql/common/BaseTypes.cpp +++ b/core/sql/common/BaseTypes.cpp @@ -645,7 +645,8 @@ short convertTypeToText_basic(char * text, // OUTPUT CharInfo::getCharSetName(charSet)); } - if (addCollate && (collation_name != NULL)) + if (addCollate && (collation_name != NULL) && + (strcmp(collation_name, SQLCOLLATIONSTRING_UNKNOWN) != 0)) { str_sprintf(&text[str_len(text)], " COLLATE %s", diff --git a/core/sql/common/NAType.cpp b/core/sql/common/NAType.cpp index 8ace6f7dfe..0271b0c94d 100644 --- a/core/sql/common/NAType.cpp +++ b/core/sql/common/NAType.cpp @@ -777,7 +777,8 @@ short NAType::getMyTypeAsHiveText(NAString * outputStr/*out*/) const } short NAType::getMyTypeAsText(NAString * outputStr, // output - NABoolean addNullability) const + NABoolean addNullability, + NABoolean addCollation) const { // get the right value for all these Lng32 fs_datatype = getFSDatatype(); @@ -829,7 +830,8 @@ short NAType::getMyTypeAsText(NAString * outputStr, // output isUpshifted = charType.isUpshifted(); isCaseinsensitive = charType.isCaseinsensitive(); characterSet = charType.getCharSet(); - collationSequence = charType.getCollation(); + if (addCollation) + collationSequence = charType.getCollation(); if ( characterSet == CharInfo::UTF8 /* || (characterSet == CharInfo::SJIS */ ) { // If byte length limit is EXACTLY (maxBytesPerChar * character limit), then use character limit @@ -1063,6 +1065,8 @@ NAType* NAType::getNATypeForHive(const char* hiveType, NAMemory* heap) if ( !strncmp(hiveType, "decimal", 7) ) { + const Int16 DisAmbiguate = 0; + Int32 i=0, pstart=-1, pend=-1, sstart=-1, send=-1, p=-1, s = -1; Int32 hiveTypeLen = strlen(hiveType); char pstr[MAX_NUM_LEN], sstr[MAX_NUM_LEN]; @@ -1112,7 +1116,7 @@ NAType* NAType::getNATypeForHive(const char* hiveType, NAMemory* heap) if( (p>0) && (p <= MAX_PRECISION_ALLOWED) ) //have precision between 1 - 18 { if( ( s >=0 ) && ( s<= p) ) //have valid scale - return new (heap) SQLDecimal(heap, p, s, TRUE, TRUE); + return new (heap) SQLNumeric(heap, TRUE, p, s, DisAmbiguate, TRUE); else return NULL; } @@ -1127,7 +1131,7 @@ NAType* NAType::getNATypeForHive(const char* hiveType, NAMemory* heap) else if( ( p == -1 ) && ( s == -1 ) ) { // hive define decimal as decimal ( 10, 0 ) - return new (heap) SQLDecimal(heap, 10, 0, TRUE, TRUE); + return new (heap) SQLNumeric(heap, TRUE, 10, 0, DisAmbiguate, TRUE); } else { diff --git a/core/sql/common/NAType.h b/core/sql/common/NAType.h index c66a12117e..7b719a96ec 100644 --- a/core/sql/common/NAType.h +++ b/core/sql/common/NAType.h @@ -562,7 +562,8 @@ class NAType : public NABasicObject short displayCaseSpecific = 0); short getMyTypeAsText(NAString * outputStr, - NABoolean addNullability = TRUE) const; // output + NABoolean addNullability = TRUE, + NABoolean addCollation = TRUE) const; // output short getMyTypeAsHiveText(NAString * outputStr) const; // output diff --git a/core/sql/common/OperTypeEnum.h b/core/sql/common/OperTypeEnum.h index ee84c80a9f..1d41ebea9f 100644 --- a/core/sql/common/OperTypeEnum.h +++ b/core/sql/common/OperTypeEnum.h @@ -587,6 +587,7 @@ enum OperatorTypeEnum { ITM_DAYOFYEAR = 2311, ITM_FIRSTDAYOFYEAR = 2312, ITM_INTERNALTIMESTAMP = 2313, // ++ Triggers, + ITM_DAYOFMONTH = 2314, ITM_DATE_TRUNC_YEAR = 2315, ITM_DATE_TRUNC_MONTH = 2316, diff --git a/core/sql/executor/ExExeUtil.h b/core/sql/executor/ExExeUtil.h index 85173c8fd4..d169653e2d 100644 --- a/core/sql/executor/ExExeUtil.h +++ b/core/sql/executor/ExExeUtil.h @@ -3346,9 +3346,15 @@ virtual ex_tcb_private_state * Lng32 &pstateLength); // out, length of one element protected: - Lng32 getFSTypeFromHiveColType(const char* hiveType); - Lng32 getLengthFromHiveColType(const char* hiveType); - + Lng32 getTypeAttrsFromHiveColType(const char* hiveType, + NABoolean isORC, + Lng32 &fstype, + Lng32 &length, + Lng32 &precision, + Lng32 &scale, + char *sqlType, + char *displayType, + char *charset); enum Step { INITIAL_, diff --git a/core/sql/executor/ExExeUtilGet.cpp b/core/sql/executor/ExExeUtilGet.cpp index ff40c40659..4428998dad 100644 --- a/core/sql/executor/ExExeUtilGet.cpp +++ b/core/sql/executor/ExExeUtilGet.cpp @@ -5460,22 +5460,58 @@ ExExeUtilHiveMDaccessTcb::~ExExeUtilHiveMDaccessTcb() } // should move this method to common dir. -Lng32 ExExeUtilHiveMDaccessTcb::getFSTypeFromHiveColType(const char* hiveType) +Lng32 ExExeUtilHiveMDaccessTcb::getTypeAttrsFromHiveColType(const char* hiveType, + NABoolean isORC, + Lng32 &fstype, + Lng32 &length, + Lng32 &precision, + Lng32 &scale, + char *sqlType, + char *displayType, + char *charset) { - Lng32 fstype = -1; - NAType * nat = NAType::getNATypeForHive(hiveType, getHeap()); - fstype = nat->getFSDatatype(); - delete nat; - return fstype; -} + short rc = 0; -Lng32 ExExeUtilHiveMDaccessTcb::getLengthFromHiveColType(const char* hiveType) -{ - Lng32 len = -1; + fstype = -1; + length = -1; + precision = -1; + scale = -1; NAType * nat = NAType::getNATypeForHive(hiveType, getHeap()); - len = nat->getNominalSize(); - delete nat; - return len; + if (nat) + { + fstype = nat->getFSDatatype(); + length = nat->getNominalSize(); + precision = nat->getPrecision(); + scale = nat->getScale(); + + const char * sdtStr = + Descriptor::ansiTypeStrFromFSType(fstype); + strcpy(sqlType, sdtStr); + + NAString displayTypeNAS; + rc = nat->getMyTypeAsText(&displayTypeNAS, FALSE, FALSE); + if (rc) + { + delete nat; + return -1; + } + + strcpy(displayType, displayTypeNAS.data()); + + charset[0] = 0; + CharInfo::CharSet charSetEnum = nat->getCharSet(); + if (charSetEnum != CharInfo::UnknownCharSet) + { + const char * charSetName = CharInfo::getCharSetName(charSetEnum); + if (charSetName) + strcpy(charset, charSetName); + } + + delete nat; + return 0; + } + + return -1; } short ExExeUtilHiveMDaccessTcb::work() @@ -5537,6 +5573,8 @@ short ExExeUtilHiveMDaccessTcb::work() case SETUP_SCHEMAS_: { + schNames_.clear(); + if ((hiveMDtdb().mdType_ == ComTdbExeUtilHiveMDaccess::SCHEMAS_) || (! hiveMDtdb().getSchema())) { @@ -5795,40 +5833,51 @@ short ExExeUtilHiveMDaccessTcb::work() str_cpy(infoCol->colName, (hcd ? hcd->name_ : hpd->name_), 256, ' '); - infoCol->fsDatatype = - getFSTypeFromHiveColType(hcd ? hcd->type_ : hpd->type_); - - if (infoCol->fsDatatype < 0) + Lng32 fstype = -1; + Lng32 length = -1; + Lng32 precision = -1; + Lng32 scale = -1; + char sqlType[50]; + char displayType[100]; + char charset[50]; + retcode = + getTypeAttrsFromHiveColType(hcd ? hcd->type_ : hpd->type_, + htd->getSDs()->isOrcFile(), + fstype, length, precision, scale, + sqlType, displayType, charset); + + if (retcode < 0) { + // add a warning and continue. char strP[300]; - sprintf(strP, "Datatype %s is not supported.", - (hcd ? hcd->type_ : hpd->type_)); - *diags << DgSqlCode(-CLI_GET_METADATA_INFO_ERROR) + sprintf(strP, "Datatype %s for column '%s' in table %s.%s.%s is not supported. This table will be ignored.", + (hcd ? hcd->type_ : hpd->type_), + (hcd ? hcd->name_ : hpd->name_), + hiveCat_, hiveSch_, htd->tblName_); + *diags << DgSqlCode(CLI_GET_METADATA_INFO_ERROR) << DgString0(strP); - - step_ = HANDLE_ERROR_; - break; + + step_ = ADVANCE_ROW_; + break; } - const char * sdtStr = - Descriptor::ansiTypeStrFromFSType(infoCol->fsDatatype); - str_cpy(infoCol->sqlDatatype, sdtStr, 32, ' '); + infoCol->fsDatatype = fstype; + + str_cpy(infoCol->sqlDatatype, sqlType, 32, ' '); + + str_cpy(infoCol->displayDatatype, displayType, 96, ' '); str_cpy(infoCol->hiveDatatype, (hcd ? hcd->type_ : hpd->type_), 32, ' '); - infoCol->colSize = - getLengthFromHiveColType(hcd ? hcd->type_ : hpd->type_); - infoCol->colScale = 0; + infoCol->colSize = length; + infoCol->colPrecision = precision; + infoCol->colScale = scale; - // only iso charset - if ((infoCol->fsDatatype == REC_BYTE_F_ASCII) || - (infoCol->fsDatatype == REC_BYTE_V_ASCII)) - str_cpy(infoCol->charSet, "ISO88591", 40, ' '); - else - str_pad(infoCol->charSet, 40, ' '); + str_pad(infoCol->charSet, 40, ' '); + if (strlen(charset) > 0) + str_cpy(infoCol->charSet, charset, 40, ' '); - infoCol->colPrecision = 0; infoCol->nullable = 1; infoCol->dtCode = 0; diff --git a/core/sql/executor/sql_buffer.cpp b/core/sql/executor/sql_buffer.cpp index 14d1f462d9..911ce1182a 100644 --- a/core/sql/executor/sql_buffer.cpp +++ b/core/sql/executor/sql_buffer.cpp @@ -2697,7 +2697,8 @@ sql_buffer_pool::moveIn(atp_struct *atp1, if (get_free_tuple(atp2->getTupp(tuppIndex), tupDataSize)) { if(addBufferIfNeeded) { - addBuffer(bufferSize); + ULng32 neededSize = SqlBufferNeededSize(1, bufferSize, bufType_); + addBuffer(neededSize); if (get_free_tuple(atp2->getTupp(tuppIndex), tupDataSize)) { ex_assert(0, "sql_buffer_pool::moveIn() No more space for tuples"); } diff --git a/core/sql/exp/ExpPCodeClauseGen.cpp b/core/sql/exp/ExpPCodeClauseGen.cpp index 92e7fb290c..958e2101de 100644 --- a/core/sql/exp/ExpPCodeClauseGen.cpp +++ b/core/sql/exp/ExpPCodeClauseGen.cpp @@ -4553,6 +4553,10 @@ ex_function_position::pCodeGenerate(Space *space, UInt32 f) if(cs != CharInfo::ISO88591) return ex_clause::pCodeGenerate(space, f); + // pcode currently doesn't handle non-default start position or n'th occurrence + if (getNumOperands() > 3) + return ex_clause::pCodeGenerate(space, f); + // We don't support system collations (e.g. czech). Note, some clauses have // the collation defined in the clause. Others don't - in which case the // info needs to be derived from the operand. diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp index 67ca194932..75ffcf9720 100644 --- a/core/sql/exp/exp_function.cpp +++ b/core/sql/exp/exp_function.cpp @@ -290,14 +290,19 @@ ExFunctionInetNtoa::ExFunctionInetNtoa(OperatorTypeEnum oper_type, }; ExFunctionAESEncrypt::ExFunctionAESEncrypt(OperatorTypeEnum oper_type, - Attributes ** attr, Space * space, int args_num, Int32 aes_mode ) - : ex_function_clause(oper_type, args_num + 1, attr, space), args_num(args_num), aes_mode(aes_mode) + Attributes ** attr, Space * space, + int in_args_num, + Int32 aes_mode ) + : ex_function_clause(oper_type, in_args_num + 1, attr, space), + args_num(in_args_num), aes_mode(aes_mode) { }; ExFunctionAESDecrypt::ExFunctionAESDecrypt(OperatorTypeEnum oper_type, - Attributes ** attr, Space * space, int args_num, Int32 aes_mode) - : ex_function_clause(oper_type, args_num + 1, attr, space), args_num(args_num), aes_mode(aes_mode) + Attributes ** attr, Space * space, + int in_args_num, Int32 aes_mode) + : ex_function_clause(oper_type, in_args_num + 1, attr, space), + args_num(in_args_num), aes_mode(aes_mode) { }; @@ -347,18 +352,21 @@ ex_function_oct_length::ex_function_oct_length(OperatorTypeEnum oper_type, }; ex_function_position::ex_function_position(OperatorTypeEnum oper_type, - Attributes ** attr, Space * space) -: ex_function_clause(oper_type, 3, attr, space) + Attributes ** attr, Space * space, + int in_args_num) + : ex_function_clause(oper_type, in_args_num, attr, space), + args_num(in_args_num) { }; ex_function_position_doublebyte::ex_function_position_doublebyte ( - OperatorTypeEnum oper_type, - Attributes ** attr, Space * space + OperatorTypeEnum oper_type, + Attributes ** attr, Space * space, int in_args_num ) -: ex_function_clause(oper_type, 3, attr, space) + : ex_function_clause(oper_type, in_args_num, attr, space), + args_num(in_args_num) { }; @@ -2167,6 +2175,7 @@ Lng32 ex_function_position::findPosition if (searchLen <= 0) return 0; + Int32 position = 1; Int32 collPosition = 1; Int32 char_count = 1; @@ -2181,14 +2190,14 @@ Lng32 ex_function_position::findPosition } else { - number_bytes = Attributes::getFirstCharLength - (&sourceStr[position-1], sourceLen - position + 1, cs); - - if(number_bytes <= 0) - return (Lng32)-1; - - ++char_count; - position += number_bytes; + number_bytes = Attributes::getFirstCharLength + (&sourceStr[position-1], sourceLen - position + 1, cs); + + if(number_bytes <= 0) + return (Lng32)-1; + + ++char_count; + position += number_bytes; } else { @@ -2198,17 +2207,16 @@ Lng32 ex_function_position::findPosition } else { - if(charOffsetFlag) - return char_count; - else - return position; + if(charOffsetFlag) + return char_count; + else + return position; } } } return 0; } - ex_expr::exp_return_type ex_function_char_length_doublebyte::eval(char *op_data[], CollHeap*, @@ -2224,12 +2232,51 @@ ex_function_char_length_doublebyte::eval(char *op_data[], return ex_expr::EXPR_OK; }; +Lng32 ex_function_position::errorChecks(Lng32 startPos, Lng32 occurrence, + CollHeap* heap, ComDiagsArea** diagsArea) +{ + // startPos is 1 based. Cannot be <= 0 + if (startPos < 0) + { + ExRaiseSqlError(heap, diagsArea, (ExeErrorCode)1572); + *(*diagsArea) << DgString0("START POSITION") << DgString1("INSTR function"); + return -1; + } + + if (startPos == 0) + { + ExRaiseSqlError(heap, diagsArea, (ExeErrorCode)1571); + *(*diagsArea) << DgString0("START POSITION") << DgString1("INSTR function"); + return -1; + } + + if (occurrence < 0) + { + ExRaiseSqlError(heap, diagsArea, (ExeErrorCode)1572); + *(*diagsArea) << DgString0("OCCURRENCE") << DgString1("INSTR function"); + + return -1; + } + + if (occurrence == 0) + { + ExRaiseSqlError(heap, diagsArea, (ExeErrorCode)1571); + *(*diagsArea) << DgString0("OCCURRENCE") << DgString1("INSTR function"); + + return -1; + } + + return 0; +} + + ex_expr::exp_return_type ex_function_position::eval(char *op_data[], CollHeap* heap, ComDiagsArea** diagsArea) { CharInfo::CharSet cs = ((SimpleType *)getOperand(1))->getCharSet(); + // return value is 1 based. First character position is 1. // search for operand 1 Lng32 len1 = getOperand(1)->getLength(op_data[-MAX_OPERANDS+1]); @@ -2247,30 +2294,60 @@ ex_expr::exp_return_type ex_function_position::eval(char *op_data[], len2 = Attributes::trimFillerSpaces( op_data[2], prec2, len2, cs ); } - // If len1 is 0, return a position of 1. - Lng32 position; - if (len1 > 0) + Int32 startPos = 1; + Int32 occurrence = 1; + if (getNumOperands() >= 4) // start position and optional occurrence specified { + startPos = *(Int32*)op_data[3]; + if (getNumOperands() == 5) + occurrence = *(Int32*)op_data[4]; + + if (errorChecks(startPos, occurrence, heap, diagsArea)) + return ex_expr::EXPR_ERROR; + } + + // operand2/srcStr is the string to be searched in. + char * srcStr = &op_data[2][startPos-1]; + len2 -= (startPos-1); + char * pat = op_data[1]; + + Lng32 position = 0; + if (len1 > 0) + { short nPasses = CollationInfo::getCollationNPasses(getCollation()); - position = findPosition(op_data[2], - len2, - op_data[1], - len1, - 1, - nPasses, - getCollation(), - 1, - cs); + for (Int32 occ = 1; occ <= occurrence; occ++) + { + position = findPosition(srcStr, + len2, + pat, + len1, + 1, + nPasses, + getCollation(), + 1, + cs); + + if(position < 0) + { + const char *csname = CharInfo::getCharSetName(cs); + ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHARACTER); + *(*diagsArea) << DgString0(csname) << DgString1("POSITION FUNCTION"); + return ex_expr::EXPR_ERROR; + } - if(position < 0) - { - const char *csname = CharInfo::getCharSetName(cs); - ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHARACTER); - *(*diagsArea) << DgString0(csname) << DgString1("POSITION FUNCTION"); - return ex_expr::EXPR_ERROR; - } - + if ((occ < occurrence) && + (position > 0)) // found a matching string + { + // skip the current matched string and continue + srcStr += (position + len1 - 1); + len2 -= (position + len1 - 1); + startPos += (position + len1 -1); + } + } // for occ + + if (position > 0) // found matching string + position += (startPos - 1); } else { @@ -2285,39 +2362,87 @@ ex_expr::exp_return_type ex_function_position::eval(char *op_data[], }; ex_expr::exp_return_type ex_function_position_doublebyte::eval(char *op_data[], - CollHeap*, - ComDiagsArea**) + CollHeap*heap, + ComDiagsArea**diagsArea) { + // len1 and len2 are character lengths. + + // len1 is the pattern length to be searched. Lng32 len1 = ( getOperand(1)->getLength(op_data[-MAX_OPERANDS+1]) ) / sizeof(NAWchar); + + // len2 is the length of string to be seached in. + Lng32 len2 = ( getOperand(2)->getLength(op_data[-MAX_OPERANDS+2]) ) / sizeof(NAWchar); - // If len1 is 0, return a position of 1. - Lng32 position = 1; - if (len1 > 0) + // startPos is character pos and not byte pos + Int32 startPos = 1; + + Int32 occurrence = 1; + if (getNumOperands() >= 4) { - Lng32 len2 = ( getOperand(2)->getLength(op_data[-MAX_OPERANDS+2]) ) / sizeof(NAWchar); + startPos = *(Int32*)op_data[3]; + if (getNumOperands() == 5) + occurrence = *(Int32*)op_data[4]; - NAWchar* pat = (NAWchar*)op_data[1]; - NAWchar* source = (NAWchar*)op_data[2]; - - // If len1 > len2 or if operand 1 is not present in operand 2, return - // a position of 0; otherwise return the position of operand 1 in - // operand 2. + if (ex_function_position::errorChecks(startPos, occurrence, + heap, diagsArea)) + return ex_expr::EXPR_ERROR; + } + + // operand2/srcStr is the string to be searched in. + NAWchar * srcStr = + (NAWchar*)&op_data[2][startPos*sizeof(NAWchar) - sizeof(NAWchar)]; + + NAWchar* pat = (NAWchar*)op_data[1]; + + // start at specified startPos + Lng32 position = startPos; + + // If patter length(len1) > srcStr len(len2), return position of 0 + if (len1 > len2) + position = 0; + else if (len1 > 0) + { + // if pat is not present in srcStr, return position of 0; + // otherwise return the position of pat in srcStr for the + // specified occurrence. short found = 0; - while (position+len1-1 <= len2 && !found) + for (Int32 occ = 1; occ <= occurrence; occ++) { - if (wc_str_cmp(pat, &source[position-1], (Int32)len1)) - position++; - else - found = 1; - } - if (!found) position = 0; + found = 0; + while (position+len1-1 <= len2 && !found) + { + if (wc_str_cmp(pat, srcStr, (Int32)len1)) + { + position++; + srcStr += 1; + } + else + found = 1; + } + + if ((occ < occurrence) && + (found)) // found a matching string + { + srcStr += len1; + position += len1; + } + } // for occ + + if (! found) // not found matching string, return 0; + position = 0; } - + else + { + // if len1 <= 0, return position of 1. + position = 1; + } + // Now copy the position into result which is a long. *(Lng32 *)op_data[0] = position; return ex_expr::EXPR_OK; }; + static Lng32 findTokenPosition(char * sourceStr, Lng32 sourceLen, char * searchStr, Lng32 searchLen, short bytesPerChar) diff --git a/core/sql/exp/exp_function.h b/core/sql/exp/exp_function.h index 13b718532a..3f6bd0c9e3 100644 --- a/core/sql/exp/exp_function.h +++ b/core/sql/exp/exp_function.h @@ -359,8 +359,9 @@ class ex_function_char_length_doublebyte : class ex_function_position : public ex_function_clause { public: ex_function_position(OperatorTypeEnum oper_type, - Attributes ** attr, - Space * space); + Attributes ** attr, + Space * space, + int in_args_num); ex_function_position(); @@ -403,10 +404,13 @@ class ex_function_position : public ex_function_clause { short charOffsetFlag = 0, CharInfo::CharSet cs = CharInfo::ISO88591); + static Lng32 errorChecks(Lng32 startPos, Lng32 occurrence, + CollHeap* heap, ComDiagsArea** diagsArea); + ex_expr::exp_return_type pCodeGenerate(Space *space, UInt32 f); - ex_expr::exp_return_type eval(char *op_data[], CollHeap*, - ComDiagsArea** = 0); + ex_expr::exp_return_type eval(char *op_data[], CollHeap* heap, + ComDiagsArea** = 0); Long pack(void *); // --------------------------------------------------------------------- @@ -443,22 +447,23 @@ class ex_function_position : public ex_function_clause { private: Int16 collation_; - char fillers_[6]; // - + Int16 args_num; + char fillers_[4]; // }; class ex_function_position_doublebyte : public ex_function_clause { public: ex_function_position_doublebyte(OperatorTypeEnum oper_type, - Attributes ** attr, - Space * space); + Attributes ** attr, + Space * space, + int in_args_num); ex_function_position_doublebyte(); - ex_expr::exp_return_type eval(char *op_data[], CollHeap*, - ComDiagsArea** = 0); + ex_expr::exp_return_type eval(char *op_data[], CollHeap* heap, + ComDiagsArea** = 0); Long pack(void *); // --------------------------------------------------------------------- @@ -477,6 +482,11 @@ class ex_function_position_doublebyte : virtual short getClassSize() { return (short)sizeof(*this); } // --------------------------------------------------------------------- + +private: + Int16 args_num; + + char fillers_[6]; // }; class ex_function_concat : public ex_function_clause { diff --git a/core/sql/generator/GenItemFunc.cpp b/core/sql/generator/GenItemFunc.cpp index 86c1758baf..6121110cd4 100644 --- a/core/sql/generator/GenItemFunc.cpp +++ b/core/sql/generator/GenItemFunc.cpp @@ -445,7 +445,8 @@ short BuiltinFunction::codeGen(Generator * generator) case CharInfo::UTF8: // case CharInfo::SJIS: // Uncomment this if we ever support SJIS function_clause = new(generator->getSpace()) - ex_function_position(ITM_POSITION, attr, space); + ex_function_position(ITM_POSITION, attr, space, + (getArity() + 1)); ((ex_function_position *)function_clause)->setCollation(((PositionFunc*)this)->getCollation()); @@ -453,7 +454,8 @@ short BuiltinFunction::codeGen(Generator * generator) case CharInfo::UCS2: function_clause = new(generator->getSpace()) - ex_function_position_doublebyte(ITM_POSITION_DOUBLEBYTE, attr, space); + ex_function_position_doublebyte(ITM_POSITION_DOUBLEBYTE, attr, space, + (getArity() + 1)); break; diff --git a/core/sql/optimizer/BindItemExpr.cpp b/core/sql/optimizer/BindItemExpr.cpp index 3c8121899a..cc25f93c59 100644 --- a/core/sql/optimizer/BindItemExpr.cpp +++ b/core/sql/optimizer/BindItemExpr.cpp @@ -4038,10 +4038,20 @@ NABoolean DateFormat::errorChecks(Lng32 frmt, BindWA *bindWA, error = 1; // error 4065 } - if (toTime && NOT tf) + if (!error && toTime) { - // TO_TIME requires time format - error = 1; // error 4065 + if (NOT tf) + { + // TO_TIME requires time format + error = 1; // error 4065 + } + // source must be datetime containing time field or a character string + else if (((opType->getTypeQualifier() == NA_DATETIME_TYPE) && + (opType->getPrecision() == SQLDTCODE_DATE)) || + (opType->getTypeQualifier() != NA_CHARACTER_TYPE)) + { + error = 9; // error 3415 + } } if (!error && toChar) @@ -4095,7 +4105,7 @@ NABoolean DateFormat::errorChecks(Lng32 frmt, BindWA *bindWA, { *CmpCommon::diags() << DgSqlCode(-4065) << DgString0(formatStr_) << DgString1((toChar ? "TO_CHAR" : - (toDate ? "TO_DATE" : "TO_TIME"))); + (toDate ? "TO_DATE" : "TO_TIME"))); bindWA->setErrStatus(); } break; @@ -4149,6 +4159,14 @@ NABoolean DateFormat::errorChecks(Lng32 frmt, BindWA *bindWA, } break; + case 9: + { + *CmpCommon::diags() << DgSqlCode(-3415) << DgString0("TO_TIME") + << DgString1(" It must be a datetime datatype containing the time field or a character datatype."); + bindWA->setErrStatus(); + } + break; + } // switch return TRUE; @@ -4333,28 +4351,23 @@ ItemExpr *Trim::bindNode(BindWA *bindWA) if (type1.getTypeQualifier() == NA_NUMERIC_TYPE) { const NumericType &numeric = (NumericType&)type1; - if ((numeric.isExact()) && - (NOT numeric.isBigNum()) && - (numeric.getScale() == 0)) - { - Lng32 dLen = - numeric.getDisplayLength(numeric.getFSDatatype(), - numeric.getNominalSize(), - numeric.getPrecision(), - numeric.getScale(), - 0); - - ItemExpr * newChild = - new (bindWA->wHeap()) - Cast(child(1), - new (bindWA->wHeap()) - SQLChar(bindWA->wHeap(), dLen, type1.supportsSQLnull())); - - newChild = newChild->bindNode(bindWA); - if (bindWA->errStatus()) - return this; - setChild(1, newChild); - } + Lng32 dLen = + numeric.getDisplayLength(numeric.getFSDatatype(), + numeric.getNominalSize(), + numeric.getPrecision(), + numeric.getScale(), + 0); + + ItemExpr * newChild = + new (bindWA->wHeap()) + Cast(child(1), + new (bindWA->wHeap()) + SQLChar(bindWA->wHeap(), dLen, type1.supportsSQLnull())); + + newChild = newChild->bindNode(bindWA); + if (bindWA->errStatus()) + return this; + setChild(1, newChild); } } @@ -7231,25 +7244,16 @@ ItemExpr *Case::bindNode(BindWA *bindWA) { NumericType &numeric = (NumericType&) thenClause->getValueId().getType(); - if ((numeric.isExact()) && - // (NOT numeric.isBigNum()) && - (numeric.getScale() == 0)) - { - Lng32 numericDLen = - numeric.getDisplayLength(numeric.getFSDatatype(), - numeric.getNominalSize(), - numeric.getPrecision(), - numeric.getScale(), - 0); + Lng32 numericDLen = + numeric.getDisplayLength(numeric.getFSDatatype(), + numeric.getNominalSize(), + numeric.getPrecision(), + numeric.getScale(), + 0); - if (numericDLen > dLen) - dLen = numericDLen; - numericFound = TRUE; - } - else - { - done = TRUE; - } + if (numericDLen > dLen) + dLen = numericDLen; + numericFound = TRUE; } else { @@ -8876,10 +8880,78 @@ ItemExpr *PositionFunc::bindNode(BindWA *bindWA) } } + // if third(start position) and fourth(occurence) child operands are + // specified, then convert them to INT. + if (child(2)) + { + ValueId vid3 = child(2)->getValueId(); + SQLInt si(NULL); + + vid3.coerceType(si, NA_NUMERIC_TYPE); + + const NAType &type3 = vid3.getType(); + + if (type3.getTypeQualifier() != NA_NUMERIC_TYPE) { + // 4053 The third operand of a POSITION function must be numeric. + *CmpCommon::diags() << DgSqlCode(-4053) << DgString0(getTextUpper()); + return NULL; + } + + if (((NumericType&)type3).getScale() != 0) { + // 4047 The third operand of a POSITION function must have a scale of 0. + *CmpCommon::diags() << DgSqlCode(-4047) << DgString0(getTextUpper()); + return NULL; + } + + if (type3.getFSDatatype() != REC_BIN32_SIGNED) + { + ItemExpr * newChild = + new (bindWA->wHeap()) + Cast(child(2), + new (bindWA->wHeap()) + SQLInt(bindWA->wHeap(), TRUE, type3.supportsSQLnull())); + newChild = newChild->bindNode(bindWA); + setChild(2, newChild); + } + } + + if (child(3)) + { + ValueId vid4 = child(3)->getValueId(); + SQLInt si(NULL); + + vid4.coerceType(si, NA_NUMERIC_TYPE); + + const NAType &type4 = vid4.getType(); + + if (type4.getTypeQualifier() != NA_NUMERIC_TYPE) { + // 4053 The third operand of a POSITION function must be numeric. + *CmpCommon::diags() << DgSqlCode(-4053) << DgString0(getTextUpper()); + return NULL; + } + + if (((NumericType&)type4).getScale() != 0) { + // 4047 The third operand of a POSITION function must have a scale of 0. + *CmpCommon::diags() << DgSqlCode(-4047) << DgString0(getTextUpper()); + return NULL; + } + + if (type4.getFSDatatype() != REC_BIN32_SIGNED) + { + ItemExpr * newChild = + new (bindWA->wHeap()) + Cast(child(3), + new (bindWA->wHeap()) + SQLInt(bindWA->wHeap(), TRUE, type4.supportsSQLnull())); + newChild = newChild->bindNode(bindWA); + setChild(3, newChild); + } + } + BuiltinFunction::bindNode(bindWA); if (bindWA->errStatus()) return this; - + return getValueId().getItemExpr(); } // PositionFunc::bindNode() @@ -8938,6 +9010,72 @@ ItemExpr *Replace::bindNode(BindWA *bindWA) return getValueId().getItemExpr(); } // Replace::bindNode() +// ----------------------------------------------------------------------- +// member functions for class CharLength +// ----------------------------------------------------------------------- + +ItemExpr *CharLength::bindNode(BindWA *bindWA) +{ + if (nodeIsBound()) + return getValueId().getItemExpr(); + + // this will bind/type-propagate all children. + bindChildren(bindWA); + if (bindWA->errStatus()) + return this; + + const NAType &type1 = + child(0)->castToItemExpr()->getValueId().getType(); + + if (type1.getTypeQualifier() == NA_NUMERIC_TYPE) + { + ItemExpr * newChild = new (bindWA->wHeap()) + Trim((Int32)Trim::TRAILING, + new (PARSERHEAP()) SystemLiteral(" ", WIDE_(" ")), child(0)); + + setChild(0, newChild); + } + + BuiltinFunction::bindNode(bindWA); + if (bindWA->errStatus()) + return this; + + return getValueId().getItemExpr(); +} // CharLength::bindNode() + +// ----------------------------------------------------------------------- +// member functions for class OctetLength +// ----------------------------------------------------------------------- + +ItemExpr *OctetLength::bindNode(BindWA *bindWA) +{ + if (nodeIsBound()) + return getValueId().getItemExpr(); + + // this will bind/type-propagate all children. + bindChildren(bindWA); + if (bindWA->errStatus()) + return this; + + const NAType &type1 = + child(0)->castToItemExpr()->getValueId().getType(); + + if (type1.getTypeQualifier() == NA_NUMERIC_TYPE) + { + ItemExpr * newChild = new (bindWA->wHeap()) + Trim((Int32)Trim::TRAILING, + new (PARSERHEAP()) SystemLiteral(" ", WIDE_(" ")), child(0)); + + setChild(0, newChild); + } + + BuiltinFunction::bindNode(bindWA); + if (bindWA->errStatus()) + return this; + + return getValueId().getItemExpr(); +} // OctetLength::bindNode() + // ----------------------------------------------------------------------- // member functions for class SelIndex // ----------------------------------------------------------------------- @@ -11013,7 +11151,29 @@ ItemExpr *ZZZBinderFunction::bindNode(BindWA *bindWA) } break; - case ITM_GREATEST: + case ITM_DAYOFMONTH: + { + // Make sure that the child is of date datatype. + ItemExpr * tempBoundTree = + child(0)->castToItemExpr()->bindNode(bindWA); + if (bindWA->errStatus()) + return this; + + if (tempBoundTree->getValueId().getType().getTypeQualifier() != + NA_DATETIME_TYPE) + { + // 4071 The operand of a DAYOFMONTH function must be a datetime. + *CmpCommon::diags() << DgSqlCode(-4071) << DgString0(getTextUpper()); + bindWA->setErrStatus(); + return this; + } + + parseTree = new(bindWA->wHeap()) + ExtractOdbc(REC_DATE_DAY, child(0), TRUE); + } + break; + + case ITM_GREATEST: { strcpy(buf, "CASE WHEN @A1 is NULL or @A2 is null then NULL WHEN @A1 > @A2 then @A1 else @A2 END;"); } @@ -11032,16 +11192,16 @@ ItemExpr *ZZZBinderFunction::bindNode(BindWA *bindWA) ItemExpr * tempBoundTree = child(2)->castToItemExpr()->bindNode(bindWA); if (bindWA->errStatus()) return this; - - // fix case 10-031103-2610, soln 10-031103-0997: make sure length arg - // in function "INSERT(s1, start, length, s2)" is not null. - if (tempBoundTree->getOperatorType() == ITM_CONSTANT && - ((ConstValue *)tempBoundTree)->isNull()) { - *CmpCommon::diags() << DgSqlCode(-4097) << DgString0("INSERT"); - bindWA->setErrStatus(); - return this; - } - + + // fix case 10-031103-2610, soln 10-031103-0997: make sure length arg + // in function "INSERT(s1, start, length, s2)" is not null. + if (tempBoundTree->getOperatorType() == ITM_CONSTANT && + ((ConstValue *)tempBoundTree)->isNull()) { + *CmpCommon::diags() << DgSqlCode(-4097) << DgString0("INSERT"); + bindWA->setErrStatus(); + return this; + } + // // Type cast any param. // @@ -11074,11 +11234,11 @@ ItemExpr *ZZZBinderFunction::bindNode(BindWA *bindWA) // beginning at and where has been inserted // into , beginning at - // make sure replacement expression handles any null args correctly - strcpy(buf, "CASE WHEN @A1 IS NULL THEN NULL" - " WHEN @A2 IS NULL THEN NULL" - " WHEN @A3 IS NULL THEN NULL" - " WHEN @A4 IS NULL THEN NULL ELSE "); + // make sure replacement expression handles any null args correctly + strcpy(buf, "CASE WHEN @A1 IS NULL THEN NULL" + " WHEN @A2 IS NULL THEN NULL" + " WHEN @A3 IS NULL THEN NULL" + " WHEN @A4 IS NULL THEN NULL ELSE "); // Get the characters before strcat(buf, "(LEFT(@A1, CAST(@A2 AS INT UNSIGNED) - 1)"); @@ -11549,11 +11709,27 @@ ItemExpr *ZZZBinderFunction::bindNode(BindWA *bindWA) case ITM_SIGN: { - // find the nullability of child ItemExpr * tempBoundTree = child(0)->castToItemExpr()->bindNode(bindWA); if (bindWA->errStatus()) return this; + // + // Type cast any param. + // + SQLInt nType(FALSE); + ValueId vid = tempBoundTree->castToItemExpr()->getValueId(); + vid.coerceType(nType, NA_NUMERIC_TYPE); + + const NAType &typ1 = vid.getType(); + if (typ1.getTypeQualifier() != NA_NUMERIC_TYPE) + { + // 4045 Operand must be numeric. + *CmpCommon::diags() << DgSqlCode(-4045) << DgString0(getTextUpper()); + bindWA->setErrStatus(); + return this; + } + + // find the nullability of child NABoolean childIsNullable = FALSE; if (tempBoundTree->getValueId().getType().supportsSQLnull()) { diff --git a/core/sql/optimizer/ItemCache.cpp b/core/sql/optimizer/ItemCache.cpp index 4639e2d960..b74447b02b 100644 --- a/core/sql/optimizer/ItemCache.cpp +++ b/core/sql/optimizer/ItemCache.cpp @@ -666,6 +666,14 @@ NABoolean ConstValue::isCacheableExpr(CacheWA& cwa) // This fixes genesis case 10-041215-6141, soln 10-041215-2826. return FALSE; } + + // string of length zero causes a problem during backpatching in method + // CacheData::backpatchParams. + // For now, do not cache it. + if ((NOT isNull()) && + (isEmptyString())) + return FALSE; + return ItemExpr::isCacheableExpr(cwa); } diff --git a/core/sql/optimizer/ItemExpr.cpp b/core/sql/optimizer/ItemExpr.cpp index 744a0a5075..c37a4d15e8 100644 --- a/core/sql/optimizer/ItemExpr.cpp +++ b/core/sql/optimizer/ItemExpr.cpp @@ -7503,6 +7503,8 @@ const NAString BuiltinFunction::getText() const return "current_user"; case ITM_DATEFORMAT: return "dateformat"; + case ITM_DAYOFMONTH: + return "dayofmonth"; case ITM_DAYOFWEEK: return "dayofweek"; case ITM_DO_WHILE: @@ -7758,6 +7760,9 @@ const NAString BuiltinFunction::getText() const case ITM_AGGR_GROUPING_FUNC: return "aggr_grouping"; + case ITM_TO_TIMESTAMP: + return "to_timestamp"; + default: return "unknown func"; } // switch @@ -8212,7 +8217,7 @@ ItemExpr * PositionFunc::copyTopNode(ItemExpr *derivedNode, CollHeap* outHeap) ItemExpr *result; if (derivedNode == NULL) - result = new (outHeap) PositionFunc(child(0), child(1), child(2)); + result = new (outHeap) PositionFunc(child(0), child(1), child(2), child(3)); else result = derivedNode; diff --git a/core/sql/optimizer/ItemFunc.h b/core/sql/optimizer/ItemFunc.h index 6c0c779a1b..0003740035 100644 --- a/core/sql/optimizer/ItemFunc.h +++ b/core/sql/optimizer/ItemFunc.h @@ -1610,6 +1610,9 @@ class CharLength : public CacheableBuiltinFunction // a virtual function for type propagating the node virtual const NAType * synthesizeType(); + // a virtual function for performing name binding within the query tree + virtual ItemExpr * bindNode(BindWA *bindWA); + virtual ItemExpr * copyTopNode(ItemExpr *derivedNode = NULL, CollHeap* outHeap = 0); @@ -1632,6 +1635,9 @@ class OctetLength : public CacheableBuiltinFunction // a virtual function for type propagating the node virtual const NAType * synthesizeType(); + // a virtual function for performing name binding within the query tree + virtual ItemExpr * bindNode(BindWA *bindWA); + virtual ItemExpr * copyTopNode(ItemExpr *derivedNode = NULL, CollHeap* outHeap = 0); virtual NABoolean protectFromVEGs() { return TRUE; }; @@ -1643,8 +1649,10 @@ class OctetLength : public CacheableBuiltinFunction class PositionFunc : public CacheableBuiltinFunction { public: - PositionFunc(ItemExpr *val1Ptr, ItemExpr *val2Ptr, ItemExpr *val3Ptr) - : CacheableBuiltinFunction(ITM_POSITION, 3, val1Ptr, val2Ptr, val3Ptr) + PositionFunc(ItemExpr *val1Ptr, ItemExpr *val2Ptr, ItemExpr *val3Ptr, + ItemExpr *val4Ptr) + : CacheableBuiltinFunction(ITM_POSITION, 4, + val1Ptr, val2Ptr, val3Ptr, val4Ptr) { allowsSQLnullArg() = FALSE; } // virtual destructor diff --git a/core/sql/optimizer/SynthType.cpp b/core/sql/optimizer/SynthType.cpp index 5dcb94e379..e97484c999 100644 --- a/core/sql/optimizer/SynthType.cpp +++ b/core/sql/optimizer/SynthType.cpp @@ -3548,7 +3548,7 @@ const NAType *BitOperFunc::synthesizeType() // now it's safe to cast the types to numeric type const NumericType &ntyp1 = (NumericType &) child(0)->getValueId().getType(); const NumericType &ntyp2 = (NumericType &) child(1)->getValueId().getType(); - + if (NOT ntyp1.isExact() OR NOT ntyp2.isExact() OR ntyp1.isBigNum() OR ntyp2.isBigNum()) { @@ -3582,7 +3582,7 @@ const NAType *BitOperFunc::synthesizeType() // now it's safe to cast the types to numeric type const NumericType &ntyp1 = (NumericType &) child(0)->getValueId().getType(); - + if (NOT ntyp1.isExact() OR ntyp1.isBigNum()) { // 4046 BIT operation is only defined for exact numeric types. @@ -4878,21 +4878,6 @@ const NAType *OctetLength::synthesizeType() const NAType *PositionFunc::synthesizeType() { - NABoolean JDBC = (CmpCommon::getDefault(JDBC_PROCESS) == DF_ON); - if ((NOT JDBC) && (getArity() == 3)) - { - // third argument not supported for non-JDBC callers. - *CmpCommon::diags() << DgSqlCode(-3131); - return NULL; - } - else - { - // third argument is only supported for JDBC_PROCESS callers and - // is ignored. This is done for WLS/JDBC project who only want - // to not get a syntax error if a third argument is passed in. - // Go figure. - // They need this to get through some certification tests. - } // // Type cast any params. @@ -4907,15 +4892,8 @@ const NAType *PositionFunc::synthesizeType() const NAType *operand1 = &vid1.getType(); const NAType *operand2 = &vid2.getType(); const NAType *operand3 = NULL; + const NAType *operand4 = NULL; - if (getArity() == 3) - { - ValueId vid3 = child(2)->getValueId(); - SQLInt si(NULL); - - vid3.coerceType(si, NA_NUMERIC_TYPE); - operand3 = &vid3.getType(); - } // // Check that the operands are comparable. @@ -4942,19 +4920,6 @@ const NAType *PositionFunc::synthesizeType() return NULL; } - if (operand3) { - if (operand3->getTypeQualifier() != NA_NUMERIC_TYPE) { - // 4053 The third operand of a POSITION function must be numeric. - *CmpCommon::diags() << DgSqlCode(-4053) << DgString0(getTextUpper()); - return NULL; - } - - if (((NumericType*)operand3)->getScale() != 0) { - // 4047 The third operand of a POSITION function must have a scale of 0. - *CmpCommon::diags() << DgSqlCode(-4047) << DgString0(getTextUpper()); - return NULL; - } - } // 1/5/98: make sure position pattern and source types are comparable. const CharType *posPat = (CharType*)operand1; diff --git a/core/sql/optimizer/ValueDesc.cpp b/core/sql/optimizer/ValueDesc.cpp index 605118b9d0..a39040fcd5 100644 --- a/core/sql/optimizer/ValueDesc.cpp +++ b/core/sql/optimizer/ValueDesc.cpp @@ -6258,7 +6258,6 @@ void ValueIdList::convertToTextKey(const ValueIdList& keyList, NAString& result) const NAType *constType = constVal->getType(); NAString val = *constVal->getRawText(); - // val = val.strip(NAString::leading, ' '); short len = 0; /////////////////////////////////////////////////////////////////////// @@ -6381,35 +6380,47 @@ void ValueIdList::convertToTextKey(const ValueIdList& keyList, NAString& result) } else { - short vLen = val.length(); + short vLen = val.length(); if ((constType->getTypeQualifier() == NA_NUMERIC_TYPE) && (((NumericType*)constType)->isExact()) && - (NOT ((NumericType&)type).isBigNum()) && + (NOT ((NumericType*)constType)->isBigNum()) && (constType->getScale() > 0)) { - NAString newVal; - if (vLen <= constType->getScale()) - { - newVal = "0."; - for (Lng32 i = 0; i < (constType->getScale() - vLen); i++) - { - newVal += "0"; - } - newVal += val; - } - else - { - // get digits to the left of scale - newVal = val(0, vLen - constType->getScale() ); - - newVal += "."; - newVal += val(vLen - constType->getScale(), constType->getScale()); - } + // See how many positions the result will take in the display + Lng32 t = constType->getDisplayLength(constType->getFSDatatype(), + constType->getNominalSize(), + constType->getPrecision(), + constType->getScale(), + 0); + + char strval[100]; + memset( strval, ' ', t ); + + // Get the ASCII representation + ex_expr::exp_return_type retcode = + convDoIt((char*)constVal->getConstValue(), + constVal->getStorageSize(), + (short)constType->getFSDatatype(), + constType->getPrecision(), + constType->getScale(), + strval, + t, // target length + REC_BYTE_F_ASCII, // target type + 0, // no char limit + SQLCHARSETCODE_ISO88591, // ISO 8859-1 + NULL, // no vc length + 0); // not a varchar + + if ( retcode == ex_expr::EXPR_OK ) + { + strval[t] = 0; + val = strval; + val = val.strip(NAString::trailing, ' '); + } - val = newVal; vLen = val.length(); - } + } // exact numeric len += vLen; diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y index d7ea7f2294..f2c9fbb915 100755 --- a/core/sql/parser/sqlparser.y +++ b/core/sql/parser/sqlparser.y @@ -8767,7 +8767,11 @@ datetime_misc_function : TOK_CONVERTTIMESTAMP '(' value_expression ')' { $$ = new (PARSERHEAP()) ZZZBinderFunction(ITM_FIRSTDAYOFYEAR, $3); } - + + | TOK_DAYOFMONTH '(' value_expression ')' + { + $$ = new (PARSERHEAP()) ZZZBinderFunction(ITM_DAYOFMONTH, $3); + } | TOK_MONTHNAME '(' value_expression ')' { $$ = new (PARSERHEAP()) ZZZBinderFunction(ITM_MONTHNAME, $3); @@ -8805,12 +8809,6 @@ datetime_misc_function : TOK_CONVERTTIMESTAMP '(' value_expression ')' ExtractOdbc(REC_DATE_DAY, $3, TRUE); } - | TOK_DAYOFMONTH '(' value_expression ')' - { - $$ = new(PARSERHEAP()) - ExtractOdbc(REC_DATE_DAY, $3, - TRUE); - } | TOK_HOUR '(' value_expression ')' { $$ = new(PARSERHEAP()) @@ -9011,14 +9009,14 @@ string_function : /* POSITION(str-exp1 IN str-exp2) */ | TOK_LOCATE '(' value_expression ',' value_expression ')' { - $$ = new (PARSERHEAP()) PositionFunc($3,$5,NULL); + $$ = new (PARSERHEAP()) PositionFunc($3,$5,NULL,NULL); } /* ODBC extension: map LOCATE(str-exp1, str-exp2, START) to */ /* POSITION(str-exp1 IN str-exp2) */ | TOK_LOCATE '(' value_expression ',' value_expression ',' value_expression ')' { - $$ = new (PARSERHEAP()) PositionFunc($3,$5,$7); + $$ = new (PARSERHEAP()) PositionFunc($3,$5,$7,NULL); } | TOK_LPAD '(' value_expression ',' value_expression ')' @@ -9059,14 +9057,25 @@ string_function : | TOK_POSITION '(' value_expression TOK_IN value_expression ')' { - $$ = new (PARSERHEAP()) PositionFunc($3,$5,NULL); + $$ = new (PARSERHEAP()) PositionFunc($3,$5,NULL,NULL); } | TOK_INSTR '(' value_expression TOK_IN value_expression ')' { - CheckModeSpecial4; + $$ = new (PARSERHEAP()) PositionFunc($3,$5,NULL,NULL); + } - $$ = new (PARSERHEAP()) PositionFunc($5,$3,NULL); + | TOK_INSTR '(' value_expression ',' value_expression ')' + { + $$ = new (PARSERHEAP()) PositionFunc($5,$3,NULL,NULL); + } + | TOK_INSTR '(' value_expression ',' value_expression ',' value_expression ')' + { + $$ = new (PARSERHEAP()) PositionFunc($5,$3,$7,NULL); + } + | TOK_INSTR '(' value_expression ',' value_expression ',' value_expression ',' value_expression ')' + { + $$ = new (PARSERHEAP()) PositionFunc($5,$3,$7,$9); } /* ODBC extension */ @@ -16790,6 +16799,12 @@ exe_util_hive_query : TOK_PROCESS TOK_HIVE TOK_STATEMENT QUOTED_STRING ExeUtilHiveQuery(*$4, ExeUtilHiveQuery::FROM_STRING, PARSERHEAP()); } + | TOK_PROCESS TOK_HIVE TOK_DDL QUOTED_STRING + { + $$ = new (PARSERHEAP()) + ExeUtilHiveQuery(*$4, ExeUtilHiveQuery::FROM_STRING, + PARSERHEAP()); + } | TOK_PROCESS TOK_HIVE TOK_STATEMENT TOK_FROM TOK_FILE QUOTED_STRING { $$ = new (PARSERHEAP()) diff --git a/core/sql/regress/compGeneral/EXPECTED006.SB b/core/sql/regress/compGeneral/EXPECTED006.SB index bc0a75d175..945d64d9f3 100644 --- a/core/sql/regress/compGeneral/EXPECTED006.SB +++ b/core/sql/regress/compGeneral/EXPECTED006.SB @@ -296,10 +296,7 @@ >>prepare xx from select char_length(a) from t006t2; -*** ERROR[4043] The operand of function CHARACTER_LENGTH, CHAR_LENGTH, or LENGTH must be character. - -*** ERROR[8822] The statement was not prepared. - +--- SQL command prepared. >>prepare xx from select lower(a) from t006t2; *** ERROR[4043] The operand of function LOWER or LCASE must be character. @@ -308,10 +305,7 @@ >>prepare xx from select octet_length(a) from t006t2; -*** ERROR[4043] The operand of function OCTET_LENGTH must be character. - -*** ERROR[8822] The statement was not prepared. - +--- SQL command prepared. >> >>-- Error 4045 >>prepare xx from select zeroifnull(a) from t006t1; diff --git a/core/sql/regress/compGeneral/EXPECTED042 b/core/sql/regress/compGeneral/EXPECTED042 index e766c486dc..1cd8b5faa0 100644 --- a/core/sql/regress/compGeneral/EXPECTED042 +++ b/core/sql/regress/compGeneral/EXPECTED042 @@ -1,9 +1,9 @@ >>showstats for table t042_orderline on ol_o_id detail; Detailed Histogram data for Table TRAFODION.ORDERENTRY.T042_ORDERLINE -Table ID: 1700229370398217975 +Table ID: 8379103414832633643 -Hist ID: 767276153 +Hist ID: 1428267625 Column(s): OL_O_ID Total Rows: 10 Total UEC: 4 @@ -1724,10 +1724,6 @@ HQC::AddEntry(): passed SQL query=select '0123456789' from t042_t1; HQC key=SELECT #NP# FROM T042_T1 ; -HQC::AddEntry(): passed -SQL query=select '' from t042_t1; -HQC key=SELECT #NP# FROM T042_T1 ; - HQC::AddEntry(): passed SQL query=select b from t042_t1 where a like 'BOO_%'; HQC key=SELECT B FROM T042_T1 WHERE A LIKE #NP# ; @@ -1763,18 +1759,18 @@ HQC key=SELECT T . VARCHAR0_UNIQ AS T_VARCHAR0_UNIQ , T . CHAR2_2 AS T_CHAR2_2 , >>-- test compile time >> >>sh more /proc/loadavg | cut -d' ' -f 1-3 | sed -e 's/^/System load: /' >> LOG042; -System load: 0.37 0.36 0.74 +System load: 1.39 2.74 2.71 >>sh grep "model name" /proc/cpuinfo | head -1 | cut -d '@' -f 2 | sed -e 's/^/CPU frequency: /' >> LOG042; -CPU frequency: 2.40GHz +CPU frequency: model name : Intel Core Processor (Haswell) >>set statistics on; >>prepare xx from select * from t042_orderline where ol_o_id = 1 ; --- SQL command prepared. -Start Time 2017/01/31 17:26:48.806392 -End Time 2017/01/31 17:26:48.808005 -Elapsed Time 00:00:00.001613 -Compile Time 00:00:00.001613 +Start Time 2018/03/22 01:04:54.921227 +End Time 2018/03/22 01:04:54.924930 +Elapsed Time 00:00:00.003703 +Compile Time 00:00:00.003703 Execution Time 00:00:00.000000 @@ -1805,10 +1801,10 @@ HQC key=SELECT * FROM T042_ORDERLINE WHERE OL_O_ID = #NP# ; --- SQL command prepared. -Start Time 2017/01/31 17:26:48.970491 -End Time 2017/01/31 17:26:48.972007 -Elapsed Time 00:00:00.001516 -Compile Time 00:00:00.001516 +Start Time 2018/03/22 01:04:55.115150 +End Time 2018/03/22 01:04:55.117539 +Elapsed Time 00:00:00.002389 +Compile Time 00:00:00.002389 Execution Time 00:00:00.000000 @@ -1841,7 +1837,7 @@ HQC key=SELECT * FROM T042_ORDERLINE WHERE OL_O_ID = #NP# ; NUM_ENTRIES TEXT_ENTRIES NUM_PLANS ----------- ------------ ---------- - 65 10 65 + 64 9 64 --- 1 row(s) selected. >>select num_entries, text_entries, num_plans from table(querycache('meta', 'local')); @@ -1849,7 +1845,7 @@ NUM_ENTRIES TEXT_ENTRIES NUM_PLANS NUM_ENTRIES TEXT_ENTRIES NUM_PLANS ----------- ------------ ---------- - 31 0 31 + 22 0 22 2 0 2 --- 2 row(s) selected. @@ -1861,8 +1857,8 @@ NUM_ENTRIES TEXT_ENTRIES NUM_PLANS NUM_ENTRIES TEXT_ENTRIES NUM_PLANS ----------- ------------ ---------- - 65 10 65 - 31 0 31 + 64 9 64 + 22 0 22 2 0 2 --- 3 row(s) selected. @@ -1875,8 +1871,6 @@ NUM_ENTRIES TEXT_ENTRIES NUM_PLANS NUM_HITS NUM_PARAMS (EXPR) (EXPR) ---------- ---------- ---------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 0 0 ====QUERY: select '' from t042_t1; - 0 0 ====QUERY: select '' from t042_t1; 0 0 ====QUERY: select '0123456789' from t042_t1; 0 0 ====QUERY: select * from t042_BTA1P006; 0 0 ====QUERY: select * from t042_ORDERLINE where OL_DIST_INFO like 'DoIQ%'; @@ -1951,48 +1945,39 @@ NUM_HITS NUM_PARAMS (EXPR) (EXPR) 1 9 ====QUERY: select bitand(1,2), bitor(0,1), bitxor(0,0),bitnot(0), abs(-1) from t042_ORDERLINE; 5 1 ====QUERY: select * from t042_orderline where ol_o_id = 1 ; ---- 75 row(s) selected. +--- 73 row(s) selected. >>select num_hits, num_params, '====QUERY:', cast(substring(text, 1, 200) as char(200 bytes) character set utf8) +> from table(querycacheentries('meta', 'local')) order by 1,2,4; NUM_HITS NUM_PARAMS (EXPR) (EXPR) ---------- ---------- ---------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 0 1 ====QUERY: SELECT COMPONENT_UID, OPERATION_CODE, GRANTEE_ID, GRANTOR_ID, GRANTEE_NAME, GRANTOR_NAME, GRANT_DEPTH FROM TRAFODION."_PRIVMGR_MD_".COMPONENT_PRIVILEGES WHERE COMPONENT_UID = 1 AND OPERATION_CODE IN ( - 0 1 ====QUERY: SELECT COMPONENT_UID, OPERATION_CODE, GRANTEE_ID, GRANTOR_ID, GRANTEE_NAME, GRANTOR_NAME, GRANT_DEPTH FROM TRAFODION."_PRIVMGR_MD_".COMPONENT_PRIVILEGES WHERE COMPONENT_UID = 1 AND OPERATION_CODE IN ( - 0 1 ====QUERY: SELECT OBJECT_UID, OBJECT_NAME, OBJECT_TYPE, GRANTEE_ID, GRANTEE_NAME, GRANTEE_TYPE, GRANTOR_ID, GRANTOR_NAME, GRANTOR_TYPE, PRIVILEGES_BITMAP, GRANTABLE_BITMAP FROM TRAFODION."_PRIVMGR_MD_".OBJECT_PR - 0 1 ====QUERY: SELECT object_uid,object_name,grantee_id,grantee_name,grantor_id,grantor_name,column_number,privileges_bitmap,grantable_bitmap FROM TRAFODION."_PRIVMGR_MD_".COLUMN_PRIVILEGES where object_uid = 170022 - 0 1 ====QUERY: select check_option, is_updatable, is_insertable from TRAFODION."_MD_".VIEWS where view_uid = 1700229370398217975 for read committed access - 0 1 ====QUERY: select is_audited, num_salt_partns, row_format, flags from TRAFODION."_MD_".TABLES where table_uid = 1700229370398217975 for read committed access - 0 1 ====QUERY: select trim(O.catalog_name || '.' || '"' || O.schema_name || '"' || '.' || '"' || O.object_name || '"' ) constr_name, trim(O2.catalog_name || '.' || '"' || O2.schema_name || '"' || '.' || '"' || O2.ob - 0 1 ====QUERY: select trim(O.catalog_name || '.' || '"' || O.schema_name || '"' || '.' || '"' || O.object_name || '"' ) constr_name, trim(O2.catalog_name || '.' || '"' || O2.schema_name || '"' || '.' || '"' || O2.ob - 0 2 ====QUERY: select O.catalog_name, O.schema_name, O.object_name, I.keytag, I.is_unique, I.is_explicit, I.key_colcount, I.nonkey_colcount, T.num_salt_partns, T.row_format, I.index_uid from TRAFODION."_MD_".INDEXES + 0 1 ====QUERY: select is_audited, num_salt_partns, row_format, flags from TRAFODION."_MD_".TABLES where table_uid = 8379103414832633643 for read committed access 0 2 ====QUERY: select column_name, column_number, column_class, fs_data_type, column_size, column_precision, column_scale, datetime_start_field, datetime_end_field, trim(is_upshifted), column_flags, nullable, trim(c - 0 2 ====QUERY: select column_name, column_number, keyseq_number, ordering , cast(0 as int not null) from TRAFODION."_MD_".KEYS where object_uid = 1700229370398218011 for read committed access order by keyseq_number - 0 2 ====QUERY: select column_name, column_number, keyseq_number, ordering , cast(0 as int not null) from TRAFODION."_MD_".KEYS where object_uid = 1700229370398222005 for read committed access order by keyseq_number - 0 3 ====QUERY: select O.object_name, C.constraint_type, C.col_count, C.constraint_uid, C.enforced, C.flags from TRAFODION."_MD_".OBJECTS O, TRAFODION."_MD_".TABLE_CONSTRAINTS C where O.catalog_name = 'TRAFODION' and - 0 3 ====QUERY: select column_name, column_number, keyseq_number, ordering, cast(0 as int not null) from TRAFODION."_MD_".KEYS where object_uid = 1700229370398217975 and nonkeycol = 0 for read committed access order - 0 4 ====QUERY: select object_uid, object_owner, schema_owner, flags from TRAFODION."_MD_".OBJECTS where catalog_name = 'TRAFODION' and schema_name = '_MD_' and object_name = 'OBJECTS' and object_type = 'BT'; - 0 4 ====QUERY: select object_uid, object_type from TRAFODION."_MD_".OBJECTS where catalog_name = 'TRAFODION' and schema_name = 'ORDERENTRY' and object_name = 'DESCRIBE__' and object_type = ' ' - 0 5 ====QUERY: select object_uid, object_owner, schema_owner, flags from TRAFODION."_MD_".OBJECTS where catalog_name = 'TRAFODION' and schema_name = 'ORDERENTRY' and object_name = 'T042_ORDERLINE' and object_type = - 1 1 ====QUERY: SELECT COMPONENT_UID, OPERATION_CODE, GRANTEE_ID, GRANTOR_ID, GRANTEE_NAME, GRANTOR_NAME, GRANT_DEPTH FROM TRAFODION."_PRIVMGR_MD_".COMPONENT_PRIVILEGES WHERE COMPONENT_UID = 1 AND OPERATION_CODE IN ( - 1 1 ====QUERY: SELECT COMPONENT_UID, OPERATION_CODE, GRANTEE_ID, GRANTOR_ID, GRANTEE_NAME, GRANTOR_NAME, GRANT_DEPTH FROM TRAFODION."_PRIVMGR_MD_".COMPONENT_PRIVILEGES WHERE COMPONENT_UID = 1 AND OPERATION_CODE IN ( - 1 1 ====QUERY: SELECT OBJECT_UID, OBJECT_NAME, OBJECT_TYPE, GRANTEE_ID, GRANTEE_NAME, GRANTEE_TYPE, GRANTOR_ID, GRANTOR_NAME, GRANTOR_TYPE, PRIVILEGES_BITMAP, GRANTABLE_BITMAP FROM TRAFODION."_PRIVMGR_MD_".OBJECT_PR - 1 1 ====QUERY: SELECT object_uid,object_name,grantee_id,grantee_name,grantor_id,grantor_name,column_number,privileges_bitmap,grantable_bitmap FROM TRAFODION."_PRIVMGR_MD_".COLUMN_PRIVILEGES where object_uid = 170022 - 1 1 ====QUERY: select check_option, is_updatable, is_insertable from TRAFODION."_MD_".VIEWS where view_uid = 1700229370398220983 for read committed access - 1 1 ====QUERY: select is_audited, num_salt_partns, row_format, flags from TRAFODION."_MD_".TABLES where table_uid = 1700229370398220983 for read committed access - 1 2 ====QUERY: select O.catalog_name, O.schema_name, O.object_name, I.keytag, I.is_unique, I.is_explicit, I.key_colcount, I.nonkey_colcount, T.num_salt_partns, T.row_format, I.index_uid from TRAFODION."_MD_".INDEXES + 0 3 ====QUERY: select column_name, column_number, keyseq_number, ordering, cast(0 as int not null) from TRAFODION."_MD_".KEYS where object_uid = 8379103414832633643 and nonkeycol = 0 for read committed access order + 0 4 ====QUERY: select object_uid, object_owner, schema_owner, flags, create_time from TRAFODION."_MD_".OBJECTS where catalog_name = 'TRAFODION' and schema_name = 'ORDERENTRY' and object_name = 'DESCRIBE__' and obje + 0 4 ====QUERY: select object_uid, object_owner, schema_owner, flags, create_time from TRAFODION."_MD_".OBJECTS where catalog_name = 'TRAFODION' and schema_name = '_MD_' and object_name = 'OBJECTS' and object_type = + 0 5 ====QUERY: select object_uid, object_owner, schema_owner, flags, create_time from TRAFODION."_MD_".OBJECTS where catalog_name = 'TRAFODION' and schema_name = 'ORDERENTRY' and object_name = 'T042_ORDERLINE' and + 1 1 ====QUERY: select is_audited, num_salt_partns, row_format, flags from TRAFODION."_MD_".TABLES where table_uid = 8379103414832637810 for read committed access + 1 1 ====QUERY: select trim(O.catalog_name || '.' || '"' || O.schema_name || '"' || '.' || '"' || O.object_name || '"' ) constr_name, trim(O2.catalog_name || '.' || '"' || O2.schema_name || '"' || '.' || '"' || O2.ob 1 2 ====QUERY: select column_name, column_number, column_class, fs_data_type, column_size, column_precision, column_scale, datetime_start_field, datetime_end_field, trim(is_upshifted), column_flags, nullable, trim(c - 1 3 ====QUERY: select O.object_name, C.constraint_type, C.col_count, C.constraint_uid, C.enforced, C.flags from TRAFODION."_MD_".OBJECTS O, TRAFODION."_MD_".TABLE_CONSTRAINTS C where O.catalog_name = 'TRAFODION' and - 1 3 ====QUERY: select column_name, column_number, keyseq_number, ordering, cast(0 as int not null) from TRAFODION."_MD_".KEYS where object_uid = 1700229370398220983 and nonkeycol = 0 for read committed access order - 1 5 ====QUERY: select object_uid, object_owner, schema_owner, flags from TRAFODION."_MD_".OBJECTS where catalog_name = 'TRAFODION' and schema_name = 'ORDERENTRY' and object_name = 'T042_T1' and object_type = 'BT' + 1 2 ====QUERY: select column_name, column_number, keyseq_number, ordering , cast(0 as int not null) from TRAFODION."_MD_".KEYS where object_uid = 8379103414832633687 for read committed access order by keyseq_number + 1 3 ====QUERY: select column_name, column_number, keyseq_number, ordering, cast(0 as int not null) from TRAFODION."_MD_".KEYS where object_uid = 8379103414832637810 and nonkeycol = 0 for read committed access order + 1 5 ====QUERY: select object_uid, object_owner, schema_owner, flags, create_time from TRAFODION."_MD_".OBJECTS where catalog_name = 'TRAFODION' and schema_name = 'ORDERENTRY' and object_name = 'T042_T1' and object_ + 2 1 ====QUERY: SELECT COMPONENT_UID, OPERATION_CODE, GRANTEE_ID, GRANTOR_ID, GRANTEE_NAME, GRANTOR_NAME, GRANT_DEPTH FROM TRAFODION."_PRIVMGR_MD_".COMPONENT_PRIVILEGES WHERE COMPONENT_UID = 1 AND OPERATION_CODE IN ( + 2 1 ====QUERY: SELECT COMPONENT_UID, OPERATION_CODE, GRANTEE_ID, GRANTOR_ID, GRANTEE_NAME, GRANTOR_NAME, GRANT_DEPTH FROM TRAFODION."_PRIVMGR_MD_".COMPONENT_PRIVILEGES WHERE COMPONENT_UID = 1 AND OPERATION_CODE IN ( 2 1 ====QUERY: SELECT HISTOGRAM_ID, COLUMN_NUMBER, COLCOUNT, INTERVAL_COUNT, ROWCOUNT, TOTAL_UEC, JULIANTIMESTAMP(STATS_TIME), LOW_VALUE, HIGH_VALUE, JULIANTIMESTAMP(READ_TIME), READ_COUNT, SAMPLE_SECS, COL_SECS, SA 2 1 ====QUERY: SELECT HISTOGRAM_ID, INTERVAL_NUMBER, INTERVAL_ROWCOUNT, INTERVAL_UEC, INTERVAL_BOUNDARY, CAST(STD_DEV_OF_FREQ AS DOUBLE PRECISION), V1, V2, V5 FROM TRAFODION.ORDERENTRY.SB_HISTOGRAM_INTERVALS WHERE T - 2 3 ====QUERY: select octet_length(text), text from TRAFODION."_MD_".TEXT where text_uid = 1700229370398217975 and text_type = 2 and sub_id = 0 for read committed access order by seq_num - 3 3 ====QUERY: select octet_length(text), text from TRAFODION."_MD_".TEXT where text_uid = 1700229370398220983 and text_type = 2 and sub_id = 0 for read committed access order by seq_num - 12 4 ====QUERY: select object_uid, object_owner, schema_owner, flags from TRAFODION."_MD_".OBJECTS where catalog_name = 'TRAFODION' and schema_name = '_MD_' and object_name = 'TABLES' and object_type = 'BT'; - ---- 33 row(s) selected. + 2 1 ====QUERY: SELECT OBJECT_UID, OBJECT_NAME, OBJECT_TYPE, GRANTEE_ID, GRANTEE_NAME, GRANTEE_TYPE, GRANTOR_ID, GRANTOR_NAME, GRANTOR_TYPE, PRIVILEGES_BITMAP, GRANTABLE_BITMAP FROM TRAFODION."_PRIVMGR_MD_".OBJECT_PR + 2 1 ====QUERY: SELECT object_uid,object_name,grantee_id,grantee_name,grantor_id,grantor_name,column_number,privileges_bitmap,grantable_bitmap FROM TRAFODION."_PRIVMGR_MD_".COLUMN_PRIVILEGES where object_uid = 837910 + 2 1 ====QUERY: select check_option, is_updatable, is_insertable from TRAFODION."_MD_".VIEWS where view_uid = 8379103414832633643 for read committed access + 2 2 ====QUERY: select O.catalog_name, O.schema_name, O.object_name, I.keytag, I.is_unique, I.is_explicit, I.key_colcount, I.nonkey_colcount, T.num_salt_partns, T.row_format, I.index_uid from TRAFODION."_MD_".INDEXES + 2 3 ====QUERY: select O.object_name, C.constraint_type, C.col_count, C.constraint_uid, C.enforced, C.flags from TRAFODION."_MD_".OBJECTS O, TRAFODION."_MD_".TABLE_CONSTRAINTS C where O.catalog_name = 'TRAFODION' and + 2 3 ====QUERY: select octet_length(text), text from TRAFODION."_MD_".TEXT where text_uid = 8379103414832633643 and text_type = 2 and sub_id = 0 for read committed access order by seq_num + 3 3 ====QUERY: select octet_length(text), text from TRAFODION."_MD_".TEXT where text_uid = 8379103414832637810 and text_type = 2 and sub_id = 0 for read committed access order by seq_num + 12 4 ====QUERY: select object_uid, object_owner, schema_owner, flags, create_time from TRAFODION."_MD_".OBJECTS where catalog_name = 'TRAFODION' and schema_name = '_MD_' and object_name = 'TABLES' and object_type = + +--- 24 row(s) selected. >>select num_hits, num_params, '====QUERY:', cast(substring(text, 1, 200) as char(200 bytes) character set utf8) +> from table(querycacheentries('ustats', 'local')) order by 1,2,4; @@ -2002,7 +1987,7 @@ NUM_HITS NUM_PARAMS (EXPR) (EXPR) (EXPR) -------------------- - 108 + 97 --- 1 row(s) selected. >>-- should be the sum of the user, meta and ustats caches @@ -2014,7 +1999,7 @@ NUM_HITS NUM_PARAMS (EXPR) (EXPR) NUM_HKEYS NUM_SKEYS NUM_MAX_VALUES_PER_KEY NUM_HASH_TABLE_BUCKETS ---------- ---------- ---------------------- ---------------------- - 37 60 5 211 + 37 59 5 211 --- 1 row(s) selected. >>select * from table(hybridquerycache('meta', 'local')); @@ -2022,7 +2007,7 @@ NUM_HKEYS NUM_SKEYS NUM_MAX_VALUES_PER_KEY NUM_HASH_TABLE_BUCKETS NUM_HKEYS NUM_SKEYS NUM_MAX_VALUES_PER_KEY NUM_HASH_TABLE_BUCKETS ---------- ---------- ---------------------- ---------------------- - 29 31 5 211 + 21 22 5 211 2 2 5 211 --- 2 row(s) selected. @@ -2034,8 +2019,8 @@ NUM_HKEYS NUM_SKEYS NUM_MAX_VALUES_PER_KEY NUM_HASH_TABLE_BUCKETS NUM_HKEYS NUM_SKEYS NUM_MAX_VALUES_PER_KEY NUM_HASH_TABLE_BUCKETS ---------- ---------- ---------------------- ---------------------- - 37 60 5 211 - 29 31 5 211 + 37 59 5 211 + 21 22 5 211 2 2 5 211 --- 3 row(s) selected. @@ -2063,7 +2048,6 @@ NUM_HITS NUM_PLITERALS NUM_NPLITERALS 0 0 1 0 0 1 0 0 1 - 0 0 1 0 0 2 0 0 2 0 0 2 @@ -2106,25 +2090,14 @@ NUM_HITS NUM_PLITERALS NUM_NPLITERALS 1 4 0 5 1 0 ---- 60 row(s) selected. +--- 59 row(s) selected. >>select num_hits, num_PLiterals, num_NPLiterals from table(hybridquerycacheentries('meta', 'local')) order by 1, 2, 3; NUM_HITS NUM_PLITERALS NUM_NPLITERALS ---------- ------------- -------------- 0 1 0 - 0 1 0 - 0 1 0 - 0 1 0 - 0 1 10 - 0 1 10 - 0 1 14 - 0 1 14 - 0 2 1 - 0 2 1 0 2 1 - 0 2 3 - 0 3 1 0 3 1 0 3 1 0 4 0 @@ -2133,20 +2106,22 @@ NUM_HITS NUM_PLITERALS NUM_NPLITERALS 0 5 0 0 5 0 1 1 0 - 1 1 0 - 1 1 0 - 1 1 0 - 1 1 10 - 1 1 10 + 1 1 14 + 1 2 1 1 2 1 - 1 2 3 1 3 1 2 1 0 + 2 1 0 + 2 1 0 + 2 1 0 2 1 1 + 2 1 10 + 2 1 10 + 2 2 3 2 3 0 3 3 0 ---- 33 row(s) selected. +--- 24 row(s) selected. >>select num_hits, num_PLiterals, num_NPLiterals from table(hybridquerycacheentries('ustats', 'local')) order by 1, 2, 3; --- 0 row(s) selected. @@ -2155,7 +2130,7 @@ NUM_HITS NUM_PLITERALS NUM_NPLITERALS (EXPR) -------------------- - 93 + 83 --- 1 row(s) selected. >>-- should be the sum of the user, meta and ustats caches @@ -2243,7 +2218,7 @@ book row2 NUM_ENTRIES TEXT_ENTRIES NUM_PLANS ----------- ------------ ---------- - 4 4 4 + 3 3 3 0 0 0 0 0 0 @@ -2253,7 +2228,7 @@ NUM_ENTRIES TEXT_ENTRIES NUM_PLANS NUM_HKEYS NUM_SKEYS NUM_MAX_VALUES_PER_KEY NUM_HASH_TABLE_BUCKETS ---------- ---------- ---------------------- ---------------------- - 2 3 5 211 + 2 2 5 211 0 0 5 211 0 0 5 211 diff --git a/core/sql/regress/core/EXPECTED038.LINUX b/core/sql/regress/core/EXPECTED038.LINUX index 3d86052e36..d317748880 100644 --- a/core/sql/regress/core/EXPECTED038.LINUX +++ b/core/sql/regress/core/EXPECTED038.LINUX @@ -127,10 +127,12 @@ EMPNUM FIRSTNAME LASTNAME AGE SALARY >>select * from T038edat +> where {fn locate('ma', {fn concat(first_name, last_name)}, 1)} > 0; -*** ERROR[3131] The statement just entered is currently not supported. +EMPNUM FIRST_NAME LAST_NAME +----------- -------------------- -------------------- -*** ERROR[8822] The statement was not prepared. + 300 ARUN Thomas +--- 1 row(s) selected. >> >>select {fn lcase(first_name)} from T038edat; @@ -243,10 +245,10 @@ ORDER_NUM ORDER_DATE ORDER_TIME ORDER_QTY ----------- ---------- ---------- ----------- 100 1997-01-30 13:40:05 1000 - 200 2017-06-05 21:43:42 99 + 200 2018-03-08 04:11:27 99 300 1996-08-10 10:20:10 6000 - 400 1997-05-12 21:43:42 99 - 500 2017-06-05 21:43:42 99 + 400 1997-05-12 04:11:27 99 + 500 2018-03-08 04:11:27 99 --- 5 row(s) selected. >> @@ -264,7 +266,7 @@ ORDER_NUM ORDER_DATE ORDER_TIME ORDER_QTY T038PART_NUM ORDER_TIME ------------ -------------------------- - 600 2017-06-05 21:43:45.699265 + 600 2018-03-08 04:11:32.295835 --- 1 row(s) selected. >> @@ -661,8 +663,8 @@ GANESAN DEV YOW EMPNUM EMPNAME DEPTNUM DEPTNUM DEPTNAME MANAGER UNITNUM DEPTNUM REVENVUE ----------- -------------------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ - 100 BHAVE 6400 6400 DEV YOW 101 6400 10000.000 100 RAO 6500 6500 QA DENNIS ? ? ? + 100 BHAVE 6400 6400 DEV YOW 101 6400 10000.000 100 GANESAN 6400 6400 DEV YOW 101 6400 10000.000 --- 3 row(s) selected. @@ -674,8 +676,8 @@ EMPNUM EMPNAME DEPTNUM DEPTNUM DEPTNAME EMPNUM EMPNAME DEPTNUM DEPTNUM DEPTNAME MANAGER UNITNUM DEPTNUM REVENVUE ----------- -------------------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ - 100 RAO 6500 6500 QA DENNIS ? ? ? 100 BHAVE 6400 6400 DEV YOW 101 6400 10000.000 + 100 RAO 6500 6500 QA DENNIS ? ? ? 100 GANESAN 6400 6400 DEV YOW 101 6400 10000.000 --- 3 row(s) selected. @@ -703,8 +705,8 @@ EMPNUM EMPNAME DEPTNUM DEPTNUM DEPTNAME ----------- -------------------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ 100 RAO 6500 6500 QA DENNIS ? ? ? - 100 BHAVE 6400 6400 DEV YOW 101 6400 10000.000 100 GANESAN 6400 6400 DEV YOW 101 6400 10000.000 + 100 BHAVE 6400 6400 DEV YOW 101 6400 10000.000 --- 3 row(s) selected. >> @@ -730,9 +732,9 @@ EMPNUM EMPNAME DEPTNUM DEPTNUM DEPTNAME EMPNUM EMPNAME DEPTNUM DEPTNUM DEPTNAME MANAGER UNITNUM DEPTNUM REVENVUE ----------- -------------------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ + 100 RAO 6500 6500 QA DENNIS ? ? ? 100 BHAVE 6400 6400 DEV YOW 101 6400 10000.000 100 GANESAN 6400 6400 DEV YOW 101 6400 10000.000 - 100 RAO 6500 6500 QA DENNIS ? ? ? --- 3 row(s) selected. >>SELECT * @@ -743,9 +745,9 @@ EMPNUM EMPNAME DEPTNUM DEPTNUM DEPTNAME EMPNUM EMPNAME DEPTNUM DEPTNUM DEPTNAME MANAGER UNITNUM DEPTNUM REVENVUE ----------- -------------------- ----------- ----------- -------------------- -------------------- ----------- ----------- ------------ - 100 BHAVE 6400 6400 DEV YOW 101 6400 10000.000 - 100 RAO 6500 6500 QA DENNIS ? ? ? 100 GANESAN 6400 6400 DEV YOW 101 6400 10000.000 + 100 RAO 6500 6500 QA DENNIS ? ? ? + 100 BHAVE 6400 6400 DEV YOW 101 6400 10000.000 --- 3 row(s) selected. >> diff --git a/core/sql/regress/executor/EXPECTED012 b/core/sql/regress/executor/EXPECTED012 index a15082dffc..26730d5616 100755 --- a/core/sql/regress/executor/EXPECTED012 +++ b/core/sql/regress/executor/EXPECTED012 @@ -899,7 +899,6 @@ A B C >>-- * select * from t012t1 where position('b' in b) < 3; >>-- * select * from t012t1 where position('b' in b) <= 2; >> ->>?ifMX >>select b, position(N'ab' in b) from t012ut1; B (EXPR) @@ -1032,7 +1031,138 @@ A B C 40 test trim on non-space --- 3 row(s) selected. ->>?ifMX +>> +>>-- test INSTR function +>>select instr('heelplo', 'l', 2, 2) from dual; + +(EXPR) +---------- + + 6 + +--- 1 row(s) selected. +>>select instr('heelplo', 'l', 2) from dual; + +(EXPR) +---------- + + 4 + +--- 1 row(s) selected. +>>select instr('heelplo', 'l', 1) from dual; + +(EXPR) +---------- + + 4 + +--- 1 row(s) selected. +>>select instr('heelplo', 'l', 5) from dual; + +(EXPR) +---------- + + 6 + +--- 1 row(s) selected. +>>select instr('heelplo', 'l', 10) from dual; + +(EXPR) +---------- + + 0 + +--- 1 row(s) selected. +>>SELECT INSTR('CORPORATE FLOOR','OR', 3, 1) FROM DUAL; + +(EXPR) +---------- + + 5 + +--- 1 row(s) selected. +>>SELECT INSTR('CORPORATE FLOOR','OR', 3, 2) FROM DUAL; + +(EXPR) +---------- + + 14 + +--- 1 row(s) selected. +>>SELECT INSTR('CORPORATE FLOOR','OR', -3, 2) FROM DUAL; + +*** ERROR[1572] START POSITION value cannot be a negative number for INSTR function. + +--- 0 row(s) selected. +>>SELECT INSTR('CORPORATE FLOOR','OR', 3, -2) FROM DUAL; + +*** ERROR[1572] OCCURRENCE value cannot be a negative number for INSTR function. + +--- 0 row(s) selected. +>> +>>select instr(_ucs2 x'c231 c232 c232 c233 c234 c233 c235', _ucs2 x'c233', 2, 2) from dual; + +(EXPR) +---------- + + 6 + +--- 1 row(s) selected. +>>select instr(_ucs2 x'c231 c232 c232 c233 c234 c233 c235', _ucs2 x'c233', 2) from dual; + +(EXPR) +---------- + + 4 + +--- 1 row(s) selected. +>>select instr(_ucs2 x'c231 c232 c232 c233 c234 c233 c235', _ucs2 x'c233', 1) from dual; + +(EXPR) +---------- + + 4 + +--- 1 row(s) selected. +>>select instr(_ucs2 x'c231 c232 c232 c233 c234 c233 c235', _ucs2 x'c233', 5) from dual; + +(EXPR) +---------- + + 6 + +--- 1 row(s) selected. +>>select instr(_ucs2 x'c231 c232 c232 c233 c234 c233 c235', _ucs2 x'c233', 10) from dual; + +(EXPR) +---------- + + 0 + +--- 1 row(s) selected. +>> +>>select instr(_ucs2 x'c231 c232 c233 c234 c232 c233 c235 c236 c237 c331 c332 c333 c232 c232 c233', _ucs2 x'c232 c233', 3, 1) from dual; + +(EXPR) +---------- + + 5 + +--- 1 row(s) selected. +>>select instr(_ucs2 x'c231 c232 c233 c234 c232 c233 c235 c236 c237 c331 c332 c333 c232 c232 c233', _ucs2 x'c232 c233', 3, 2) from dual; + +(EXPR) +---------- + + 14 + +--- 1 row(s) selected. +>>select instr(_ucs2 x'c231 c232 c233 c234 c232 c233 c235 c236 c237 c331 c332 c333 c232 c232 c233', _ucs2 x'c232 c233', -3, 2) from dual; + +*** ERROR[1572] START POSITION value cannot be a negative number for INSTR function. + +--- 0 row(s) selected. +>> >> >>-- testing SUBSTRING function >>select b,substring(b from 2 for 1) as u,char_length(substring(b from 2 for 1)) len from t012t1; @@ -1925,7 +2055,6 @@ A B C --- 1 row(s) selected. >> ->>?ifMX >>select b||b,char_length(b||b) from t012ut1; (EXPR) (EXPR) @@ -2132,7 +2261,6 @@ A B C 30 abc def --- 1 row(s) selected. ->>?ifMX >> >>-- test BIT functions >>select bitand(1,1), bitor(1,1), bitxor(1,1), bitnot(1) from (values(1)) x(a); @@ -2629,6 +2757,465 @@ C --- 9 row(s) selected. >> +>>-- various operations involving number datatypes and string functions. +>>select '1 ' || 12.34e3 from dual; + +(EXPR) +--------------------------- + +1 1.23400000000000000E+004 + +--- 1 row(s) selected. +>>select 12 || '1 ' || 12.34e3 from dual; + +(EXPR) +------------------------------- + +121 1.23400000000000000E+004 + +--- 1 row(s) selected. +>>select concat(_ucs2'2233', 12.34e3) from dual; + +(EXPR) +---------------------------------------------------------- + +22331.23400000000000000E+004 + +--- 1 row(s) selected. +>>select case when 1 = 1 then 12.3e34 else '1' end from dual; + +(EXPR) +------------------------- + +1.23000000000000000E+035 + +--- 1 row(s) selected. +>> +>>drop table if exists t012t4; + +--- SQL operation complete. +>> +>>create table t012t4 ( ++>c1 float, ++>c2 numeric, ++>c3 numeric(128), ++>c4 numeric(10,5), ++>c5 decimal, ++>c6 decimal(18), ++>c7 decimal(10,5) ++>); + +--- SQL operation complete. +>>insert into t012t4 values (1.23, 1.23, 1.23, 1.23, 1.23, 1.23, 1.23); + +--- 1 row(s) inserted. +>>select * from t012t4; + +C1 C2 C3 C4 C5 C6 C7 +------------------------- ----------- --------------------------------------------------------------------------------------------------------------------------------- --------------------- ---------- ------------------- ------------ + + 1.23000000000000000E+000 1 1 1.23000 1 1 1.23000 + +--- 1 row(s) selected. +>> +>>select CONCAT(c1,'ZZZ') from t012t4; + +(EXPR) +---------------------------- + +1.23000000000000000E+000ZZZ + +--- 1 row(s) selected. +>>select CONCAT(c2,'ZZZ') from t012t4; + +(EXPR) +-------------- + +1ZZZ + +--- 1 row(s) selected. +>>select CONCAT(c3,'ZZZ') from t012t4; + +(EXPR) +------------------------------------------------------------------------------------------------------------------------------------ + +1ZZZ + +--- 1 row(s) selected. +>>select CONCAT(c4,'ZZZ') from t012t4; + +(EXPR) +------------------------ + +1.23000ZZZ + +--- 1 row(s) selected. +>>select CONCAT(c5,'ZZZ') from t012t4; + +(EXPR) +------------- + +1ZZZ + +--- 1 row(s) selected. +>>select CONCAT(c6,'ZZZ') from t012t4; + +(EXPR) +---------------------- + +1ZZZ + +--- 1 row(s) selected. +>>select CONCAT(c7,'ZZZ') from t012t4; + +(EXPR) +--------------- + +1.23000ZZZ + +--- 1 row(s) selected. +>> +>>select LPAD(c1,2,'ZZZ') from t012t4; + +(EXPR) +------ + +1. + +--- 1 row(s) selected. +>>select LPAD(c2,2,'ZZZ') from t012t4; + +(EXPR) +------ + +Z1 + +--- 1 row(s) selected. +>>select LPAD(c3,2,'ZZZ') from t012t4; + +(EXPR) +------ + +Z1 + +--- 1 row(s) selected. +>>select LPAD(c4,2,'ZZZ') from t012t4; + +(EXPR) +------ + +1. + +--- 1 row(s) selected. +>>select LPAD(c5,2,'ZZZ') from t012t4; + +(EXPR) +------ + +Z1 + +--- 1 row(s) selected. +>>select LPAD(c6,2,'ZZZ') from t012t4; + +(EXPR) +------ + +Z1 + +--- 1 row(s) selected. +>>select LPAD(c7,2,'ZZZ') from t012t4; + +(EXPR) +------ + +1. + +--- 1 row(s) selected. +>> +>>select LTRIM(c1) from t012t4; + +(EXPR) +------------------------- + +1.23000000000000000E+000 + +--- 1 row(s) selected. +>>select LTRIM(c2) from t012t4; + +(EXPR) +----------- + +1 + +--- 1 row(s) selected. +>>select LTRIM(c3) from t012t4; + +(EXPR) +--------------------------------------------------------------------------------------------------------------------------------- + +1 + +--- 1 row(s) selected. +>>select LTRIM(c4) from t012t4; + +(EXPR) +--------------------- + +1.23000 + +--- 1 row(s) selected. +>>select LTRIM(c5) from t012t4; + +(EXPR) +---------- + +1 + +--- 1 row(s) selected. +>>select LTRIM(c6) from t012t4; + +(EXPR) +------------------- + +1 + +--- 1 row(s) selected. +>>select LTRIM(c7) from t012t4; + +(EXPR) +------------ + +1.23000 + +--- 1 row(s) selected. +>> +>>select OCTET_LENGTH(c1) from t012t4; + +(EXPR) +---------- + + 24 + +--- 1 row(s) selected. +>>select OCTET_LENGTH(c2) from t012t4; + +(EXPR) +---------- + + 1 + +--- 1 row(s) selected. +>>select OCTET_LENGTH(c3) from t012t4; + +(EXPR) +---------- + + 1 + +--- 1 row(s) selected. +>>select OCTET_LENGTH(c4) from t012t4; + +(EXPR) +---------- + + 7 + +--- 1 row(s) selected. +>>select OCTET_LENGTH(c5) from t012t4; + +(EXPR) +---------- + + 1 + +--- 1 row(s) selected. +>>select OCTET_LENGTH(c6) from t012t4; + +(EXPR) +---------- + + 1 + +--- 1 row(s) selected. +>>select OCTET_LENGTH(c7) from t012t4; + +(EXPR) +---------- + + 7 + +--- 1 row(s) selected. +>> +>>select RPAD(c1,2,'ZZZ') from t012t4; + +(EXPR) +------ + +1. + +--- 1 row(s) selected. +>>select RPAD(c2,2,'ZZZ') from t012t4; + +(EXPR) +------ + +1Z + +--- 1 row(s) selected. +>>select RPAD(c3,2,'ZZZ') from t012t4; + +(EXPR) +------ + +1Z + +--- 1 row(s) selected. +>>select RPAD(c4,2,'ZZZ') from t012t4; + +(EXPR) +------ + +1. + +--- 1 row(s) selected. +>>select RPAD(c5,2,'ZZZ') from t012t4; + +(EXPR) +------ + +1Z + +--- 1 row(s) selected. +>>select RPAD(c6,2,'ZZZ') from t012t4; + +(EXPR) +------ + +1Z + +--- 1 row(s) selected. +>>select RPAD(c7,2,'ZZZ') from t012t4; + +(EXPR) +------ + +1. + +--- 1 row(s) selected. +>> +>>select RTRIM(c1) from t012t4; + +(EXPR) +------------------------- + +1.23000000000000000E+000 + +--- 1 row(s) selected. +>>select RTRIM(c2) from t012t4; + +(EXPR) +----------- + +1 + +--- 1 row(s) selected. +>>select RTRIM(c3) from t012t4; + +(EXPR) +--------------------------------------------------------------------------------------------------------------------------------- + +1 + +--- 1 row(s) selected. +>>select RTRIM(c4) from t012t4; + +(EXPR) +--------------------- + +1.23000 + +--- 1 row(s) selected. +>>select RTRIM(c5) from t012t4; + +(EXPR) +---------- + +1 + +--- 1 row(s) selected. +>>select RTRIM(c6) from t012t4; + +(EXPR) +------------------- + +1 + +--- 1 row(s) selected. +>>select RTRIM(c7) from t012t4; + +(EXPR) +------------ + +1.23000 + +--- 1 row(s) selected. +>> +>>select TRIM(c1) from t012t4; + +(EXPR) +------------------------- + +1.23000000000000000E+000 + +--- 1 row(s) selected. +>>select TRIM(c2) from t012t4; + +(EXPR) +----------- + +1 + +--- 1 row(s) selected. +>>select TRIM(c3) from t012t4; + +(EXPR) +--------------------------------------------------------------------------------------------------------------------------------- + +1 + +--- 1 row(s) selected. +>>select TRIM(c4) from t012t4; + +(EXPR) +--------------------- + +1.23000 + +--- 1 row(s) selected. +>>select TRIM(c5) from t012t4; + +(EXPR) +---------- + +1 + +--- 1 row(s) selected. +>>select TRIM(c6) from t012t4; + +(EXPR) +------------------- + +1 + +--- 1 row(s) selected. +>>select TRIM(c7) from t012t4; + +(EXPR) +------------ + +1.23000 + +--- 1 row(s) selected. >> >>-- negative BIT function tests >>select bitand(1, 1.0) from (values(1)) x(a); @@ -2732,6 +3319,9 @@ select bitnot(1,1) from (values(1)) x(a); >> >>drop table t012t3; +--- SQL operation complete. +>>drop table t012t4; + --- SQL operation complete. >> >>log; diff --git a/core/sql/regress/executor/TEST012 b/core/sql/regress/executor/TEST012 index c5e734eaad..d376350e2e 100755 --- a/core/sql/regress/executor/TEST012 +++ b/core/sql/regress/executor/TEST012 @@ -44,6 +44,7 @@ drop table t012t1 cascade; drop table t012ut1 cascade; ?ifMX drop table t012t3 cascade; +drop table t012t4 cascade; ?section crdb log LOG012 clear; @@ -217,7 +218,6 @@ select * from t012t1 where position('b' in b) >= 2; -- * select * from t012t1 where position('b' in b) < 3; -- * select * from t012t1 where position('b' in b) <= 2; -?ifMX select b, position(N'ab' in b) from t012ut1; select b, position(N'xy' in b) from t012ut1; select b, position(N'ef' in b) from t012ut1; @@ -231,7 +231,28 @@ select * from t012ut1 where position(N'b' in b) > 1; select * from t012ut1 where position(N'b' in b) >= 2; select * from t012ut1 where position(N'b' in b) < 3; select * from t012ut1 where position(N'b' in b) <= 2; -?ifMX + +-- test INSTR function +select instr('heelplo', 'l', 2, 2) from dual; +select instr('heelplo', 'l', 2) from dual; +select instr('heelplo', 'l', 1) from dual; +select instr('heelplo', 'l', 5) from dual; +select instr('heelplo', 'l', 10) from dual; +SELECT INSTR('CORPORATE FLOOR','OR', 3, 1) FROM DUAL; +SELECT INSTR('CORPORATE FLOOR','OR', 3, 2) FROM DUAL; +SELECT INSTR('CORPORATE FLOOR','OR', -3, 2) FROM DUAL; +SELECT INSTR('CORPORATE FLOOR','OR', 3, -2) FROM DUAL; + +select instr(_ucs2 x'c231 c232 c232 c233 c234 c233 c235', _ucs2 x'c233', 2, 2) from dual; +select instr(_ucs2 x'c231 c232 c232 c233 c234 c233 c235', _ucs2 x'c233', 2) from dual; +select instr(_ucs2 x'c231 c232 c232 c233 c234 c233 c235', _ucs2 x'c233', 1) from dual; +select instr(_ucs2 x'c231 c232 c232 c233 c234 c233 c235', _ucs2 x'c233', 5) from dual; +select instr(_ucs2 x'c231 c232 c232 c233 c234 c233 c235', _ucs2 x'c233', 10) from dual; + +select instr(_ucs2 x'c231 c232 c233 c234 c232 c233 c235 c236 c237 c331 c332 c333 c232 c232 c233', _ucs2 x'c232 c233', 3, 1) from dual; +select instr(_ucs2 x'c231 c232 c233 c234 c232 c233 c235 c236 c237 c331 c332 c333 c232 c232 c233', _ucs2 x'c232 c233', 3, 2) from dual; +select instr(_ucs2 x'c231 c232 c233 c234 c232 c233 c235 c236 c237 c331 c332 c333 c232 c232 c233', _ucs2 x'c232 c233', -3, 2) from dual; + -- testing SUBSTRING function select b,substring(b from 2 for 1) as u,char_length(substring(b from 2 for 1)) len from t012t1; @@ -341,7 +362,6 @@ select trim(b)||trim(c),char_length(trim(b)||trim(c)) from t012t1; select trim(b)||trim(c)||trim(b),char_length(trim(b)||trim(c)||trim(b)) from t012t1; select * from t012t1 where trim(b)||trim(c) = 'abcdef'; -?ifMX select b||b,char_length(b||b) from t012ut1; select b||trim(b),char_length(b||trim(b)) from t012ut1; select trim(b)||trim(b),char_length(trim(b)||trim(b)) from t012ut1; @@ -361,7 +381,6 @@ select b||c,char_length(b||c) from t012ut1; select trim(b)||trim(c),char_length(trim(b)||trim(c)) from t012ut1; select trim(b)||trim(c)||trim(b),char_length(trim(b)||trim(c)||trim(b)) from t012ut1; select * from t012ut1 where trim(b)||trim(c) = N'abcdef'; -?ifMX -- test BIT functions select bitand(1,1), bitor(1,1), bitxor(1,1), bitnot(1) from (values(1)) x(a); @@ -456,6 +475,81 @@ select bitand(a,a) + bitor(a,a) + bitxor(a,a) from t012t3; select converttobits(bitand(a,a) + bitor(a,a) + bitxor(a,a)) from t012t3; select converttobits(bitnot(bitand(a,a) + bitor(a,a) + bitxor(a,a))) from t012t3; +-- various operations involving number datatypes and string functions. +select '1 ' || 12.34e3 from dual; +select 12 || '1 ' || 12.34e3 from dual; +select concat(_ucs2'2233', 12.34e3) from dual; +select case when 1 = 1 then 12.3e34 else '1' end from dual; + +drop table if exists t012t4; + +create table t012t4 ( +c1 float, +c2 numeric, +c3 numeric(128), +c4 numeric(10,5), +c5 decimal, +c6 decimal(18), +c7 decimal(10,5) +); +insert into t012t4 values (1.23, 1.23, 1.23, 1.23, 1.23, 1.23, 1.23); +select * from t012t4; + +select CONCAT(c1,'ZZZ') from t012t4; +select CONCAT(c2,'ZZZ') from t012t4; +select CONCAT(c3,'ZZZ') from t012t4; +select CONCAT(c4,'ZZZ') from t012t4; +select CONCAT(c5,'ZZZ') from t012t4; +select CONCAT(c6,'ZZZ') from t012t4; +select CONCAT(c7,'ZZZ') from t012t4; + +select LPAD(c1,2,'ZZZ') from t012t4; +select LPAD(c2,2,'ZZZ') from t012t4; +select LPAD(c3,2,'ZZZ') from t012t4; +select LPAD(c4,2,'ZZZ') from t012t4; +select LPAD(c5,2,'ZZZ') from t012t4; +select LPAD(c6,2,'ZZZ') from t012t4; +select LPAD(c7,2,'ZZZ') from t012t4; + +select LTRIM(c1) from t012t4; +select LTRIM(c2) from t012t4; +select LTRIM(c3) from t012t4; +select LTRIM(c4) from t012t4; +select LTRIM(c5) from t012t4; +select LTRIM(c6) from t012t4; +select LTRIM(c7) from t012t4; + +select OCTET_LENGTH(c1) from t012t4; +select OCTET_LENGTH(c2) from t012t4; +select OCTET_LENGTH(c3) from t012t4; +select OCTET_LENGTH(c4) from t012t4; +select OCTET_LENGTH(c5) from t012t4; +select OCTET_LENGTH(c6) from t012t4; +select OCTET_LENGTH(c7) from t012t4; + +select RPAD(c1,2,'ZZZ') from t012t4; +select RPAD(c2,2,'ZZZ') from t012t4; +select RPAD(c3,2,'ZZZ') from t012t4; +select RPAD(c4,2,'ZZZ') from t012t4; +select RPAD(c5,2,'ZZZ') from t012t4; +select RPAD(c6,2,'ZZZ') from t012t4; +select RPAD(c7,2,'ZZZ') from t012t4; + +select RTRIM(c1) from t012t4; +select RTRIM(c2) from t012t4; +select RTRIM(c3) from t012t4; +select RTRIM(c4) from t012t4; +select RTRIM(c5) from t012t4; +select RTRIM(c6) from t012t4; +select RTRIM(c7) from t012t4; + +select TRIM(c1) from t012t4; +select TRIM(c2) from t012t4; +select TRIM(c3) from t012t4; +select TRIM(c4) from t012t4; +select TRIM(c5) from t012t4; +select TRIM(c6) from t012t4; +select TRIM(c7) from t012t4; -- negative BIT function tests select bitand(1, 1.0) from (values(1)) x(a); @@ -522,6 +616,7 @@ drop table t012ut1; ?ifMX drop table t012t3; +drop table t012t4; log; diff --git a/core/sql/regress/hive/EXPECTED005 b/core/sql/regress/hive/EXPECTED005 index 493fe4ef51..65217906de 100644 --- a/core/sql/regress/hive/EXPECTED005 +++ b/core/sql/regress/hive/EXPECTED005 @@ -72,7 +72,7 @@ *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. -*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1499978885, failedModTS = 1499978946, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl +*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1521763081810, failedModTS = 1521763182817, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl C_PREFERRED_CUST_FLAG (EXPR) ------------------------- -------------------- @@ -108,7 +108,7 @@ Y 9525 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. -*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1499978885, failedModTS = 1499978946, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl +*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1521763081810, failedModTS = 1521763182817, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl C_PREFERRED_CUST_FLAG (EXPR) ------------------------- -------------------- @@ -177,7 +177,7 @@ Y 9525 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. -*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1499978950, failedModTS = 1499978958, failedLoc = hdfs://localhost:24200/user/hive/warehouse/newtable +*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1521763188079, failedModTS = 1521763198786, failedLoc = hdfs://localhost:24200/user/hive/warehouse/newtable A ------------------------- @@ -227,7 +227,7 @@ xyz *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. -*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1499978946, failedModTS = 1499978976, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl +*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1521763182817, failedModTS = 1521763227396, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl C_PREFERRED_CUST_FLAG (EXPR) ------------------------- -------------------- @@ -242,7 +242,7 @@ Y 18984 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. -*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1499978946, failedModTS = 1499978976, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl +*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1521763182817, failedModTS = 1521763227396, failedLoc = hdfs://localhost:24200/user/trafodion/hive/exttables/customer_ddl C_PREFERRED_CUST_FLAG (EXPR) ------------------------- -------------------- @@ -298,7 +298,7 @@ Y 18984 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. -*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1499978973, failedModTS = 1499978982, failedLoc = hdfs://localhost:24200/user/hive/warehouse/newtable +*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1521763223181, failedModTS = 1521763236557, failedLoc = hdfs://localhost:24200/user/hive/warehouse/newtable A B ----------- ------------------------- @@ -456,10 +456,10 @@ ID CHAPTER ENGLISH TRANSLATOR >> >>select * from tbl_type; -TINT SM I BIG STR F D T DT VC D10 D18 D181 D30 ----- ------ ----------- -------------------- ------------------------- --------------- ------------------------- -------------------------- ---------- ---------------------------------------- ----------- ---------- ----------- ------------------------------- +TINT SM I BIG STR F D T DT VC D10 D18 D181 D30 +---- ------ ----------- -------------------- ------------------------- --------------- ------------------------- -------------------------- ---------- ---------------------------------------- -------------------- ------------ -------------------- ------------------------------- - 101 202 203 204 two hundred 2.0000000E+002 2.00000000000000000E+002 2022-02-02 22:22:22.222222 2022-02-02 varchar 1234567890 123456.11 12345 11111111111111111111111111111 + 101 202 203 204 two hundred 2.0000000E+002 2.00000000000000000E+002 2022-02-02 22:22:22.222222 2022-02-02 varchar 1234567890 123456.11 12345 11111111111111111111111111111 --- 1 row(s) selected. >>insert into tbl_type_temp select * from tbl_type; @@ -467,10 +467,10 @@ TINT SM I BIG STR F --- 1 row(s) inserted. >>select * from tbl_type_temp; -TINT SM I BIG STR F D T DT VC D10 D18 D181 D30 ----- ------ ----------- -------------------- ------------------------- --------------- ------------------------- -------------------------- ---------- ---------------------------------------- ----------- ---------- ----------- ------------------------------- +TINT SM I BIG STR F D T DT VC D10 D18 D181 D30 +---- ------ ----------- -------------------- ------------------------- --------------- ------------------------- -------------------------- ---------- ---------------------------------------- -------------------- ------------ -------------------- ------------------------------- - 101 202 203 204 two hundred 2.0000000E+002 2.00000000000000000E+002 2022-02-02 22:22:22.222222 2022-02-02 varchar 1234567890 123456.11 12345 11111111111111111111111111111 + 101 202 203 204 two hundred 2.0000000E+002 2.00000000000000000E+002 2022-02-02 22:22:22.222222 2022-02-02 varchar 1234567890 123456.11 12345 11111111111111111111111111111 --- 1 row(s) selected. >> @@ -617,18 +617,18 @@ C1 C2 C3 C4 C --- 1 row(s) selected. >>load with continue on error into trafodion.seabase.traf_tbl_bad select * from tbl_bad; Task: LOAD Status: Started Object: TRAFODION.SEABASE.TRAF_TBL_BAD -Task: CLEANUP Status: Started Time: 2017-07-13 20:50:54.956 -Task: CLEANUP Status: Ended Time: 2017-07-13 20:50:54.975 -Task: CLEANUP Status: Ended Elapsed Time: 00:00:00.018 -Task: LOADING DATA Status: Started Time: 2017-07-13 20:50:54.975 +Task: CLEANUP Status: Started Time: 2018-03-23 00:02:16.72820 +Task: CLEANUP Status: Ended Time: 2018-03-23 00:02:16.87954 +Task: CLEANUP Status: Ended Elapsed Time: 00:00:00.015 +Task: LOADING DATA Status: Started Time: 2018-03-23 00:02:16.88001 Rows Processed: 8 Error Rows: 5 -Task: LOADING DATA Status: Ended Time: 2017-07-13 20:50:55.307 -Task: LOADING DATA Status: Ended Elapsed Time: 00:00:00.332 -Task: COMPLETION Status: Started Time: 2017-07-13 20:50:55.307 +Task: LOADING DATA Status: Ended Time: 2018-03-23 00:02:16.505744 +Task: LOADING DATA Status: Ended Elapsed Time: 00:00:00.418 +Task: COMPLETION Status: Started Time: 2018-03-23 00:02:16.505804 Rows Loaded: 3 -Task: COMPLETION Status: Ended Time: 2017-07-13 20:50:55.655 -Task: COMPLETION Status: Ended Elapsed Time: 00:00:00.348 +Task: COMPLETION Status: Ended Time: 2018-03-23 00:02:17.132726 +Task: COMPLETION Status: Ended Elapsed Time: 00:00:00.627 --- 3 row(s) loaded. >>select count(*) from trafodion.seabase.traf_tbl_bad; @@ -644,19 +644,19 @@ Task: COMPLETION Status: Ended Elapsed Time: 00:00:00.348 --- 3 row(s) deleted. >>load with log error rows into trafodion.seabase.traf_tbl_bad select * from tbl_bad; Task: LOAD Status: Started Object: TRAFODION.SEABASE.TRAF_TBL_BAD -Task: CLEANUP Status: Started Time: 2017-07-13 20:50:56.697 -Task: CLEANUP Status: Ended Time: 2017-07-13 20:50:56.705 -Task: CLEANUP Status: Ended Elapsed Time: 00:00:00.009 - Logging Location: /user/trafodion/bulkload/logs/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20170713_205056 -Task: LOADING DATA Status: Started Time: 2017-07-13 20:50:56.705 +Task: CLEANUP Status: Started Time: 2018-03-23 00:02:18.222742 +Task: CLEANUP Status: Ended Time: 2018-03-23 00:02:18.238737 +Task: CLEANUP Status: Ended Elapsed Time: 00:00:00.016 + Logging Location: /user/trafodion/bulkload/logs/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20180323_000218 +Task: LOADING DATA Status: Started Time: 2018-03-23 00:02:18.238844 Rows Processed: 8 Error Rows: 5 -Task: LOADING DATA Status: Ended Time: 2017-07-13 20:50:57.153 -Task: LOADING DATA Status: Ended Elapsed Time: 00:00:00.448 -Task: COMPLETION Status: Started Time: 2017-07-13 20:50:57.153 +Task: LOADING DATA Status: Ended Time: 2018-03-23 00:02:18.652144 +Task: LOADING DATA Status: Ended Elapsed Time: 00:00:00.413 +Task: COMPLETION Status: Started Time: 2018-03-23 00:02:18.652182 Rows Loaded: 3 -Task: COMPLETION Status: Ended Time: 2017-07-13 20:50:57.695 -Task: COMPLETION Status: Ended Elapsed Time: 00:00:00.542 +Task: COMPLETION Status: Ended Time: 2018-03-23 00:02:19.268334 +Task: COMPLETION Status: Ended Elapsed Time: 00:00:00.616 --- 3 row(s) loaded. >>select count(*) from trafodion.seabase.traf_tbl_bad; @@ -669,19 +669,19 @@ Task: COMPLETION Status: Ended Elapsed Time: 00:00:00.542 --- 1 row(s) selected. >>load with log error rows to '/user/trafodion/bulkload/logs/TEST005' into trafodion.seabase.traf_tbl_bad select * from tbl_bad; Task: LOAD Status: Started Object: TRAFODION.SEABASE.TRAF_TBL_BAD -Task: CLEANUP Status: Started Time: 2017-07-13 20:50:58.677 -Task: CLEANUP Status: Ended Time: 2017-07-13 20:50:58.685 -Task: CLEANUP Status: Ended Elapsed Time: 00:00:00.008 - Logging Location: /user/trafodion/bulkload/logs/TEST005/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20170713_205058 -Task: LOADING DATA Status: Started Time: 2017-07-13 20:50:58.685 +Task: CLEANUP Status: Started Time: 2018-03-23 00:02:20.268608 +Task: CLEANUP Status: Ended Time: 2018-03-23 00:02:20.278195 +Task: CLEANUP Status: Ended Elapsed Time: 00:00:00.010 + Logging Location: /user/trafodion/bulkload/logs/TEST005/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20180323_000220 +Task: LOADING DATA Status: Started Time: 2018-03-23 00:02:20.278249 Rows Processed: 8 Error Rows: 5 -Task: LOADING DATA Status: Ended Time: 2017-07-13 20:50:59.124 -Task: LOADING DATA Status: Ended Elapsed Time: 00:00:00.439 -Task: COMPLETION Status: Started Time: 2017-07-13 20:50:59.124 +Task: LOADING DATA Status: Ended Time: 2018-03-23 00:02:20.743348 +Task: LOADING DATA Status: Ended Elapsed Time: 00:00:00.465 +Task: COMPLETION Status: Started Time: 2018-03-23 00:02:20.743404 Rows Loaded: 3 -Task: COMPLETION Status: Ended Time: 2017-07-13 20:50:59.453 -Task: COMPLETION Status: Ended Elapsed Time: 00:00:00.329 +Task: COMPLETION Status: Ended Time: 2018-03-23 00:02:21.350084 +Task: COMPLETION Status: Ended Elapsed Time: 00:00:00.607 --- 3 row(s) loaded. >>select count(*) from trafodion.seabase.traf_tbl_bad; @@ -697,10 +697,10 @@ Task: COMPLETION Status: Ended Elapsed Time: 00:00:00.329 --- 6 row(s) deleted. >>load with stop after 3 error rows into trafodion.seabase.traf_tbl_bad select * from tbl_bad; Task: LOAD Status: Started Object: TRAFODION.SEABASE.TRAF_TBL_BAD -Task: CLEANUP Status: Started Time: 2017-07-13 20:51:00.456 -Task: CLEANUP Status: Ended Time: 2017-07-13 20:51:00.475 -Task: CLEANUP Status: Ended Elapsed Time: 00:00:00.018 -Task: LOADING DATA Status: Started Time: 2017-07-13 20:51:00.475 +Task: CLEANUP Status: Started Time: 2018-03-23 00:02:22.398357 +Task: CLEANUP Status: Ended Time: 2018-03-23 00:02:22.409109 +Task: CLEANUP Status: Ended Elapsed Time: 00:00:00.011 +Task: LOADING DATA Status: Started Time: 2018-03-23 00:02:22.409145 *** ERROR[8113] The maximum number of error rows is exceeded. @@ -715,11 +715,11 @@ Task: LOADING DATA Status: Started Time: 2017-07-13 20:51:00.475 --- 1 row(s) selected. >>load with log error rows, stop after 3 error rows into trafodion.seabase.traf_tbl_bad select * from tbl_bad; Task: LOAD Status: Started Object: TRAFODION.SEABASE.TRAF_TBL_BAD -Task: CLEANUP Status: Started Time: 2017-07-13 20:51:01.786 -Task: CLEANUP Status: Ended Time: 2017-07-13 20:51:01.795 -Task: CLEANUP Status: Ended Elapsed Time: 00:00:00.009 - Logging Location: /user/trafodion/bulkload/logs/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20170713_205101 -Task: LOADING DATA Status: Started Time: 2017-07-13 20:51:01.795 +Task: CLEANUP Status: Started Time: 2018-03-23 00:02:23.773372 +Task: CLEANUP Status: Ended Time: 2018-03-23 00:02:23.788799 +Task: CLEANUP Status: Ended Elapsed Time: 00:00:00.015 + Logging Location: /user/trafodion/bulkload/logs/ERR_TRAFODION.SEABASE.TRAF_TBL_BAD_20180323_000223 +Task: LOADING DATA Status: Started Time: 2018-03-23 00:02:23.788861 *** ERROR[8113] The maximum number of error rows is exceeded. @@ -807,7 +807,7 @@ Task: LOADING DATA Status: Started Time: 2017-07-13 20:51:01.795 *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. -*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1499979080, failedModTS = 1499979093, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive +*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1521763369777, failedModTS = 1521763389102, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive A ----------- @@ -842,7 +842,7 @@ A *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. -*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1499979096, failedModTS = 1499979110, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive +*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1521763391527, failedModTS = 1521763411540, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive A ----------- @@ -869,7 +869,7 @@ A B *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. -*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1499979110, failedModTS = 1499979116, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive +*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1521763411540, failedModTS = 1521763418274, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive --- 0 row(s) selected. >>insert into hive.hive.thive values (10, 20); @@ -893,7 +893,7 @@ A B *** WARNING[8597] Statement was automatically retried 1 time(s). Delay before each retry was 0 seconds. See next entry for the error that caused this retry. -*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1499979118, failedModTS = 1499979120, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive +*** WARNING[8436] Mismatch detected between compiletime and runtime hive table definitions. DataModMismatchDetails: compiledModTS = 1521763422992, failedModTS = 1521763425613, failedLoc = hdfs://localhost:24200/user/hive/warehouse/thive --- 0 row(s) selected. >> @@ -984,7 +984,7 @@ t005part.a t005part.b t005part.c >>invoke hive.hive.thive_insert_smallint; -- Definition of hive table THIVE_INSERT_SMALLINT --- Definition current Thu Jul 13 20:54:19 2017 +-- Definition current Fri Mar 23 00:07:13 2018 ( A SMALLINT @@ -1091,7 +1091,7 @@ A >>invoke hive.hive.thive_insert_varchar; -- Definition of hive table THIVE_INSERT_VARCHAR --- Definition current Thu Jul 13 20:54:28 2017 +-- Definition current Fri Mar 23 00:07:23 2018 ( A VARCHAR(1 CHAR) CHARACTER SET UTF8 COLLATE diff --git a/core/sql/regress/seabase/EXPECTED002 b/core/sql/regress/seabase/EXPECTED002 index 563e322b86..286b15791a 100644 --- a/core/sql/regress/seabase/EXPECTED002 +++ b/core/sql/regress/seabase/EXPECTED002 @@ -76,9 +76,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -87,9 +87,9 @@ Stats Details ReadRequestsCount: 0 WriteRequestsCount: 0 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 2 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -98,9 +98,9 @@ Stats Details ReadRequestsCount: 1 WriteRequestsCount: 1 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 3 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -109,9 +109,9 @@ Stats Details ReadRequestsCount: 0 WriteRequestsCount: 0 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 4 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -145,9 +145,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -156,9 +156,9 @@ Stats Details ReadRequestsCount: 0 WriteRequestsCount: 0 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 2 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -167,9 +167,9 @@ Stats Details ReadRequestsCount: 0 WriteRequestsCount: 0 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 3 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -178,9 +178,9 @@ Stats Details ReadRequestsCount: 0 WriteRequestsCount: 0 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 4 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -218,7 +218,7 @@ A B >>invoke table(region stats ()); -- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__ --- Definition current Fri Aug 18 01:04:11 2017 +-- Definition current Fri Mar 16 20:35:17 2018 ( CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE @@ -245,7 +245,7 @@ A B >>invoke table(region stats (t002t1)); -- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_REGION_STATS__ --- Definition current Fri Aug 18 01:04:12 2017 +-- Definition current Fri Mar 16 20:35:18 2018 ( CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE @@ -280,7 +280,7 @@ A B (EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR) -------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------ -T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1/1503018148460 2 0 0 0 0 ReadRequestsCount: 2 WriteRequestsCount: 1 +T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1/1521232436741 2 0 0 0 0 ReadRequestsCount: 2 WriteRequestsCount: 1 --- 1 row(s) selected. >> @@ -294,7 +294,7 @@ T002SCH.T002T1 1 (EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR) -------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------ -T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/1503018158021 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1 +T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/1521232441739 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1 --- 1 row(s) selected. >> @@ -308,10 +308,10 @@ T002SCH.T002T1 1 (EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR) -------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------ -T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2/1503018204323 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0 -T002SCH.T002T2 2 TRAFODION.T002SCH.T002T2/1503018204323 2 0 0 0 0 ReadRequestsCount: 1 WriteRequestsCount: 1 -T002SCH.T002T2 3 TRAFODION.T002SCH.T002T2/1503018204323 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0 -T002SCH.T002T2 4 TRAFODION.T002SCH.T002T2/1503018204323 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0 +T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2/1521232475166 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0 +T002SCH.T002T2 2 TRAFODION.T002SCH.T002T2/1521232475166 2 0 0 0 0 ReadRequestsCount: 1 WriteRequestsCount: 1 +T002SCH.T002T2 3 TRAFODION.T002SCH.T002T2/1521232475166 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0 +T002SCH.T002T2 4 TRAFODION.T002SCH.T002T2/1521232475166 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 0 --- 4 row(s) selected. >> @@ -325,7 +325,7 @@ T002SCH.T002T2 4 (EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR) -------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------ -T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2I1/1503018210241 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1 +T002SCH.T002T2 1 TRAFODION.T002SCH.T002T2I1/1521232479869 2 0 0 0 0 ReadRequestsCount: 1 WriteRequestsCount: 1 --- 1 row(s) selected. >> @@ -385,9 +385,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T1/1503018148460 + RegionName: TRAFODION.T002SCH.T002T1/1521232436741 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -418,9 +418,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T1I1/1503018158021 + RegionName: TRAFODION.T002SCH.T002T1I1/1521232441739 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -451,9 +451,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -462,9 +462,9 @@ Stats Details ReadRequestsCount: 0 WriteRequestsCount: 0 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 2 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -473,9 +473,9 @@ Stats Details ReadRequestsCount: 1 WriteRequestsCount: 1 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 3 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -484,9 +484,9 @@ Stats Details ReadRequestsCount: 0 WriteRequestsCount: 0 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 4 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -517,9 +517,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T2I1/1503018210241 + RegionName: TRAFODION.T002SCH.T002T2I1/1521232479869 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -551,9 +551,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T1/1503018148460 + RegionName: TRAFODION.T002SCH.T002T1/1521232436741 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -587,9 +587,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.SB_HISTOGRAMS/1503018135470 + RegionName: TRAFODION.T002SCH.SB_HISTOGRAMS/1521232429374 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -616,9 +616,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.SB_HISTOGRAM_INTERVALS/1503018139543 + RegionName: TRAFODION.T002SCH.SB_HISTOGRAM_INTERVALS/1521232431811 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -645,9 +645,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.SB_PERSISTENT_SAMPLES/1503018143500 + RegionName: TRAFODION.T002SCH.SB_PERSISTENT_SAMPLES/1521232434388 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -674,9 +674,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T1/1503018148460 + RegionName: TRAFODION.T002SCH.T002T1/1521232436741 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -703,9 +703,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -714,9 +714,9 @@ Stats Details ReadRequestsCount: 0 WriteRequestsCount: 0 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 2 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -725,9 +725,9 @@ Stats Details ReadRequestsCount: 1 WriteRequestsCount: 1 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 3 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -736,9 +736,9 @@ Stats Details ReadRequestsCount: 0 WriteRequestsCount: 0 - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 4 - RegionName: TRAFODION.T002SCH.T002T2/1503018204323 + RegionName: TRAFODION.T002SCH.T002T2/1521232475166 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -762,8 +762,8 @@ Stats Details (EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES STORE_FILE_UNCOMP_SIZE STORE_FILE_SIZE MEM_STORE_SIZE (EXPR) (EXPR) -------------------------------------------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- ---------------------- -------------------- -------------------- ----------------------------- ------------------------------ -T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/1503018158021 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1 -T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I2/1503018169131 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1 +T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I1/1521232441739 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1 +T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1I2/1521232446363 2 0 0 0 0 ReadRequestsCount: 0 WriteRequestsCount: 1 --- 2 row(s) selected. >>get region stats for @@ -788,9 +788,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T1I1/1503018158021 + RegionName: TRAFODION.T002SCH.T002T1I1/1521232441739 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -817,9 +817,9 @@ Stats Summary Stats Details ============= - RegionServer: edev06:35801 + RegionServer: ansharma-4:49525 RegionNum: 1 - RegionName: TRAFODION.T002SCH.T002T1I2/1503018169131 + RegionName: TRAFODION.T002SCH.T002T1I2/1521232446363 NumStores: 2 NumStoreFiles: 0 UncompressedSize: 0 (less than 1MB) @@ -991,7 +991,7 @@ Stats Summary (EXPR) REGION_NUM REGION_NAME NUM_STORES NUM_STORE_FILES ------------------------------ -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- --------------- -T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1/1503018148460 2 0 +T002SCH.T002T1 1 TRAFODION.T002SCH.T002T1/1521232436741 2 0 --- 1 row(s) selected. >> @@ -1013,7 +1013,7 @@ T002T1 0 >>invoke table(cluster stats()); -- Definition of Trafodion table TRAFODION.T002SCH.EXE_UTIL_CLUSTER_STATS__ --- Definition current Fri Aug 18 01:04:18 2017 +-- Definition current Fri Mar 16 20:35:23 2018 ( REGION_SERVER CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE @@ -1066,14 +1066,14 @@ T002SCH.T002T2I1 0 (EXPR) (EXPR) ------------------------------ -------------------- -RegionName: 1503018139543 0 -RegionName: 1503018148460 0 -RegionName: 1503018143500 0 -RegionName: 1503018210241 0 -RegionName: 1503018169131 0 -RegionName: 1503018158021 0 -RegionName: 1503018204323 0 -RegionName: 1503018135470 0 +RegionName: 1521232434388 0 +RegionName: 1521232441739 0 +RegionName: 1521232436741 0 +RegionName: 1521232429374 0 +RegionName: 1521232475166 0 +RegionName: 1521232479869 0 +RegionName: 1521232446363 0 +RegionName: 1521232431811 0 --- 8 row(s) selected. >> @@ -1084,7 +1084,7 @@ RegionName: 1503018135470 0 >>invoke table(hivemd(tables)); -- Definition of Trafodion table TRAFODION.T002SCH.HIVEMD_TABLES__ --- Definition current Fri Aug 18 01:04:18 2017 +-- Definition current Fri Mar 16 20:35:24 2018 ( CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE @@ -1116,7 +1116,7 @@ RegionName: 1503018135470 0 >>invoke table(hivemd(columns)); -- Definition of Trafodion table TRAFODION.T002SCH.HIVEMD_COLUMNS__ --- Definition current Fri Aug 18 01:04:19 2017 +-- Definition current Fri Mar 16 20:35:24 2018 ( CATALOG_NAME CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE @@ -1130,6 +1130,8 @@ RegionName: 1503018135470 0 , SQL_DATA_TYPE CHAR(32) CHARACTER SET ISO88591 COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE , FS_DATA_TYPE INT NO DEFAULT NOT NULL NOT DROPPABLE + , DISPLAY_DATA_TYPE CHAR(96) CHARACTER SET ISO88591 COLLATE + DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE , HIVE_DATA_TYPE CHAR(32) CHARACTER SET ISO88591 COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE , COLUMN_SIZE INT NO DEFAULT NOT NULL NOT DROPPABLE @@ -1152,82 +1154,140 @@ RegionName: 1503018135470 0 ) PRIMARY KEY (CATALOG_NAME ASC, SCHEMA_NAME ASC, TABLE_NAME ASC) +--- SQL operation complete. +>> +>>process hive statement 'drop table thive002'; + +--- SQL operation complete. +>>process hive statement 'create table thive002 (a int, b string)'; + --- SQL operation complete. >>select cast(table_name as char(30) character set iso88591), +> file_format, num_cols, num_part_cols, num_bucket_cols, num_sort_cols, +> field_delimiter, record_terminator, hive_table_type -+> from table(hivemd(tables, "hive", "warehouse")); ++> from table(hivemd(tables, "hive", "thive002")) ++> where file_format = 'TEXTFILE'; (EXPR) FILE_FORMAT NUM_COLS NUM_PART_COLS NUM_BUCKET_COLS NUM_SORT_COLS FIELD_DELIMITER RECORD_TERMINATOR HIVE_TABLE_TYPE ------------------------------ ------------------------ ----------- ------------- --------------- ------------- --------------- ----------------- -------------------------------------------------------------------------------------------------------------------------------- -warehouse TEXTFILE 14 0 0 0 124 10 EXTERNAL_TABLE +thive002 TEXTFILE 2 0 0 0 1 10 MANAGED_TABLE --- 1 row(s) selected. >>select cast(table_name as char(30) character set iso88591), +> file_format, num_cols, num_part_cols, num_bucket_cols, num_sort_cols, +> field_delimiter, record_terminator, hive_table_type -+> from table(hivemd(tables)) where table_name = 'warehouse'; ++> from table(hivemd(tables)) where table_name = 'thive002' ++> and file_format = 'TEXTFILE'; (EXPR) FILE_FORMAT NUM_COLS NUM_PART_COLS NUM_BUCKET_COLS NUM_SORT_COLS FIELD_DELIMITER RECORD_TERMINATOR HIVE_TABLE_TYPE ------------------------------ ------------------------ ----------- ------------- --------------- ------------- --------------- ----------------- -------------------------------------------------------------------------------------------------------------------------------- -warehouse TEXTFILE 14 0 0 0 124 10 EXTERNAL_TABLE +thive002 TEXTFILE 2 0 0 0 1 10 MANAGED_TABLE --- 1 row(s) selected. +>> +>>cqd nested_joins 'OFF'; + +--- SQL operation complete. >>select cast(column_name as char(30) character set iso88591), +> sql_data_type, fs_data_type, hive_data_type, +> column_size, column_scale, +> column_number, part_col_number, bucket_col_number, sort_col_number -+> from table(hivemd(columns, "hive", "warehouse")) ++> from table(hivemd(columns, "hive", "thive002")) C, ++> table(hivemd(tables, "hive", "thive002")) T ++> where C.table_name = T.table_name ++> and T.file_format = 'TEXTFILE' +> order by column_number; (EXPR) SQL_DATA_TYPE FS_DATA_TYPE HIVE_DATA_TYPE COLUMN_SIZE COLUMN_SCALE COLUMN_NUMBER PART_COL_NUMBER BUCKET_COL_NUMBER SORT_COL_NUMBER ------------------------------ -------------------------------- ------------ -------------------------------- ----------- ------------ ------------- --------------- ----------------- --------------- -w_warehouse_sk SIGNED INTEGER 132 int 4 0 0 -1 -1 -1 -w_warehouse_id VARCHAR 64 string 20 0 1 -1 -1 -1 -w_warehouse_name VARCHAR 64 string 20 0 2 -1 -1 -1 -w_warehouse_sq_ft SIGNED INTEGER 132 int 4 0 3 -1 -1 -1 -w_street_number VARCHAR 64 string 20 0 4 -1 -1 -1 -w_street_name VARCHAR 64 string 20 0 5 -1 -1 -1 -w_street_type VARCHAR 64 string 20 0 6 -1 -1 -1 -w_suite_number VARCHAR 64 string 20 0 7 -1 -1 -1 -w_city VARCHAR 64 string 20 0 8 -1 -1 -1 -w_county VARCHAR 64 string 20 0 9 -1 -1 -1 -w_state VARCHAR 64 string 20 0 10 -1 -1 -1 -w_zip VARCHAR 64 string 20 0 11 -1 -1 -1 -w_country VARCHAR 64 string 20 0 12 -1 -1 -1 -w_gmt_offset REAL 142 float 4 0 13 -1 -1 -1 - ---- 14 row(s) selected. +a SIGNED INTEGER 132 int 4 0 0 -1 -1 -1 +b VARCHAR 64 string 20 -1 1 -1 -1 -1 + +--- 2 row(s) selected. +>> >>select cast(column_name as char(30) character set iso88591), +> sql_data_type, fs_data_type, hive_data_type, +> column_size, column_scale, +> column_number, part_col_number, bucket_col_number, sort_col_number -+> from table(hivemd(columns)) -+> where table_name = 'warehouse' ++> from table(hivemd(tables, "hive", "thive002")) T, ++> table(hivemd(columns, "hive", "thive002")) C ++> where C.table_name = T.table_name ++> and T.file_format = 'TEXTFILE' ++> and T.table_name = 'thive002' ++> and C.table_name = 'thive002' +> order by column_number; (EXPR) SQL_DATA_TYPE FS_DATA_TYPE HIVE_DATA_TYPE COLUMN_SIZE COLUMN_SCALE COLUMN_NUMBER PART_COL_NUMBER BUCKET_COL_NUMBER SORT_COL_NUMBER ------------------------------ -------------------------------- ------------ -------------------------------- ----------- ------------ ------------- --------------- ----------------- --------------- -w_warehouse_sk SIGNED INTEGER 132 int 4 0 0 -1 -1 -1 -w_warehouse_id VARCHAR 64 string 20 0 1 -1 -1 -1 -w_warehouse_name VARCHAR 64 string 20 0 2 -1 -1 -1 -w_warehouse_sq_ft SIGNED INTEGER 132 int 4 0 3 -1 -1 -1 -w_street_number VARCHAR 64 string 20 0 4 -1 -1 -1 -w_street_name VARCHAR 64 string 20 0 5 -1 -1 -1 -w_street_type VARCHAR 64 string 20 0 6 -1 -1 -1 -w_suite_number VARCHAR 64 string 20 0 7 -1 -1 -1 -w_city VARCHAR 64 string 20 0 8 -1 -1 -1 -w_county VARCHAR 64 string 20 0 9 -1 -1 -1 -w_state VARCHAR 64 string 20 0 10 -1 -1 -1 -w_zip VARCHAR 64 string 20 0 11 -1 -1 -1 -w_country VARCHAR 64 string 20 0 12 -1 -1 -1 -w_gmt_offset REAL 142 float 4 0 13 -1 -1 -1 - ---- 14 row(s) selected. +a SIGNED INTEGER 132 int 4 0 0 -1 -1 -1 +b VARCHAR 64 string 20 -1 1 -1 -1 -1 + +--- 2 row(s) selected. +>>cqd nested_joins reset; + +--- SQL operation complete. +>> +>>prepare s from select schema_name from table(hivemd(tables)) where table_name = 'thive002' and file_format = 'TEXTFILE'; + +--- SQL command prepared. +>>-- should return one row +>>execute s; + +SCHEMA_NAME +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +hive + +--- 1 row(s) selected. +>>-- should return one row +>>execute s; + +SCHEMA_NAME +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +hive + +--- 1 row(s) selected. +>> +>>process hive statement 'drop table thivearr'; + +--- SQL operation complete. +>>process hive statement 'create table thivearr (a array)'; + +--- SQL operation complete. +>>-- should return warning 8742 +>>select table_name from table(hivemd(columns)) where table_name = 'thivearr'; + +*** WARNING[8742] GetMetaDataInfo operation could not be completed. Reason: Datatype array for column 'a' in table hive.hive.thivearr is not supported. This table will be ignored. + +--- 0 row(s) selected. +>> +>>process hive ddl 'drop table thivealldt'; + +--- SQL operation complete. +>>process hive ddl 'create table thivealldt(a smallint, b int, c bigint, d decimal(3,1), e string, f char(10), g varchar(7), h date, i timestamp)'; + +--- SQL operation complete. +>>select fs_data_type, left(sql_data_type, 20) sql_data_type, left(display_data_type, 60) display_data_type, hive_data_type, column_precision, column_scale, column_size from table(hivemd(columns, "hive","thivealldt" )); + +FS_DATA_TYPE SQL_DATA_TYPE DISPLAY_DATA_TYPE HIVE_DATA_TYPE COLUMN_PRECISION COLUMN_SCALE COLUMN_SIZE +------------ -------------------- ------------------------------------------------------------ -------------------------------- ---------------- ------------ ----------- + + 130 SIGNED SMALLINT SMALLINT smallint 15 0 2 + 132 SIGNED INTEGER INT int 31 0 4 + 134 SIGNED LARGEINT LARGEINT bigint 63 0 8 + 130 SIGNED SMALLINT NUMERIC(3, 1) decimal(3,1) 3 1 2 + 64 VARCHAR VARCHAR(20 BYTES) CHARACTER SET UTF8 string -1 -1 20 + 0 CHARACTER CHAR(10 CHARS) CHARACTER SET UTF8 char(10) -1 -1 40 + 64 VARCHAR VARCHAR(7 CHARS) CHARACTER SET UTF8 varchar(7) -1 -1 28 + 192 DATETIME DATE date 1 0 4 + 192 DATETIME TIMESTAMP(6) timestamp 3 6 11 + +--- 9 row(s) selected. >> >>create table createOptions (a int) HBASE_OPTIONS +>(max_versions = '3', diff --git a/core/sql/regress/seabase/EXPECTED030 b/core/sql/regress/seabase/EXPECTED030 index 59e7880b3c..b5385a796a 100644 --- a/core/sql/regress/seabase/EXPECTED030 +++ b/core/sql/regress/seabase/EXPECTED030 @@ -695,6 +695,7 @@ A B C D *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: -DEC-2016 --- 0 row(s) selected. +>> >>select to_time('2016-03-01', 'YYYY-MM-DD') from (values(1)) x(a); *** ERROR[4065] The format, "YYYY-MM-DD", specified in the TO_TIME function is not supported. @@ -712,6 +713,19 @@ A B C D *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 01:61:01 --- 0 row(s) selected. +>>select to_time(1, 'HH:MI:SS') from dual; + +*** ERROR[3415] The first operand of function TO_TIME is not valid. It must be a datetime datatype containing the time field or a character datatype. + +*** ERROR[8822] The statement was not prepared. + +>>select to_time(date '2018-04-02', 'HH:MI:SS') from dual; + +*** ERROR[3415] The first operand of function TO_TIME is not valid. It must be a datetime datatype containing the time field or a character datatype. + +*** ERROR[8822] The statement was not prepared. + +>> >>select to_date('2016-04-33 01:01:01','YYYY-MM-DD HH24:MI:SS') from (values(1)) x(a); *** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data: 2016-04-33 01:01:01 diff --git a/core/sql/regress/seabase/EXPECTED031 b/core/sql/regress/seabase/EXPECTED031 index 43a3d2db66..6d8d54201c 100644 --- a/core/sql/regress/seabase/EXPECTED031 +++ b/core/sql/regress/seabase/EXPECTED031 @@ -446,7 +446,7 @@ Z Z (EXPR) (EXPR) >>invoke t031t10; -- Definition of Trafodion table TRAFODION.SCH.T031T10 --- Definition current Thu Jul 13 22:37:04 2017 +-- Definition current Sun Mar 11 00:49:14 2018 ( SYSKEY LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE @@ -648,7 +648,7 @@ LC RC OP OPERATOR OPT DESCRIPTION CARD >>invoke t031t1; -- Definition of Trafodion table TRAFODION.SCH.T031T1 --- Definition current Thu Jul 13 22:38:01 2017 +-- Definition current Sun Mar 11 00:50:44 2018 ( SYSKEY LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE @@ -679,7 +679,7 @@ A B >>invoke t031t1; -- Definition of Trafodion table TRAFODION.SCH.T031T1 --- Definition current Thu Jul 13 22:38:10 2017 +-- Definition current Sun Mar 11 00:50:53 2018 ( SYSKEY LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE @@ -730,7 +730,7 @@ A B C >>invoke t031t1; -- Definition of Trafodion table TRAFODION.SCH.T031T1 --- Definition current Thu Jul 13 22:38:19 2017 +-- Definition current Sun Mar 11 00:51:05 2018 ( SYSKEY LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE @@ -759,7 +759,7 @@ A B C >>invoke t031t1; -- Definition of Trafodion table TRAFODION.SCH.T031T1 --- Definition current Thu Jul 13 22:38:29 2017 +-- Definition current Sun Mar 11 00:51:23 2018 ( SYSKEY LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE @@ -784,7 +784,7 @@ A B C >>invoke t031t1; -- Definition of Trafodion table TRAFODION.SCH.T031T1 --- Definition current Thu Jul 13 22:38:36 2017 +-- Definition current Sun Mar 11 00:51:32 2018 ( SYSKEY LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE @@ -804,7 +804,7 @@ A B C >>invoke t031t1; -- Definition of Trafodion table TRAFODION.SCH.T031T1 --- Definition current Thu Jul 13 22:38:40 2017 +-- Definition current Sun Mar 11 00:51:37 2018 ( SYSKEY LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE @@ -819,7 +819,7 @@ A B C >>invoke t031v1; -- Definition of Trafodion view TRAFODION.SCH.T031V1 --- Definition current Thu Jul 13 22:38:43 2017 +-- Definition current Sun Mar 11 00:51:41 2018 ( A INT DEFAULT NULL @@ -842,7 +842,7 @@ A B C >>invoke t031v1; -- Definition of Trafodion view TRAFODION.SCH.T031V1 --- Definition current Thu Jul 13 22:38:47 2017 +-- Definition current Sun Mar 11 00:51:45 2018 ( A INT DEFAULT NULL @@ -860,7 +860,7 @@ A B C >>invoke t031v1; -- Definition of Trafodion view TRAFODION.SCH.T031V1 --- Definition current Thu Jul 13 22:38:56 2017 +-- Definition current Sun Mar 11 00:51:52 2018 ( A INT DEFAULT NULL @@ -947,7 +947,7 @@ CREATE INDEX T031T1I1 ON TRAFODION.SCH.T031T1 >>invoke table(index_table t031t1i1); -- Definition of Trafodion table TRAFODION.SCH.T031T1I1 --- Definition current Thu Jul 13 22:39:19 2017 +-- Definition current Sun Mar 11 00:52:20 2018 ( "A@" INT NO DEFAULT @@ -1092,7 +1092,7 @@ CREATE TABLE T031HIVET1 /* Trafodion DDL */ REGISTER /*INTERNAL*/ HIVE TABLE HIVE.HIVE.T031HIVET1; -/* ObjectUID = 3677902230547698142 */ +/* ObjectUID = 596882092547840046 */ CREATE EXTERNAL TABLE T031HIVET1 FOR HIVE.HIVE.T031HIVET1 @@ -1259,8 +1259,8 @@ A A@ SYSKEY ----------- -------------------- - 1 2229979378881154564 - 2 2229979378881461552 + 1 2046478438118704386 + 2 2046478438119028079 --- 2 row(s) selected. >> @@ -1330,5 +1330,21 @@ A B C --- 4 row(s) selected. >> +>>-- caching of zero length strings +>>drop table if exists t031t1 cascade; + +--- SQL operation complete. +>>CREATE TABLE t031t1 ++> ( ++> a CHAR(1) not null ++> , b CHAR(1 BYTE) CHARACTER SET UTF8 not null ++>); + +--- SQL operation complete. +>> +>>-- should not crash +>>prepare s from INSERT INTO t031t1 VALUES (DECODE('9', '9', 'F'), ''); + +--- SQL command prepared. >> >>log; diff --git a/core/sql/regress/seabase/TEST002 b/core/sql/regress/seabase/TEST002 index f63eff4a45..c7bc291f17 100644 --- a/core/sql/regress/seabase/TEST002 +++ b/core/sql/regress/seabase/TEST002 @@ -184,27 +184,58 @@ select cast('RegionName: ' || trim(region_name) as char(30) character set iso885 cqd hive_max_string_length_in_bytes '20'; invoke table(hivemd(tables)); invoke table(hivemd(columns)); + +process hive statement 'drop table thive002'; +process hive statement 'create table thive002 (a int, b string)'; select cast(table_name as char(30) character set iso88591), file_format, num_cols, num_part_cols, num_bucket_cols, num_sort_cols, field_delimiter, record_terminator, hive_table_type - from table(hivemd(tables, "hive", "warehouse")); + from table(hivemd(tables, "hive", "thive002")) + where file_format = 'TEXTFILE'; select cast(table_name as char(30) character set iso88591), file_format, num_cols, num_part_cols, num_bucket_cols, num_sort_cols, field_delimiter, record_terminator, hive_table_type - from table(hivemd(tables)) where table_name = 'warehouse'; + from table(hivemd(tables)) where table_name = 'thive002' + and file_format = 'TEXTFILE'; + +cqd nested_joins 'OFF'; select cast(column_name as char(30) character set iso88591), sql_data_type, fs_data_type, hive_data_type, column_size, column_scale, column_number, part_col_number, bucket_col_number, sort_col_number - from table(hivemd(columns, "hive", "warehouse")) + from table(hivemd(columns, "hive", "thive002")) C, + table(hivemd(tables, "hive", "thive002")) T + where C.table_name = T.table_name + and T.file_format = 'TEXTFILE' order by column_number; + select cast(column_name as char(30) character set iso88591), sql_data_type, fs_data_type, hive_data_type, column_size, column_scale, column_number, part_col_number, bucket_col_number, sort_col_number - from table(hivemd(columns)) - where table_name = 'warehouse' + from table(hivemd(tables, "hive", "thive002")) T, + table(hivemd(columns, "hive", "thive002")) C + where C.table_name = T.table_name + and T.file_format = 'TEXTFILE' + and T.table_name = 'thive002' + and C.table_name = 'thive002' order by column_number; +cqd nested_joins reset; + +prepare s from select schema_name from table(hivemd(tables)) where table_name = 'thive002' and file_format = 'TEXTFILE'; +-- should return one row +execute s; +-- should return one row +execute s; + +process hive statement 'drop table thivearr'; +process hive statement 'create table thivearr (a array)'; +-- should return warning 8742 +select table_name from table(hivemd(columns)) where table_name = 'thivearr'; + +process hive ddl 'drop table thivealldt'; +process hive ddl 'create table thivealldt(a smallint, b int, c bigint, d decimal(3,1), e string, f char(10), g varchar(7), h date, i timestamp)'; +select fs_data_type, left(sql_data_type, 20) sql_data_type, left(display_data_type, 60) display_data_type, hive_data_type, column_precision, column_scale, column_size from table(hivemd(columns, "hive","thivealldt" )); create table createOptions (a int) HBASE_OPTIONS (max_versions = '3', diff --git a/core/sql/regress/seabase/TEST030 b/core/sql/regress/seabase/TEST030 index ed43ff97a7..b21486063a 100644 --- a/core/sql/regress/seabase/TEST030 +++ b/core/sql/regress/seabase/TEST030 @@ -127,9 +127,13 @@ select to_char(time '10:23:34', 'DD.MM.YYYY HH24.MI.SS') from (values(1)) x(a); select to_date ('10:23:34', 'HH24:MI:SS') from (values(1)) x(a); select to_date ('10:23:34', 'HH:MI:SS') from (values(1)) x(a); select to_date('04-DEC-2016','DDMONYYYY') from (values(1)) x(a); + select to_time('2016-03-01', 'YYYY-MM-DD') from (values(1)) x(a); select to_time('03/01/2016 10:11:12', 'MM/DD/YYYY HH24:MI:SS') from (values(1)) x(a); select to_time('01:61:01', 'HH24:MI:SS') from (values(1)) x(a); +select to_time(1, 'HH:MI:SS') from dual; +select to_time(date '2018-04-02', 'HH:MI:SS') from dual; + select to_date('2016-04-33 01:01:01','YYYY-MM-DD HH24:MI:SS') from (values(1)) x(a); select * from t030t1 where to_date(c, 'YYYY-MM-DD') = '2016-03-01'; select to_date('01.03.2016:10:11:12', 'DD.MM.YYYY:HH24:MI:SS') from (values(1)) x(a); diff --git a/core/sql/regress/seabase/TEST031 b/core/sql/regress/seabase/TEST031 index 4d9ad04aae..aa9cf09c6b 100644 --- a/core/sql/regress/seabase/TEST031 +++ b/core/sql/regress/seabase/TEST031 @@ -379,5 +379,15 @@ insert into hive.hive.t031hive1 values (2, '2017-01-02 11:11:11', 'a'), select * from hive.hive.t031hive1; +-- caching of zero length strings +drop table if exists t031t1 cascade; +CREATE TABLE t031t1 + ( + a CHAR(1) not null + , b CHAR(1 BYTE) CHARACTER SET UTF8 not null +); + +-- should not crash +prepare s from INSERT INTO t031t1 VALUES (DECODE('9', '9', 'F'), ''); log;