Repository: trafodion
Updated Branches:
refs/heads/master 071a5db97 -> ecc1a5659
modified: core/sql/bin/SqlciErrors.txt
modified: core/sql/common/OperTypeEnum.h
modified: core/sql/exp/ExpPackDefs.cpp
modified: core/sql/exp/exp_clause.cpp
modified: core/sql/exp/exp_clause.h
modified: core/sql/exp/exp_function.cpp
modified: core/sql/exp/exp_function.h
modified: core/sql/generator/GenItemFunc.cpp
modified: core/sql/optimizer/ItemExpr.cpp
modified: core/sql/optimizer/ItemFunc.h
modified: core/sql/optimizer/SynthType.cpp
modified: core/sql/parser/ParKeyWords.cpp
modified: core/sql/parser/sqlparser.y
modified: core/sql/regress/core/EXPECTED038.LINUX
modified: core/sql/regress/core/TEST038
modified: docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/2e26003e
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/2e26003e
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/2e26003e
Branch: refs/heads/master
Commit: 2e26003eab6ba2cd2063ccd6ea55ba984ba5a5fb
Parents: b4236db
Author: zlei929 <[email protected]>
Authored: Thu Jul 12 19:38:25 2018 +0800
Committer: zlei929 <[email protected]>
Committed: Thu Jul 12 19:38:25 2018 +0800
----------------------------------------------------------------------
core/sql/bin/SqlciErrors.txt | 1 +
core/sql/common/OperTypeEnum.h | 1 +
core/sql/exp/ExpPackDefs.cpp | 5 +
core/sql/exp/exp_clause.cpp | 6 +
core/sql/exp/exp_clause.h | 3 +-
core/sql/exp/exp_function.cpp | 61 +++++++++
core/sql/exp/exp_function.h | 19 +++
core/sql/generator/GenItemFunc.cpp | 7 +
core/sql/optimizer/ItemExpr.cpp | 16 +++
core/sql/optimizer/ItemFunc.h | 18 +++
core/sql/optimizer/SynthType.cpp | 76 +++++++++++
core/sql/parser/ParKeyWords.cpp | 1 +
core/sql/parser/sqlparser.y | 6 +
core/sql/regress/core/EXPECTED038.LINUX | 129 +++++++++++++++++++
core/sql/regress/core/TEST038 | 21 +++
.../src/asciidoc/_chapters/binder_msgs.adoc | 12 ++
16 files changed, 381 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/bin/SqlciErrors.txt
----------------------------------------------------------------------
diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt
index 71a43a6..a4b13b8 100644
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@ -1450,6 +1450,7 @@ $1~String1 --------------------------------
4494 ZZZZZ 99999 BEGINNER MINOR LOGONLY LOAD is not supported on a table with
LOB columns. Table $0~TableName has LOB column $1~ColumnName.
4495 ZZZZZ 99999 BEGINNER MINOR LOGONLY UNLOAD is not supported on a SELECT
with LOB columns. $0~ColumnName is a LOB column.
4496 42000 99999 BEGINNER MAJOR DBADMIN $0~String0 is supported only with
datetime fields.
+4497 ZZZZZ 99999 BEGINNER MAJOR DBADMIN The $0~String0 operand of $1~String1
must be greater than $2~String2
5000 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Internal error in the query normalizer.
5001 ZZZZZ 99999 ADVANDED MINOR LOGONLY Common subexpression $0~String0 will
not be shared among multiple consumers. Reason: $1~String1.
6000 ZZZZZ 99999 ADVANCED MAJOR DBADMIN Internal error in the query optimizer.
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/common/OperTypeEnum.h
----------------------------------------------------------------------
diff --git a/core/sql/common/OperTypeEnum.h b/core/sql/common/OperTypeEnum.h
index e375c0a..6bda946 100644
--- a/core/sql/common/OperTypeEnum.h
+++ b/core/sql/common/OperTypeEnum.h
@@ -519,6 +519,7 @@ enum OperatorTypeEnum {
ITM_JSONOBJECTFIELDTEXT = 2241,
// string functions
+ ITM_SPLIT_PART = 2249,
ITM_TRUNC = 2250,
ITM_ASCII = 2251,
ITM_POSITION = 2252,
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/exp/ExpPackDefs.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpPackDefs.cpp b/core/sql/exp/ExpPackDefs.cpp
index b8e6d6b..617e820 100644
--- a/core/sql/exp/ExpPackDefs.cpp
+++ b/core/sql/exp/ExpPackDefs.cpp
@@ -244,6 +244,11 @@ Long ex_function_upper::pack(void * space_)
return packClause(space_, sizeof(ex_function_upper));
}
+Long ex_function_split_part::pack(void * space_)
+{
+ return packClause(space_, sizeof(ex_function_split_part));
+}
+
Long ex_function_translate::pack(void * space_)
{
return packClause(space_, sizeof(ex_function_translate));
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/exp/exp_clause.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_clause.cpp b/core/sql/exp/exp_clause.cpp
index ffd8b27..7c908d1 100644
--- a/core/sql/exp/exp_clause.cpp
+++ b/core/sql/exp/exp_clause.cpp
@@ -224,6 +224,9 @@ ex_clause::ex_clause(clause_type type,
case ITM_POSITION_DOUBLEBYTE:
setClassID(FUNC_POSITION_DOUBLEBYTE_ID);
break;
+ case ITM_SPLIT_PART:
+ setClassID(FUNC_SPLIT_PART_ID);
+ break;
case ITM_CONCAT:
setClassID(FUNC_CONCAT_ID);
break;
@@ -723,6 +726,9 @@ char *ex_clause::findVTblPtr(short classID)
case ex_clause::FUNC_POSITION_DOUBLEBYTE_ID:
GetVTblPtr(vtblPtr, ex_function_position_doublebyte);
break;
+ case ex_clause::FUNC_SPLIT_PART_ID:
+ GetVTblPtr(vtblPtr, ex_function_split_part);
+ break;
case ex_clause::FUNC_CONCAT_ID:
GetVTblPtr(vtblPtr, ex_function_concat);
break;
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/exp/exp_clause.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_clause.h b/core/sql/exp/exp_clause.h
index fda7269..ad51e4f 100644
--- a/core/sql/exp/exp_clause.h
+++ b/core/sql/exp/exp_clause.h
@@ -211,7 +211,8 @@ public:
FUNC_AES_DECRYPT = 130,
FUNC_REVERSE_ID = 131,
FUNC_SLEEP_ID = 132,
- FUNC_UNIX_TIMESTAMP_ID = 133
+ FUNC_UNIX_TIMESTAMP_ID = 133,
+ FUNC_SPLIT_PART_ID = 134
};
// max number of operands (including result) in a clause.
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index 85a5fbf..496fa3f 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -192,6 +192,7 @@ ex_function_user::ex_function_user(){};
ex_function_nullifzero::ex_function_nullifzero(){};
ex_function_nvl::ex_function_nvl(){};
ex_function_json_object_field_text::ex_function_json_object_field_text(){};
+ex_function_split_part::ex_function_split_part(){};
ex_function_queryid_extract::ex_function_queryid_extract(){};
ExFunctionUniqueId::ExFunctionUniqueId(){};
@@ -829,6 +830,13 @@ ExFunctionSoundex::ExFunctionSoundex(OperatorTypeEnum
oper_type,
};
+ex_function_split_part::ex_function_split_part(OperatorTypeEnum oper_type
+ , Attributes **attr
+ , Space *space)
+ : ex_function_clause(oper_type, 4, attr, space)
+{
+
+}
// Triggers
ex_expr::exp_return_type ex_function_get_bit_value_at::eval(char *op_data[],
@@ -2746,6 +2754,59 @@ ex_expr::exp_return_type ex_function_unixtime::eval(char
*op_data[],
return ex_expr::EXPR_OK;
}
+ex_expr::exp_return_type ex_function_split_part::eval(char *op_data[]
+ , CollHeap* heap
+ , ComDiagsArea** diagsArea)
+{
+ size_t sourceLen = getOperand(1)->getLength(op_data[-MAX_OPERANDS+1]);
+ size_t patternLen = getOperand(2)->getLength(op_data[-MAX_OPERANDS+2]);
+ Lng32 indexOfTarget = *(Lng32 *)op_data[3];
+
+ if (indexOfTarget <= 0)
+ {
+ ExRaiseSqlError(heap, diagsArea, (ExeErrorCode)4497);
+ *(*diagsArea) << DgString0("third")
+ << DgString1("split_part")
+ << DgString2("0");
+ return ex_expr::EXPR_ERROR;
+ }
+
+ NAString source(op_data[1], sourceLen);
+ NAString pattern(op_data[2], patternLen);
+
+ Lng32 patternCnt = 0;
+ StringPos currentTargetPos = 0;
+ StringPos pos = 0;
+
+ while (patternCnt != indexOfTarget)
+ {
+ currentTargetPos = pos;
+ pos = source.index(pattern, pos);
+ if (pos == NA_NPOS)
+ break;
+ pos = pos + patternLen;
+ patternCnt++;
+ }
+
+ size_t targetLen = 0;
+ if ((patternCnt == 0)
+ ||((patternCnt != indexOfTarget)
+ && (patternCnt != indexOfTarget - 1)))
+ op_data[0][0] = '\0';
+ else
+ {
+ if (patternCnt == indexOfTarget)
+ targetLen = pos - currentTargetPos - patternLen;
+ else //if (patternLen == indexOfTarget-1)
+ targetLen = sourceLen - currentTargetPos;
+
+ str_cpy_all(op_data[0], op_data[1] + currentTargetPos, targetLen);
+ }
+ getOperand(0)->setVarLength(targetLen, op_data[-MAX_OPERANDS]);
+ return ex_expr::EXPR_OK;
+}
+
+
ex_expr::exp_return_type ex_function_current::eval(char *op_data[],
CollHeap*,
ComDiagsArea**)
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/exp/exp_function.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.h b/core/sql/exp/exp_function.h
index c107606..6debaba 100644
--- a/core/sql/exp/exp_function.h
+++ b/core/sql/exp/exp_function.h
@@ -4188,7 +4188,26 @@ private:
// that the size of the object remains the same (and is modulo 8).
// ---------------------------------------------------------------------
char fillers_[8]; // 08-15
+};
+
+class ex_function_split_part: public ex_function_clause {
+
+public:
+ ex_function_split_part(OperatorTypeEnum oper_type
+ , Attributes **attr
+ , Space *space);
+ ex_function_split_part();
+
+ ex_expr::exp_return_type eval(char *op_data[], CollHeap*, ComDiagsArea** =
0);
+ Long pack(void *);
+ virtual unsigned char getClassVersionID(){return 1;}
+ virtual void populateImageVersionIDArray()
+ {
+ setImageVersionID(2, getClassVersionID());
+ ex_function_clause::populateImageVersionIDArray();
+ }
+ virtual short getClassSize(){return (short)sizeof(*this);}
};
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/generator/GenItemFunc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenItemFunc.cpp
b/core/sql/generator/GenItemFunc.cpp
index 60a8f19..f653c03 100644
--- a/core/sql/generator/GenItemFunc.cpp
+++ b/core/sql/generator/GenItemFunc.cpp
@@ -713,6 +713,13 @@ short BuiltinFunction::codeGen(Generator * generator)
CmpCommon::getDefaultNumeric(BLOCK_ENCRYPTION_MODE));
break;
}
+
+ case ITM_SPLIT_PART:
+ {
+ function_clause =
+ new (generator->getSpace())
ex_function_split_part(getOperatorType(), attr, space);
+ break;
+ }
default:
break;
}
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/optimizer/ItemExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ItemExpr.cpp b/core/sql/optimizer/ItemExpr.cpp
index 920d2f4..f0c3825 100644
--- a/core/sql/optimizer/ItemExpr.cpp
+++ b/core/sql/optimizer/ItemExpr.cpp
@@ -7765,6 +7765,9 @@ const NAString BuiltinFunction::getText() const
case ITM_TO_TIMESTAMP:
return "to_timestamp";
+ case ITM_SPLIT_PART:
+ return "split_part";
+
default:
return "unknown func";
} // switch
@@ -15234,3 +15237,16 @@ ItemExpr
*ItmLeadOlapFunction::transformOlapFunction(CollHeap *heap)
return this;
}
+SplitPart::~SplitPart() {}
+
+ItemExpr * SplitPart::copyTopNode(ItemExpr *derivedNode, CollHeap *outHeap)
+{
+ ItemExpr *result = NULL;
+ if (derivedNode == NULL)
+ result = new (outHeap) SplitPart(child(0), child(1), child(2));
+ else
+ result = derivedNode;
+
+ return BuiltinFunction::copyTopNode(result, outHeap);
+}
+
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/optimizer/ItemFunc.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ItemFunc.h b/core/sql/optimizer/ItemFunc.h
index 2062919..0dd901e 100644
--- a/core/sql/optimizer/ItemFunc.h
+++ b/core/sql/optimizer/ItemFunc.h
@@ -5843,4 +5843,22 @@ public:
}; // class RowNumFunc
+class SplitPart : public CacheableBuiltinFunction
+{
+public:
+ SplitPart(ItemExpr *val1Ptr, ItemExpr *val2Ptr, ItemExpr *val3Ptr)
+ :CacheableBuiltinFunction(ITM_SPLIT_PART, 3, val1Ptr, val2Ptr, val3Ptr)
+ {
+ allowsSQLnullArg() = FALSE;
+ }
+
+ virtual ~SplitPart();
+
+ // a virtual function for type propagating the node
+ virtual const NAType * synthesizeType();
+
+ virtual ItemExpr * copyTopNode(ItemExpr *derivedNode = NULL,
+ CollHeap *outheap = 0);
+}; //class SplitPart
+
#endif /* ITEMFUNC_H */
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/optimizer/SynthType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/SynthType.cpp b/core/sql/optimizer/SynthType.cpp
index eaf4b89..ab6ff07 100644
--- a/core/sql/optimizer/SynthType.cpp
+++ b/core/sql/optimizer/SynthType.cpp
@@ -7139,3 +7139,79 @@ const NAType * ItmLeadOlapFunction::synthesizeType()
return result;
}
+const NAType * SplitPart::synthesizeType()
+{
+ ValueId vid1 = child(0)->getValueId();
+ ValueId vid2 = child(1)->getValueId();
+ ValueId vid3 = child(2)->getValueId();
+ vid1.coerceType(NA_CHARACTER_TYPE);
+ vid2.coerceType(NA_CHARACTER_TYPE);
+ SQLInt si(NULL);
+ vid3.coerceType(NA_NUMERIC_TYPE);
+
+ const NAType *operand1 = &child(0)->getValueId().getType();
+ const NAType *operand2 = &child(1)->getValueId().getType();
+ const NAType *operand3 = &child(2)->getValueId().getType();
+
+ if ((operand1->getTypeQualifier() != NA_CHARACTER_TYPE)
+ && (operand1->getFSDatatype() != REC_CLOB))
+ {
+ //4051 The first operand of a split_part function must be character.
+ *CmpCommon::diags()<<DgSqlCode(-4051) << DgString0(getTextUpper());
+ return NULL;
+ }
+ if ((operand2->getTypeQualifier() != NA_CHARACTER_TYPE)
+ && (operand1->getFSDatatype() != REC_CLOB))
+ {
+ //4051 The second operand of a split_part function must be character.
+ *CmpCommon::diags()<<DgSqlCode(-4051) << DgString0(getTextUpper());
+ return NULL;
+ }
+
+ if (operand3->getTypeQualifier() != NA_NUMERIC_TYPE)
+ {
+ //4053 The third operand of a split_part function must be numeric.
+ *CmpCommon::diags() << DgSqlCode(-4053) << DgString0(getTextUpper());
+ return NULL;
+ }
+
+ NABoolean negate;
+ ConstValue *cv = child(2)->castToConstValue(negate);
+ if (negate)
+ {
+ //4496 The third operand of a split_part function must be greater than
zero.
+ *CmpCommon::diags() << DgSqlCode(-4497) << DgString0("third") <<
DgString1(getTextUpper()) << DgString2("0");
+ return NULL;
+ }
+
+ const CharType *charOperand = (CharType *)operand1;
+ Lng32 maxLength_bytes = charOperand->getDataStorageSize();
+ Lng32 maxLength_chars = charOperand->getPrecisionOrMaxNumChars();
+ CharInfo::CharSet op1_cs = operand1->getCharSet();
+ if (maxLength_chars <= 0) //if unlimited
+ maxLength_chars = maxLength_bytes/CharInfo::minBytesPerChar(op1_cs);
+
+ if (operand1->getFSDatatype() == REC_CLOB)
+ {
+ return new HEAP SQLClob(HEAP
+ , maxLength_bytes
+ , Lob_Invalid_Storage
+ , operand1->supportsSQLnull()
+ OR operand2->supportsSQLnull()
+ OR operand3->supportsSQLnull()
+ );
+ }
+
+ return new HEAP SQLVarChar(HEAP
+ , CharLenInfo(maxLength_chars, maxLength_bytes)
+ , operand1->supportsSQLnull()
+ OR operand2->supportsSQLnull()
+ OR operand3->supportsSQLnull()
+ , charOperand->isUpshifted()
+ , charOperand->isCaseinsensitive()
+ , operand1->getCharSet()
+ , charOperand->getCollation()
+ , charOperand->getCoercibility()
+ );
+
+}
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/parser/ParKeyWords.cpp
----------------------------------------------------------------------
diff --git a/core/sql/parser/ParKeyWords.cpp b/core/sql/parser/ParKeyWords.cpp
index b58bc35..9cb1fc7 100644
--- a/core/sql/parser/ParKeyWords.cpp
+++ b/core/sql/parser/ParKeyWords.cpp
@@ -1065,6 +1065,7 @@ ParKeyWord ParKeyWords::keyWords_[] = {
ParKeyWord("SPACE", TOK_SPACE, NONRESTOKEN_),
ParKeyWord("SPECIFIC", TOK_SPECIFIC, COMPAQ_|RESWORD_),
ParKeyWord("SPECIFICTYPE", TOK_SPECIFICTYPE, COMPAQ_|RESWORD_),
+ ParKeyWord("SPLIT_PART", TOK_SPLIT_PART, NONRESTOKEN_),
ParKeyWord("SP_RESULT_SET", TOK_SP_RESULT_SET, NONRESTOKEN_),
ParKeyWord("SQL", TOK_SQL, ANS_|RESWORD_|SECOND_),
ParKeyWord("SQLCODE", TOK_SQLCODE, ANS_|RESWORD_),
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/parser/sqlparser.y
----------------------------------------------------------------------
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index a335670..387df06 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -1087,6 +1087,7 @@ static void enableMakeQuotedStringISO88591Mechanism()
%token <tokval> TOK_STATUS
%token <tokval> TOK_STDDEV /* Tandem extension */
%token <tokval> TOK_STOP /* Tandem extension */
+%token <tokval> TOK_SPLIT_PART /* Trafodion extension*/
%token <tokval> TOK_STORED
%token <tokval> TOK_SQL
%token <tokval> TOK_SQL_DOUBLE
@@ -9280,6 +9281,11 @@ string_function :
$$ = new (PARSERHEAP())
BuiltinFunction(ITM_REVERSE, CmpCommon::statementHeap(), 1, $3);
}
+ | TOK_SPLIT_PART '(' value_expression ',' value_expression ','
value_expression ')'
+ {
+ $$ = new (PARSERHEAP()) SplitPart($3, $5, $7);
+ }
+
/* type item */
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/regress/core/EXPECTED038.LINUX
----------------------------------------------------------------------
diff --git a/core/sql/regress/core/EXPECTED038.LINUX
b/core/sql/regress/core/EXPECTED038.LINUX
index d317748..117c7eb 100644
--- a/core/sql/regress/core/EXPECTED038.LINUX
+++ b/core/sql/regress/core/EXPECTED038.LINUX
@@ -4670,6 +4670,135 @@ test 55 trim on non-s
--- 4 row(s) selected.
>>-- 4 rows
>>
+>>-- test SPLIT_PART function
+>>
+>>select split_part('sa:sbl:sc', ':', 1) from t038sf;
+
+(EXPR)
+---------
+
+sa
+sa
+sa
+sa
+
+--- 4 row(s) selected.
+>>select split_part('sa:sbl:sc', ':', 2) from t038sf;
+
+(EXPR)
+---------
+
+sbl
+sbl
+sbl
+sbl
+
+--- 4 row(s) selected.
+>>select split_part('sa:sbl:sc', ':', 3) from t038sf;
+
+(EXPR)
+---------
+
+sc
+sc
+sc
+sc
+
+--- 4 row(s) selected.
+>>
+>>-- **EMPTY RESULT**
+>>select split_part('sa:sbl:sc', ':', 0) from t038sf;
+
+*** ERROR[4497] The third operand of split_part must be greater than 0
+
+--- 0 row(s) selected.
+>>select split_part('sa:sbl:sc', ':', 4) from t038sf;
+
+(EXPR)
+---------
+
+
+
+
+
+
+--- 4 row(s) selected.
+>>
+>>insert into T038sf values(110, 'a/b/c', 'sa/dsd/s');
+
+--- 1 row(s) inserted.
+>>insert into T038sf values(111, 'sasd', 'dsa:/~sd');
+
+--- 1 row(s) inserted.
+>>insert into T038sf values(112, '#$%$#@', 'dsasggggsad');
+
+--- 1 row(s) inserted.
+>>insert into T038sf values(114, 'a', 'è¿æ¯^ä¸æï¼æµè¯');
+
+--- 1 row(s) inserted.
+>>
+>>select split_part(c, '/', 2) from t038sf;
+
+(EXPR)
+------------------------------
+
+
+
+
+
+dsd
+~sd
+
+
+
+--- 8 row(s) selected.
+>>select split_part(c, 'ggg', 2) from t038sf;
+
+(EXPR)
+------------------------------
+
+
+
+
+
+
+
+gsad
+
+
+--- 8 row(s) selected.
+>>select split_part(c, 'sd', 1) from t038sf;
+
+(EXPR)
+------------------------------
+
+
+
+
+
+sa/d
+dsa:/~
+
+
+
+--- 8 row(s) selected.
+>>select split_part(c, 'ï¼', 1) from t038sf;
+
+(EXPR)
+------------------------------
+
+
+
+
+
+
+
+
+è¿æ¯^䏿
+
+--- 8 row(s) selected.
+>>
+>>
>>-- Test for Genesis soln: 10-071004-7982
>>-- Previously this would run out of memory in the Generator.
>>-- Now it compiles successfully with Query Cache off.
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/core/sql/regress/core/TEST038
----------------------------------------------------------------------
diff --git a/core/sql/regress/core/TEST038 b/core/sql/regress/core/TEST038
index 36e988f..593822e 100755
--- a/core/sql/regress/core/TEST038
+++ b/core/sql/regress/core/TEST038
@@ -1139,6 +1139,27 @@ select a, RPAD (c, 20, '7') from T038sf;
select RPAD (b, 12, '5'), LPAD (c, 13) from T038sf where RPAD( RPAD(b, 13,
'X'), 10, 'W') = b;
-- 4 rows
+-- test SPLIT_PART function
+
+select split_part('sa:sbl:sc', ':', 1) from t038sf;
+select split_part('sa:sbl:sc', ':', 2) from t038sf;
+select split_part('sa:sbl:sc', ':', 3) from t038sf;
+
+-- **EMPTY RESULT**
+select split_part('sa:sbl:sc', ':', 0) from t038sf;
+select split_part('sa:sbl:sc', ':', 4) from t038sf;
+
+insert into T038sf values(110, 'a/b/c', 'sa/dsd/s');
+insert into T038sf values(111, 'sasd', 'dsa:/~sd');
+insert into T038sf values(112, '#$%$#@', 'dsasggggsad');
+insert into T038sf values(114, 'a', 'è¿æ¯^ä¸æï¼æµè¯');
+
+select split_part(c, '/', 2) from t038sf;
+select split_part(c, 'ggg', 2) from t038sf;
+select split_part(c, 'sd', 1) from t038sf;
+select split_part(c, 'ï¼', 1) from t038sf;
+
+
-- Test for Genesis soln: 10-071004-7982
-- Previously this would run out of memory in the Generator.
-- Now it compiles successfully with Query Cache off.
http://git-wip-us.apache.org/repos/asf/trafodion/blob/2e26003e/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
----------------------------------------------------------------------
diff --git a/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
b/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
index 42b8509..f638754 100644
--- a/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
+++ b/docs/messages_guide/src/asciidoc/_chapters/binder_msgs.adoc
@@ -2919,3 +2919,15 @@ Use of predefined UDF <name> is deprecated and this
function will be removed in
*Recovery:* See message.
+[[SQL-4997]]
+== SQL 4997
+
+```
+The <number> operand of builtin-func <name> must be great than <intger value>.
+```
+*Cause:* You attempted to use the random function, which some operand of this
has range.
+
+*Effect:* The operation fails.
+
+*Recovery:* Correct the syntax and resubmit.
+