You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by su...@apache.org on 2015/10/08 06:05:40 UTC
[5/6] incubator-trafodion git commit: Reworks addressing review
comments
Reworks addressing 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/cefbb9b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/cefbb9b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/cefbb9b4
Branch: refs/heads/master
Commit: cefbb9b4dbce7124c5d2922f521baeec72c0bdbc
Parents: aa0994e
Author: Dave Birdsall <db...@apache.org>
Authored: Tue Oct 6 23:43:51 2015 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Tue Oct 6 23:43:51 2015 +0000
----------------------------------------------------------------------
core/sql/optimizer/BindRelExpr.cpp | 1 +
core/sql/optimizer/CostMethod.h | 1 -
core/sql/optimizer/OptPhysRelExpr.cpp | 8 ++++++--
core/sql/optimizer/ScmCostMethod.cpp | 28 +++++++++++++++-------------
4 files changed, 22 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/cefbb9b4/core/sql/optimizer/BindRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp
index 6e7b2cc..5e15d02 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -11050,6 +11050,7 @@ RelExpr *MergeDelete::bindNode(BindWA *bindWA)
{
// MERGE DELETE + INSERT is buggy, so disallow it unless CQD is on. In
// particular, the optimizer sometimes fails to produce a plan in phase 1.
+ // JIRA TRAFODION-1509 covers completing the MERGE DELETE + INSERT feature.
*CmpCommon::diags() << DgSqlCode(-3241)
<< DgString0(" MERGE DELETE not allowed with INSERT.");
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/cefbb9b4/core/sql/optimizer/CostMethod.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/CostMethod.h b/core/sql/optimizer/CostMethod.h
index d7568a2..737fee7 100644
--- a/core/sql/optimizer/CostMethod.h
+++ b/core/sql/optimizer/CostMethod.h
@@ -2061,7 +2061,6 @@ protected:
const PlanWorkSpace* pws,
Lng32& countOfStreams) = 0;
- // Common functions to cost Hbase operations.
NABoolean allKeyColumnsHaveHistogramStatistics(
const IndexDescHistograms & histograms,
const IndexDesc * CIDesc
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/cefbb9b4/core/sql/optimizer/OptPhysRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/OptPhysRelExpr.cpp b/core/sql/optimizer/OptPhysRelExpr.cpp
index 93b2e03..fc256c6 100644
--- a/core/sql/optimizer/OptPhysRelExpr.cpp
+++ b/core/sql/optimizer/OptPhysRelExpr.cpp
@@ -16550,7 +16550,9 @@ CostMethod *
HbaseDelete::costMethod() const
{
if (CmpCommon::getDefault(HBASE_DELETE_COSTING) == DF_OFF)
- return RelExpr::costMethod(); // returns cost 1 cost object
+ // RelExpr::costMethod() costin returns a cost 1 cost object. This
+ // is the old behavior before the new costing code was written.
+ return RelExpr::costMethod();
static THREAD_P CostMethodHbaseDelete *m = NULL;
if (m == NULL)
@@ -16596,7 +16598,9 @@ CostMethod *
HbaseUpdate::costMethod() const
{
if (CmpCommon::getDefault(HBASE_UPDATE_COSTING) == DF_OFF)
- return RelExpr::costMethod(); // returns cost 1 cost object
+ // RelExpr::costMethod() costing returns a cost 1 cost object. This
+ // is the old behavior before the new costing code was written.
+ return RelExpr::costMethod();
static THREAD_P CostMethodHbaseUpdate *m = NULL;
if (m == NULL)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/cefbb9b4/core/sql/optimizer/ScmCostMethod.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ScmCostMethod.cpp b/core/sql/optimizer/ScmCostMethod.cpp
index c5d19d2..5da4785 100644
--- a/core/sql/optimizer/ScmCostMethod.cpp
+++ b/core/sql/optimizer/ScmCostMethod.cpp
@@ -3728,7 +3728,12 @@ CostMethodHbaseUpdateOrDelete::numRowsToScanWhenAllKeyColumnsHaveHistograms(
CMPASSERT(NOT histograms.isEmpty());
- if ( thereAreSingleSubsetPreds )
+ // Apply those key predicates that reference key columns
+ // before the first missing key to the histograms:
+ const SelectivityHint * selHint = CIDesc->getPrimaryTableDesc()->getSelectivityHint();
+ const CardinalityHint * cardHint = CIDesc->getPrimaryTableDesc()->getCardinalityHint();
+
+ if ( thereAreSingleSubsetPreds || selHint || cardHint )
{
// ---------------------------------------------------------
// There are some key predicates, so apply them
@@ -3736,23 +3741,16 @@ CostMethodHbaseUpdateOrDelete::numRowsToScanWhenAllKeyColumnsHaveHistograms(
// ---------------------------------------------------------
// Get all the key preds for the key columns up to the first
- // key column with no key preds
+ // key column with no key preds (if any)
ValueIdSet singleSubsetPrefixPredicates;
- NABoolean conflict = FALSE;
for ( CollIndex i = 0; i <= singleSubsetPrefixOrder; i++ )
{
-
const ValueIdSet *predsPtr = keyPredsByCol[i];
CMPASSERT( predsPtr != NULL ); // it must contain preds
singleSubsetPrefixPredicates.insert( *predsPtr );
} // for every key col in the sing. subset prefix
- // Apply those key predicates that reference key columns
- // before the first missing key to the histograms:
- const SelectivityHint * selHint = CIDesc->getPrimaryTableDesc()->getSelectivityHint();
- const CardinalityHint * cardHint = CIDesc->getPrimaryTableDesc()->getCardinalityHint();
-
RelExpr * dummyExpr = new (STMTHEAP) RelExpr(ITM_FIRST_ITEM_OP,
NULL,
NULL,
@@ -3784,7 +3782,6 @@ void CostMethodHbaseUpdateOrDelete::computeIOCostsForCursorOperation(
NABoolean probesInOrder
) const
{
- const CostScalar indexLevels = CIDesc->getIndexLevels();
const CostScalar & kbPerBlock = CIDesc->getBlockSizeInKb();
const CostScalar rowsPerBlock =
((kbPerBlock * csOneKiloBytes) /
@@ -4079,6 +4076,11 @@ CostMethodHbaseDelete::scmComputeOperatorCostInternal(RelExpr* op,
activePartitions,
CIDesc
);
+ if (numRowsToScan < numRowsToDelete) // sanity test
+ {
+ // we will scan at least as many rows as we delete
+ numRowsToScan = numRowsToDelete;
+ }
}
}
@@ -4145,9 +4147,9 @@ CostMethodHbaseDelete::scmComputeOperatorCostInternal(RelExpr* op,
CostScalar outputRowSize = delOp->getGroupAttr()->getRecordLength();
CostScalar outputRowSizeFactor = scmRowSizeFactor(outputRowSize);
- tuplesProcessed = tuplesProcessed * rowSizeFactor;
- tuplesSent = tuplesSent * rowSizeFactor;
- tuplesProduced = tuplesProduced * outputRowSizeFactor;
+ tuplesProcessed *= rowSizeFactor;
+ tuplesSent *= rowSizeFactor;
+ tuplesProduced *= outputRowSizeFactor;
// ---------------------------------------------------------------------