changes based on review comments
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/822c35e3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/822c35e3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/822c35e3 Branch: refs/heads/master Commit: 822c35e3abc9e87d1f58b2b3e60bf02486a55aa5 Parents: d48a0c9 Author: Anoop Sharma <[email protected]> Authored: Tue Jul 12 19:18:36 2016 +0000 Committer: Anoop Sharma <[email protected]> Committed: Tue Jul 12 19:18:36 2016 +0000 ---------------------------------------------------------------------- core/sql/common/MiscType.cpp | 4 --- core/sql/common/str.cpp | 5 ++-- core/sql/exp/exp_attrs.cpp | 2 +- core/sql/exp/exp_conv.cpp | 7 ++++- core/sql/optimizer/SynthType.cpp | 4 +-- core/sql/regress/seabase/EXPECTED003 | 48 +++++++++++++++---------------- 6 files changed, 36 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/822c35e3/core/sql/common/MiscType.cpp ---------------------------------------------------------------------- diff --git a/core/sql/common/MiscType.cpp b/core/sql/common/MiscType.cpp index 77b780d..2ca1c38 100644 --- a/core/sql/common/MiscType.cpp +++ b/core/sql/common/MiscType.cpp @@ -183,10 +183,8 @@ void SQLBooleanNative::minRepresentableValue(void* bufPtr, Lng32* bufLen, CollHeap* h) const { assert(*bufLen >= sizeof(Int8)); - Lng32 valueBuf; *bufLen = sizeof(Int8); *((Int8*)bufPtr) = 0; - valueBuf = 0; if (stringLiteral != NULL) { @@ -203,10 +201,8 @@ void SQLBooleanNative::maxRepresentableValue(void* bufPtr, Lng32* bufLen, CollHeap* h) const { assert(*bufLen >= sizeof(Int8)); - Lng32 valueBuf; *bufLen = sizeof(Int8); *((Int8*)bufPtr) = 1; - valueBuf = 0; if (stringLiteral != NULL) { http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/822c35e3/core/sql/common/str.cpp ---------------------------------------------------------------------- diff --git a/core/sql/common/str.cpp b/core/sql/common/str.cpp index a2a6c8c..e728143 100644 --- a/core/sql/common/str.cpp +++ b/core/sql/common/str.cpp @@ -1009,12 +1009,13 @@ char * str_strip_blanks(char *src , Lng32 &len, if (! src) return NULL; - len = str_len(src)-1; - if (len <= 0) + len = str_len(src); + if (len == 0) // empty return src; if (stripTrailing) { + len--; while ((len >= 0) && (src[len] == ' ')) len--; http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/822c35e3/core/sql/exp/exp_attrs.cpp ---------------------------------------------------------------------- diff --git a/core/sql/exp/exp_attrs.cpp b/core/sql/exp/exp_attrs.cpp index 6161377..54ac781 100644 --- a/core/sql/exp/exp_attrs.cpp +++ b/core/sql/exp/exp_attrs.cpp @@ -278,7 +278,7 @@ switch (datatype) case REC_INT_FRACTION: return extFormat? (char *)"INTERVAL FRACTION":(char *)"REC_INT_FRACTION"; case REC_BLOB: return extFormat? (char *)"BLOB":(char *)"REC_BLOB"; case REC_CLOB: return extFormat? (char *)"CLOB":(char *)"REC_CLOB"; - case REC_BOOLEAN: return extFormat ? (char *)"BOOLEAN" : (char *)"BOOLEAN"; + case REC_BOOLEAN: return extFormat ? (char *)"BOOLEAN" : (char *)"REC_BOOLEAN"; // When you add new datatype in /common/dfs2rec.h, don't // forget add new case here. Otherwise, showplan won't display it. http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/822c35e3/core/sql/exp/exp_conv.cpp ---------------------------------------------------------------------- diff --git a/core/sql/exp/exp_conv.cpp b/core/sql/exp/exp_conv.cpp index 1de00ea..7ea18b2 100644 --- a/core/sql/exp/exp_conv.cpp +++ b/core/sql/exp/exp_conv.cpp @@ -11330,9 +11330,14 @@ convDoIt(char * source, *(Int8*)target = 0; else { + char srcErrBuf[sourceLen + 1 + 2/*for quotes*/]; + strcpy(srcErrBuf, "'"); + str_cpy_all(&srcErrBuf[1], source, sourceLen); + srcErrBuf[1+sourceLen]=0; + strcat(srcErrBuf, "'"); ExRaiseSqlError(heap, diagsArea, EXE_INVALID_BOOLEAN_VALUE, NULL, NULL, NULL, NULL, - srcTempPtr); + srcErrBuf); return ex_expr::EXPR_ERROR; } } http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/822c35e3/core/sql/optimizer/SynthType.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/SynthType.cpp b/core/sql/optimizer/SynthType.cpp index cc39c36..ed64652 100644 --- a/core/sql/optimizer/SynthType.cpp +++ b/core/sql/optimizer/SynthType.cpp @@ -1965,8 +1965,8 @@ const NAType *UnArith::synthesizeType() { *CmpCommon::diags() << DgSqlCode(-4034) << DgString0("!") - << DgString1("") - << DgString2(child(0)->getTextUpper()); + << DgString1(child(0)->getText()) + << DgString2(""); return NULL; } http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/822c35e3/core/sql/regress/seabase/EXPECTED003 ---------------------------------------------------------------------- diff --git a/core/sql/regress/seabase/EXPECTED003 b/core/sql/regress/seabase/EXPECTED003 index 79347c9..3a47db8 100644 --- a/core/sql/regress/seabase/EXPECTED003 +++ b/core/sql/regress/seabase/EXPECTED003 @@ -21,7 +21,7 @@ >>invoke t003t1; -- Definition of Trafodion table TRAFODION.SCH.T003T1 --- Definition current Sun Jul 10 06:36:25 2016 +-- Definition current Tue Jul 12 19:09:22 2016 ( A TINYINT NO DEFAULT NOT NULL NOT DROPPABLE @@ -40,7 +40,7 @@ >>invoke t003t1_like; -- Definition of Trafodion table TRAFODION.SCH.T003T1_LIKE --- Definition current Sun Jul 10 06:36:36 2016 +-- Definition current Tue Jul 12 19:09:35 2016 ( A TINYINT NO DEFAULT NOT NULL NOT DROPPABLE @@ -59,7 +59,7 @@ >>invoke t003t1_as; -- Definition of Trafodion table TRAFODION.SCH.T003T1_AS --- Definition current Sun Jul 10 06:36:41 2016 +-- Definition current Tue Jul 12 19:09:40 2016 ( A TINYINT NO DEFAULT NOT NULL NOT DROPPABLE @@ -305,7 +305,7 @@ A B C D >>invoke hive.hive.ttiny; -- Definition of hive table TTINY --- Definition current Sun Jul 10 06:37:34 2016 +-- Definition current Tue Jul 12 19:10:44 2016 ( A TINYINT @@ -450,7 +450,7 @@ A B >>invoke t003t2; -- Definition of Trafodion table TRAFODION.SCH.T003T2 --- Definition current Sun Jul 10 06:37:44 2016 +-- Definition current Tue Jul 12 19:10:56 2016 ( A LARGEINT UNSIGNED NO DEFAULT NOT NULL NOT @@ -467,7 +467,7 @@ A B >>invoke t003t2_like; -- Definition of Trafodion table TRAFODION.SCH.T003T2_LIKE --- Definition current Sun Jul 10 06:37:48 2016 +-- Definition current Tue Jul 12 19:11:02 2016 ( A LARGEINT UNSIGNED NO DEFAULT NOT NULL NOT @@ -484,7 +484,7 @@ A B >>invoke t003t2_as; -- Definition of Trafodion table TRAFODION.SCH.T003T2_AS --- Definition current Sun Jul 10 06:37:53 2016 +-- Definition current Tue Jul 12 19:11:06 2016 ( A LARGEINT UNSIGNED NO DEFAULT NOT NULL NOT @@ -778,7 +778,7 @@ A B >>invoke t003t2; -- Definition of Trafodion table TRAFODION.SCH.T003T2 --- Definition current Sun Jul 10 06:38:21 2016 +-- Definition current Tue Jul 12 19:11:39 2016 ( A LARGEINT UNSIGNED NO DEFAULT NOT NULL NOT @@ -795,7 +795,7 @@ A B >>invoke t003t2_like; -- Definition of Trafodion table TRAFODION.SCH.T003T2_LIKE --- Definition current Sun Jul 10 06:38:25 2016 +-- Definition current Tue Jul 12 19:11:44 2016 ( A LARGEINT UNSIGNED NO DEFAULT NOT NULL NOT @@ -812,7 +812,7 @@ A B >>invoke t003t2_as; -- Definition of Trafodion table TRAFODION.SCH.T003T2_AS --- Definition current Sun Jul 10 06:38:28 2016 +-- Definition current Tue Jul 12 19:11:49 2016 ( A LARGEINT UNSIGNED NO DEFAULT NOT NULL NOT @@ -1109,7 +1109,7 @@ A B >>invoke t003t2; -- Definition of Trafodion table TRAFODION.SCH.T003T2 --- Definition current Sun Jul 10 06:38:55 2016 +-- Definition current Tue Jul 12 19:12:19 2016 ( A LARGEINT UNSIGNED NO DEFAULT NOT NULL NOT @@ -1126,7 +1126,7 @@ A B >>invoke t003t2_like; -- Definition of Trafodion table TRAFODION.SCH.T003T2_LIKE --- Definition current Sun Jul 10 06:38:59 2016 +-- Definition current Tue Jul 12 19:12:24 2016 ( A LARGEINT UNSIGNED NO DEFAULT NOT NULL NOT @@ -1143,7 +1143,7 @@ A B >>invoke t003t2_as; -- Definition of Trafodion table TRAFODION.SCH.T003T2_AS --- Definition current Sun Jul 10 06:39:03 2016 +-- Definition current Tue Jul 12 19:12:27 2016 ( A LARGEINT UNSIGNED NO DEFAULT NOT NULL NOT @@ -1430,7 +1430,7 @@ A B >>invoke t003t3; -- Definition of Trafodion table TRAFODION.SCH.T003T3 --- Definition current Sun Jul 10 06:39:10 2016 +-- Definition current Tue Jul 12 19:12:35 2016 ( A BOOLEAN NO DEFAULT NOT NULL NOT DROPPABLE @@ -1446,7 +1446,7 @@ A B >>invoke t003t3_like; -- Definition of Trafodion table TRAFODION.SCH.T003T3_LIKE --- Definition current Sun Jul 10 06:39:14 2016 +-- Definition current Tue Jul 12 19:12:40 2016 ( A BOOLEAN NO DEFAULT NOT NULL NOT DROPPABLE @@ -1462,7 +1462,7 @@ A B >>invoke t003t3_as; -- Definition of Trafodion table TRAFODION.SCH.T003T3_AS --- Definition current Sun Jul 10 06:39:18 2016 +-- Definition current Tue Jul 12 19:12:44 2016 ( A BOOLEAN NO DEFAULT NOT NULL NOT DROPPABLE @@ -1479,7 +1479,7 @@ A B >>invoke t003t3_salt; -- Definition of Trafodion table TRAFODION.SCH.T003T3_SALT --- Definition current Sun Jul 10 06:39:20 2016 +-- Definition current Tue Jul 12 19:12:47 2016 ( A BOOLEAN NO DEFAULT NOT NULL NOT DROPPABLE @@ -1795,7 +1795,7 @@ TRUE FALSE >> >>select cast(' truee' as boolean) from (values(1)) x(a); -*** ERROR[8426] The provided value, TRUEE, is an invalid BOOLEAN value. +*** ERROR[8426] The provided value, ' truee', is an invalid BOOLEAN value. --- 0 row(s) selected. >> @@ -1804,7 +1804,7 @@ TRUE FALSE --- SQL command prepared. >>execute s using 1, 2; -*** ERROR[8426] The provided value, 2, is an invalid BOOLEAN value. +*** ERROR[8426] The provided value, '2', is an invalid BOOLEAN value. *** ERROR[15015] PARAM ?(UNNAMED_2) (value 2) cannot be converted to type BOOLEAN. @@ -1823,7 +1823,7 @@ TRUE FALSE >>invoke hive.hive.tbool; -- Definition of hive table TBOOL --- Definition current Sun Jul 10 06:40:13 2016 +-- Definition current Tue Jul 12 19:13:43 2016 ( A BOOLEAN @@ -1880,7 +1880,7 @@ TRUE >>invoke t003t3; -- Definition of Trafodion table TRAFODION.SCH.T003T3 --- Definition current Sun Jul 10 06:40:19 2016 +-- Definition current Tue Jul 12 19:13:50 2016 ( A BOOLEAN NO DEFAULT NOT NULL NOT DROPPABLE @@ -1896,7 +1896,7 @@ TRUE >>invoke t003t3_like; -- Definition of Trafodion table TRAFODION.SCH.T003T3_LIKE --- Definition current Sun Jul 10 06:40:20 2016 +-- Definition current Tue Jul 12 19:13:52 2016 ( A BOOLEAN NO DEFAULT NOT NULL NOT DROPPABLE @@ -1912,7 +1912,7 @@ TRUE >>invoke t003t3_as; -- Definition of Trafodion table TRAFODION.SCH.T003T3_AS --- Definition current Sun Jul 10 06:40:22 2016 +-- Definition current Tue Jul 12 19:13:53 2016 ( A BOOLEAN NO DEFAULT NOT NULL NOT DROPPABLE @@ -1929,7 +1929,7 @@ TRUE >>invoke t003t3_salt; -- Definition of Trafodion table TRAFODION.SCH.T003T3_SALT --- Definition current Sun Jul 10 06:40:23 2016 +-- Definition current Tue Jul 12 19:13:55 2016 ( A BOOLEAN NO DEFAULT NOT NULL NOT DROPPABLE
