You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2017/03/29 22:48:58 UTC
[1/2] incubator-trafodion git commit: [TRAFODION-2559] Fix bug in
RIGHT function
Repository: incubator-trafodion
Updated Branches:
refs/heads/master 3f75c15a6 -> 8691d783d
[TRAFODION-2559] Fix bug in RIGHT function
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/34fdb71b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/34fdb71b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/34fdb71b
Branch: refs/heads/master
Commit: 34fdb71b5d51836c94770f5a8da7f7f97e00ef96
Parents: 4716b3a
Author: Dave Birdsall <db...@apache.org>
Authored: Wed Mar 29 16:26:31 2017 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Wed Mar 29 16:26:31 2017 +0000
----------------------------------------------------------------------
core/sql/optimizer/BindItemExpr.cpp | 7 ++++++-
core/sql/regress/core/FILTERRTS | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/34fdb71b/core/sql/optimizer/BindItemExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindItemExpr.cpp b/core/sql/optimizer/BindItemExpr.cpp
index 91e1325..1dedc94 100644
--- a/core/sql/optimizer/BindItemExpr.cpp
+++ b/core/sql/optimizer/BindItemExpr.cpp
@@ -11295,7 +11295,12 @@ ItemExpr *ZZZBinderFunction::bindNode(BindWA *bindWA)
}
if ( getOperatorType() == ITM_RIGHT )
- strcpy(buf, "SUBSTRING(@A1 FROM (CHAR_LENGTH(@A1) - CAST(@A2 AS INT UNSIGNED) + 1));");
+ // The case expression is needed for cases where the length supplied
+ // exceeds the length of the string; in this case we want to return
+ // the whole string. SUBSTR of a 0 or negative value doesn't do that.
+ strcpy(buf, "SUBSTRING(@A1 FROM "
+ "CASE WHEN(CHAR_LENGTH(@A1) - CAST(@A2 AS INT UNSIGNED) + 1) > 1 "
+ "THEN (CHAR_LENGTH(@A1) - CAST(@A2 AS INT UNSIGNED) + 1) ELSE 1 END);");
else
strcpy(buf, "SUBSTRING(@A1 FROM 1 FOR @A2);"); // LEFT()
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/34fdb71b/core/sql/regress/core/FILTERRTS
----------------------------------------------------------------------
diff --git a/core/sql/regress/core/FILTERRTS b/core/sql/regress/core/FILTERRTS
index ea88a79..69fe492 100755
--- a/core/sql/regress/core/FILTERRTS
+++ b/core/sql/regress/core/FILTERRTS
@@ -43,6 +43,7 @@ s/SQL Space Allocated[ ]*[0-9,]*[ ]*/SQL Space Allocated @SQLSpaceAllocated@/
s/SQL Space Used[ ]*[0-9,]*[ ]*/SQL Space Used @SQLSpaceUsed@/
s/SQL Heap Allocated[ ]*[0-9,]*[ ]*/SQL Heap Allocated @SQLHeapAllocated@/
s/SQL Heap Used[ ]*[0-9,]*[ ]*/SQL Heap Used @SQLHeapUsed@/
+s/SQL Heap WM[ ]*[0-9,]*[ ]*/SQL Heap WM @SQLHeapWM@/
s/Process Create Time[ ]*[0-9,]*/Process Create Time @ProcessCreateTime@/
s/Processes Created[ ]*[0-9,]*/Processes Created @ProcessesCreated@/
s/Opens[ ]*[0-9,]*/Opens @Opens@/
[2/2] incubator-trafodion git commit: Merge [TRAFODION-2559] PR 1032
Fix bug in RIGHT function
Posted by db...@apache.org.
Merge [TRAFODION-2559] PR 1032 Fix bug in RIGHT function
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/8691d783
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/8691d783
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/8691d783
Branch: refs/heads/master
Commit: 8691d783d5d2feb9ade2bee2c60669255f53f0bb
Parents: 3f75c15 34fdb71
Author: Dave Birdsall <db...@apache.org>
Authored: Wed Mar 29 22:48:03 2017 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Wed Mar 29 22:48:03 2017 +0000
----------------------------------------------------------------------
core/sql/optimizer/BindItemExpr.cpp | 7 ++++++-
core/sql/regress/core/FILTERRTS | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------