Github user sureshsubbiah commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/1051#discussion_r110811550
--- Diff: core/sql/optimizer/RelExpr.cpp ---
@@ -9062,42 +9055,19 @@ void Scan::setTableAttributes(CANodeId nodeId)
setBaseCardinality(MIN_ONE (tableDesc->getNATable()->getEstRowCount())) ;
}
-NABoolean Scan::equalityPredOnCol(ItemExpr *col)
-{
- //
- // Returns TRUE if the column (col) has an equality predicate
- // associated with it the scan's predicate list.
- //
- ValueIdSet pred = getSelectionPredicates();
-
- for (ValueId vid=pred.init(); pred.next(vid); pred.advance(vid))
- {
- if ( vid.getItemExpr()->getOperatorType() != ITM_VEG_PREDICATE )
- continue;
-
- ItemExpr *expr = vid.getItemExpr();
- ValueId id;
- VEG *veg = ((VEGPredicate*)expr)->getVEG();
-
- if (veg->getAllValues().referencesTheGivenValue(col->getValueId(), id))
- return TRUE;
- }
-
- return FALSE;
-
-} // Scan::equalityPredOnCol
-
NABoolean Scan::updateableIndex(IndexDesc *idx)
{
//
- // Returns TRUE if the index (idx) can be used for a scan during an
UPDATE.
- // Otherwise, returns FALSE to prevent the "Halloween Update Problem".
+ // Returns TRUE if the index (idx) can be used for a scan during
+ // an UPDATE. Halloween problem is protected with a sort using
+ // Scan::requiresHalloweenForUpdateUsingIndexScan().
+ // Returns FALSE only for certain embedded updates now.
--- End diff --
I did not quite understand the comment. This may be a repetition of the
responses below. I will state my reasoning and then we can determine if it is
reasonable.
1) With a blocking sort any index can be used to drive the scan of an
update. Columns of unique index and keys of clustering index will not get here
since they would have been changed to a delete + insert already.
2) IsUpdateable Index method is not needed anymore, but it has some logic
about embeddedUpdate that I did not want to move. SoI kept the
isUpdateableIndex method but it now has only the embeddedUpdate check.
3) IsUpdateableIndex used to return FALSE for non-equalityPreds, that logic
has been moved to the new method. Here FALSE means we need a blocking sort. We
go through all indexes, if any needs a blocking sort, then we flag the update
as needing the sort.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---