You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by hz...@apache.org on 2015/12/11 00:23:16 UTC
[6/7] incubator-trafodion git commit: Rework for pull request 218
Rework for pull request 218
Fixed computation of ports for install_local_hadoop -p rand
Fixed conversion of VEGRef to base or index column when getting
ready to eliminate a column from a required order.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/59ce2b79
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/59ce2b79
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/59ce2b79
Branch: refs/heads/master
Commit: 59ce2b79cd652e43f71183859df53077050c4c2a
Parents: a347719
Author: Hans Zeller <hz...@apache.org>
Authored: Thu Dec 10 00:29:27 2015 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Thu Dec 10 00:29:27 2015 +0000
----------------------------------------------------------------------
core/sqf/sql/scripts/install_local_hadoop | 2 +-
core/sql/optimizer/GroupAttr.cpp | 36 ++++++++++++++++++++++----
2 files changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59ce2b79/core/sqf/sql/scripts/install_local_hadoop
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/install_local_hadoop b/core/sqf/sql/scripts/install_local_hadoop
index 951f417..732c17d 100755
--- a/core/sqf/sql/scripts/install_local_hadoop
+++ b/core/sqf/sql/scripts/install_local_hadoop
@@ -391,7 +391,7 @@ else
MY_START_PORT=`expr 24000 + $MY_START_PORT '*' 200`
elif [ $MY_START_PORT == "rand" ]; then
# pick a random number between 12000 and 24000 that is divisible by 200
- MY_START_PORT=`expr $RANDOM '%' 50 '*' 200 + 12000`
+ MY_START_PORT=`expr $RANDOM '%' 60 '*' 200 + 12000`
fi
echo "# Using non-standard port range from MY_START_PORT env var: $MY_START_PORT..."
fi
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/59ce2b79/core/sql/optimizer/GroupAttr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/GroupAttr.cpp b/core/sql/optimizer/GroupAttr.cpp
index d027745..5df31c3 100644
--- a/core/sql/optimizer/GroupAttr.cpp
+++ b/core/sql/optimizer/GroupAttr.cpp
@@ -343,6 +343,13 @@ void GroupAttributes::addConstraint(ItemExpr *c)
const ValueIdSet &occPreds =
((CheckOptConstraint *) occ.getItemExpr())->getCheckPreds();
+ // Note that the check for inclusion of value ids of
+ // the predicates is not very useful. A more useful
+ // check would be whether the existing predicates
+ // imply the new ones or vice versa, but that would be
+ // much more complicated code and is not required at
+ // this point.
+
if (occPreds.contains(cc->getCheckPreds()))
{
// this is no news, delete this useless new constraint
@@ -684,18 +691,37 @@ NABoolean GroupAttributes::tryToEliminateOrderColumnBasedOnEqualsPred(
if (col.getItemExpr()->getOperatorType() == ITM_INVERSE)
col = col.getItemExpr()->child(0).getValueId();
- // convert col from a VEGRef to a base column, if needed,
- // the ScanKey method below wants a real column as input
+ // Convert col from a VEGRef to a base column, if needed,
+ // the ScanKey method below wants a real column as input.
+ // Make sure to pick the base column that is actually
+ // referenced in the check predicates, in case there are
+ // multiple base columns in the VEG.
if (col.getItemExpr()->getOperatorType() == ITM_VEG_REFERENCE)
{
const ValueIdSet &vegMembers =
static_cast<VEGReference *>(col.getItemExpr())->
getVEG()->getAllValues();
+ ValueId dummy;
+
for (ValueId b=vegMembers.init();
vegMembers.next(b);
vegMembers.advance(b))
- if (b.getItemExpr()->getOperatorType() == ITM_BASECOLUMN)
- col = b;
+ if (checkPreds.referencesTheGivenValue(b, dummy))
+ {
+ // Use this column for comparison. Note that
+ // we can have a situation with a VEG(T1.a, T2.b)
+ // and a check predicate T1.a = const. The (computed)
+ // check predicate got added later, so "const" is
+ // not a VEG member. This should not cause trouble,
+ // however, since an operator must ensure that
+ // a) the VEG members it produces are equal (it needs to
+ // make sure the comparison pred is evaluated), and
+ // b) that the predicate applies.
+ // So, we cannot have the situation where T1.a=const
+ // and T2.b != const in the output of this operator.
+ col = b;
+ break;
+ }
}
for (ValueId p = checkPreds.init();
@@ -727,7 +753,7 @@ NABoolean GroupAttributes::tryToEliminateOrderColumnBasedOnEqualsPred(
ValueIdSet(p)));
}
}
- }
+ } // predicates or check constraints are supplied
return result;
}