You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by sa...@apache.org on 2017/02/14 07:44:22 UTC
[09/10] incubator-trafodion git commit: Further review fixes. Adde
dtests to detect vsbb plans for upserts with more than one row.
Further review fixes. Adde dtests to detect vsbb plans for upserts with more than one row.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/95fe295d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/95fe295d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/95fe295d
Branch: refs/heads/master
Commit: 95fe295dd104c7ef832e467817d0bf79bcfa2762
Parents: e886d92
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Tue Feb 14 00:38:22 2017 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Tue Feb 14 00:38:22 2017 +0000
----------------------------------------------------------------------
core/sql/optimizer/BindRelExpr.cpp | 8 ++--
core/sql/regress/executor/EXPECTED015.SB | 65 ++++++++++++++++++++++++++-
core/sql/regress/executor/TEST015 | 20 ++++++++-
3 files changed, 87 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/95fe295d/core/sql/optimizer/BindRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp
index 47ee1e5..d6ffa76 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -10612,10 +10612,10 @@ NABoolean Insert::isUpsertThatNeedsTransformation(NABoolean isAlignedRowFormat,
//even try the transform
NABoolean mustTryTransform = FALSE;
if (isUpsert() &&
- ( NOT getIsTrafLoadPrep()) &&
- (NOT (getTableDesc()->isIdentityColumnGeneratedAlways() &&
- getTableDesc()->hasIdentityColumnInClusteringKey())) &&
- (NOT(getTableDesc()->getClusteringIndex()->getNAFileSet()->hasSyskey())))
+ NOT ( getIsTrafLoadPrep() ||
+ ( (getTableDesc()->isIdentityColumnGeneratedAlways() &&
+ getTableDesc()->hasIdentityColumnInClusteringKey())) ||
+ ((getTableDesc()->getClusteringIndex()->getNAFileSet()->hasSyskey()))))
{
mustTryTransform = TRUE;
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/95fe295d/core/sql/regress/executor/EXPECTED015.SB
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/EXPECTED015.SB b/core/sql/regress/executor/EXPECTED015.SB
index a808f51..9da486e 100755
--- a/core/sql/regress/executor/EXPECTED015.SB
+++ b/core/sql/regress/executor/EXPECTED015.SB
@@ -189,6 +189,13 @@
--- SQL command prepared.
>>
>>
+>>prepare explainItVsbb from
++>select substring(operator,1,25) operator
++>from table (explain(NULL,'XX2')) t
++>where operator LIKE '%SEQUENCE%' OR operator LIKE '%VSBB_UPSERT%' OR operator LIKE '%VSBB_DELETE%' ;
+
+--- SQL command prepared.
+>>
>>
>>insert into t015t1 values (1,1), (2,2);
@@ -2152,9 +2159,65 @@ A B C D E
--- 3 row(s) selected.
>>
+>>
+>>--For single row param input, ensure plan has no vsbb operators
+>>prepare xx2 from upsert into t015t16 values(?,?,?,?,?);
+
+--- SQL command prepared.
+>>execute explainItVsbb;
+
+OPERATOR
+-------------------------
+
+SEQUENCE
+
+--- 1 row(s) selected.
+>>--For multiple rows, ensure plan has vsbb upsert, vsbb delete
+>>prepare xx2 from upsert into t015t16 values(?[10],?[10],?[10],?[10],?[10]);
+
+--- SQL command prepared.
+>>execute explainItVsbb;
+
+OPERATOR
+-------------------------
+
+SEQUENCE
+TRAFODION_VSBB_UPSERT
+TRAFODION_VSBB_DELETE
+TRAFODION_VSBB_DELETE
+
+--- 4 row(s) selected.
+>>--For upsert-select, ensure plan has vsbb_upsert and vsbb delete
+>>prepare xx2 from UPSERT INTO t015t16 select a,b,c,d,e from t015t6 ;
+
+--- SQL command prepared.
+>>execute explainItVsbb;
+
+OPERATOR
+-------------------------
+
+SEQUENCE
+TRAFODION_VSBB_UPSERT
+TRAFODION_VSBB_DELETE
+TRAFODION_VSBB_DELETE
+
+--- 4 row(s) selected.
+>>
+>>--For multiple values , ensure plan has vsbb upsert and vsbb delete
>>prepare xx2 from upsert into t015t16 values (3,4,1,1,1),(6,7,80,90,100),(6,7,81,91,101);
--- SQL command prepared.
+>>execute explainItVsbb;
+
+OPERATOR
+-------------------------
+
+SEQUENCE
+TRAFODION_VSBB_UPSERT
+TRAFODION_VSBB_DELETE
+TRAFODION_VSBB_DELETE
+
+--- 4 row(s) selected.
>>execute xx2;
--- 2 row(s) inserted.
@@ -2170,7 +2233,7 @@ A B
--- 4 row(s) selected.
>>
->>cqd traf_upsert_to_eff_tree 'OFF';
+>>cqd traf_upsert_to_eff_tree reset;
--- SQL operation complete.
>>log;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/95fe295d/core/sql/regress/executor/TEST015
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/TEST015 b/core/sql/regress/executor/TEST015
index e126cb8..734d8f8 100755
--- a/core/sql/regress/executor/TEST015
+++ b/core/sql/regress/executor/TEST015
@@ -277,6 +277,11 @@ from table (explain(NULL,'XX')) t
where operator LIKE '%SEQUENCE%' ;
+prepare explainItVsbb from
+select substring(operator,1,25) operator
+from table (explain(NULL,'XX2')) t
+where operator LIKE '%SEQUENCE%' OR operator LIKE '%VSBB_UPSERT%' OR operator LIKE '%VSBB_DELETE%' ;
+
insert into t015t1 values (1,1), (2,2);
insert into t015t3 values (1,1,1), (2,2,2), (3,3,3);
@@ -926,10 +931,23 @@ prepare xx2 from upsert into t015t16 values (1,2,30,40,50);
execute xx2;
select * from t015t16 order by a;
+
+--For single row param input, ensure plan has no vsbb operators
+prepare xx2 from upsert into t015t16 values(?,?,?,?,?);
+execute explainItVsbb;
+--For multiple rows, ensure plan has vsbb upsert, vsbb delete
+prepare xx2 from upsert into t015t16 values(?[10],?[10],?[10],?[10],?[10]);
+execute explainItVsbb;
+--For upsert-select, ensure plan has vsbb_upsert and vsbb delete
+prepare xx2 from UPSERT INTO t015t16 select a,b,c,d,e from t015t6 ;
+execute explainItVsbb;
+
+--For multiple values , ensure plan has vsbb upsert and vsbb delete
prepare xx2 from upsert into t015t16 values (3,4,1,1,1),(6,7,80,90,100),(6,7,81,91,101);
+execute explainItVsbb;
execute xx2;
select a,b from t015t16 order by a;
-cqd traf_upsert_to_eff_tree 'OFF';
+cqd traf_upsert_to_eff_tree reset;
log;