use of org.apache.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions.ComparisonKind in project asterixdb by apache.
the class IntroduceLSMComponentFilterRule method createAssignOperator.
private AssignOperator createAssignOperator(List<IOptimizableFuncExpr> optFuncExprs, List<LogicalVariable> minFilterVars, List<LogicalVariable> maxFilterVars, IOptimizationContext context) {
List<LogicalVariable> assignKeyVarList = new ArrayList<>();
List<Mutable<ILogicalExpression>> assignKeyExprList = new ArrayList<>();
for (IOptimizableFuncExpr optFuncExpr : optFuncExprs) {
ComparisonKind ck = AlgebricksBuiltinFunctions.getComparisonType(optFuncExpr.getFuncExpr().getFunctionIdentifier());
ILogicalExpression searchKeyExpr = optFuncExpr.getConstantExpr(0);
LogicalVariable var = context.newVar();
assignKeyExprList.add(new MutableObject<>(searchKeyExpr));
assignKeyVarList.add(var);
if (ck == ComparisonKind.GE || ck == ComparisonKind.GT) {
minFilterVars.add(var);
} else if (ck == ComparisonKind.LE || ck == ComparisonKind.LT) {
maxFilterVars.add(var);
} else if (ck == ComparisonKind.EQ) {
minFilterVars.add(var);
maxFilterVars.add(var);
}
}
return new AssignOperator(assignKeyVarList, assignKeyExprList);
}
use of org.apache.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions.ComparisonKind in project asterixdb by apache.
the class BTreeAccessMethod method getLimitType.
private LimitType getLimitType(IOptimizableFuncExpr optFuncExpr, OptimizableOperatorSubTree probeSubTree) {
ComparisonKind ck = AlgebricksBuiltinFunctions.getComparisonType(optFuncExpr.getFuncExpr().getFunctionIdentifier());
LimitType limit = null;
switch(ck) {
case EQ:
{
limit = LimitType.EQUAL;
break;
}
case GE:
{
limit = probeIsOnLhs(optFuncExpr, probeSubTree) ? LimitType.HIGH_INCLUSIVE : LimitType.LOW_INCLUSIVE;
break;
}
case GT:
{
limit = probeIsOnLhs(optFuncExpr, probeSubTree) ? LimitType.HIGH_EXCLUSIVE : LimitType.LOW_EXCLUSIVE;
break;
}
case LE:
{
limit = probeIsOnLhs(optFuncExpr, probeSubTree) ? LimitType.LOW_INCLUSIVE : LimitType.HIGH_INCLUSIVE;
break;
}
case LT:
{
limit = probeIsOnLhs(optFuncExpr, probeSubTree) ? LimitType.LOW_EXCLUSIVE : LimitType.HIGH_EXCLUSIVE;
break;
}
case NEQ:
{
limit = null;
break;
}
default:
{
throw new IllegalStateException();
}
}
return limit;
}
Aggregations