Examples of ILogicalExpression


Examples of edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression

            return false;
        }
        AssignOperator assign = (AssignOperator) op;

        Mutable<ILogicalExpression> mutableLogicalExpression = assign.getExpressions().get(0);
        ILogicalExpression logicalExpression = mutableLogicalExpression.getValue();
        if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            return false;
        }
        AbstractFunctionCallExpression functionCall = (AbstractFunctionCallExpression) logicalExpression;
        // TODO get the function through the function definition
        aggregateInfo = getAggregateFunction(functionCall);
View Full Code Here

Examples of edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression

        List<Mutable<ILogicalExpression>> aggregateSequenceArgs = new ArrayList<Mutable<ILogicalExpression>>();
        aggregateSequenceArgs.add(aggregateArgs);

        List<Mutable<ILogicalExpression>> exprs = new ArrayList<Mutable<ILogicalExpression>>();
        ILogicalExpression aggregateExp = new AggregateFunctionCallExpression(aggregateFunction, true,
                aggregateSequenceArgs);
        Mutable<ILogicalExpression> aggregateExpRef = new MutableObject<ILogicalExpression>(aggregateExp);
        exprs.add(aggregateExpRef);

        return new AggregateOperator(aggregateVariables, exprs);
View Full Code Here

Examples of edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression

        VariableReferenceExpression inputVre = new VariableReferenceExpression(inputVariable);

        List<Mutable<ILogicalExpression>> iterateArgs = new ArrayList<Mutable<ILogicalExpression>>();
        iterateArgs.add(new MutableObject<ILogicalExpression>(inputVre));

        ILogicalExpression unnestExp = new UnnestingFunctionCallExpression(BuiltinOperators.ITERATE, iterateArgs);
        Mutable<ILogicalExpression> unnestExpRef = new MutableObject<ILogicalExpression>(unnestExp);

        return new UnnestOperator(unnestVariable, unnestExpRef);
    }
View Full Code Here

Examples of edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression

            return false;
        }
        UnnestOperator unnest = (UnnestOperator) op;

        // Check to see if the expression is the iterate operator.
        ILogicalExpression logicalExpression = (ILogicalExpression) unnest.getExpressionRef().getValue();
        if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            return false;
        }
        AbstractFunctionCallExpression functionCall = (AbstractFunctionCallExpression) logicalExpression;
        if (!functionCall.getFunctionIdentifier().equals(BuiltinOperators.ITERATE.getFunctionIdentifier())) {
            return false;
        }

        AbstractLogicalOperator op2 = (AbstractLogicalOperator) unnest.getInputs().get(0).getValue();
        if (op2.getOperatorTag() != LogicalOperatorTag.SUBPLAN) {
            return false;
        }
        SubplanOperator subplan = (SubplanOperator) op2;

        AbstractLogicalOperator subplanOp = (AbstractLogicalOperator) subplan.getNestedPlans().get(0).getRoots().get(0)
                .getValue();
        if (subplanOp.getOperatorTag() != LogicalOperatorTag.AGGREGATE) {
            return false;
        }
        AggregateOperator aggregate = (AggregateOperator) subplanOp;

        // Check to see if the expression is a function and op:sequence.
        ILogicalExpression logicalExpression2 = (ILogicalExpression) aggregate.getExpressions().get(0).getValue();
        if (logicalExpression2.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            return false;
        }
        AbstractFunctionCallExpression functionCall2 = (AbstractFunctionCallExpression) logicalExpression2;
        if (!functionCall2.getFunctionIdentifier().equals(BuiltinOperators.SEQUENCE.getFunctionIdentifier())) {
            return false;
View Full Code Here

Examples of edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression

        Mutable<ILogicalExpression> unnestVariableRef = new MutableObject<ILogicalExpression>(
                new VariableReferenceExpression(unnestVariable));
        aggregateSequenceArgs.add(unnestVariableRef);
       
        List<Mutable<ILogicalExpression>> exprs = new ArrayList<Mutable<ILogicalExpression>>();
        ILogicalExpression aggregateExp = new AggregateFunctionCallExpression(BuiltinOperators.SEQUENCE, false,
                aggregateSequenceArgs);
        Mutable<ILogicalExpression> aggregateExpRef = new MutableObject<ILogicalExpression>(aggregateExp);
        exprs.add(aggregateExpRef);

        return new AggregateOperator(aggregateVariables, exprs);
View Full Code Here

Examples of edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression

        VariableReferenceExpression inputVre = new VariableReferenceExpression(inputVariable);

        List<Mutable<ILogicalExpression>> iterateArgs = new ArrayList<Mutable<ILogicalExpression>>();
        iterateArgs.add(new MutableObject<ILogicalExpression>(inputVre));

        ILogicalExpression unnestExp = new UnnestingFunctionCallExpression(BuiltinOperators.ITERATE, iterateArgs);
        Mutable<ILogicalExpression> unnestExpRef = new MutableObject<ILogicalExpression>(unnestExp);

        return new UnnestOperator(unnestVariable, unnestExpRef);
    }
View Full Code Here

Examples of edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression

            return false;
        }
        AggregateOperator aggregate = (AggregateOperator) op;

        Mutable<ILogicalExpression> mutableLogicalExpression = aggregate.getExpressions().get(0);
        ILogicalExpression logicalExpression = mutableLogicalExpression.getValue();
        if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            return false;
        }
        AbstractFunctionCallExpression functionCall = (AbstractFunctionCallExpression) logicalExpression;

        if (AGGREGATE_MAP.containsKey(functionCall.getFunctionIdentifier())) {
View Full Code Here

Examples of edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression

            return false;
        }
        AggregateOperator aggregate = (AggregateOperator) subplanOp1;

        // Check to see if the expression is a function and op:sequence.
        ILogicalExpression logicalExpression1 = (ILogicalExpression) aggregate.getExpressions().get(0).getValue();
        if (logicalExpression1.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            return false;
        }
        AbstractFunctionCallExpression functionCall1 = (AbstractFunctionCallExpression) logicalExpression1;
        if (!functionCall1.getFunctionIdentifier().equals(BuiltinOperators.SEQUENCE.getFunctionIdentifier())) {
            return false;
        }

        Mutable<ILogicalExpression> lvm1 = ExpressionToolbox.findVariableExpression(aggregate.getExpressions().get(0));
        if (lvm1 == null) {
            return false;
        }
        VariableReferenceExpression vre1 = (VariableReferenceExpression) lvm1.getValue();

        // UNNEST($v1, iterate($v0) )
        AbstractLogicalOperator subplanOp2 = (AbstractLogicalOperator) subplanOp1.getInputs().get(0).getValue();
        if (subplanOp2.getOperatorTag() != LogicalOperatorTag.UNNEST) {
            return false;
        }
        UnnestOperator subplanUnnest = (UnnestOperator) subplanOp2;

        // Check to see if the expression is the iterate operator.
        ILogicalExpression logicalExpression2 = (ILogicalExpression) subplanUnnest.getExpressionRef().getValue();
        if (logicalExpression2.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            return false;
        }
        AbstractFunctionCallExpression functionCall2 = (AbstractFunctionCallExpression) logicalExpression2;
        if (!functionCall2.getFunctionIdentifier().equals(BuiltinOperators.ITERATE.getFunctionIdentifier())) {
            return false;
        }

        if (subplanUnnest.getVariable() != vre1.getVariableReference()) {
            return false;
        }
        Mutable<ILogicalExpression> lvm2 = ExpressionToolbox.findVariableExpression(subplanUnnest.getExpressionRef());
        if (lvm2 == null) {
            return false;
        }
        VariableReferenceExpression vre2 = (VariableReferenceExpression) lvm2.getValue();

        // NESTEDTUPLESOURCE
        AbstractLogicalOperator subplanOp3 = (AbstractLogicalOperator) subplanOp2.getInputs().get(0).getValue();
        if (subplanOp3.getOperatorTag() != LogicalOperatorTag.NESTEDTUPLESOURCE) {
            return false;
        }

        // Ensure input is from a UNNEST operator.
        AbstractLogicalOperator subplanInput = (AbstractLogicalOperator) subplan.getInputs().get(0).getValue();
        if (subplanInput.getOperatorTag() != LogicalOperatorTag.ASSIGN) {
            return false;
        }
        AssignOperator assign = (AssignOperator) subplanInput;
        if (!assign.getVariables().contains(vre2.getVariableReference())) {
            return false;
        }

        // Check to see if the expression is the iterate operator.
        ILogicalExpression logicalExpression3 = (ILogicalExpression) assign.getExpressions().get(0).getValue();
        if (logicalExpression3.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            return false;
        }
        AbstractFunctionCallExpression functionCall3 = (AbstractFunctionCallExpression) logicalExpression3;
        if (!functionCall3.getFunctionIdentifier().equals(BuiltinOperators.TREAT.getFunctionIdentifier())) {
            return false;
        }

        // Find the treat type.
        ILogicalExpression argType = functionCall3.getArguments().get(ARG_TYPE).getValue();
        if (argType.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
            return false;
        }
        TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
        ExpressionToolbox.getConstantAsPointable((ConstantExpression) argType, tvp);
View Full Code Here

Examples of edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression

            return false;
        }
        AssignOperator assignTreat = (AssignOperator) op;

        // Check to see if the expression is a function and treat.
        ILogicalExpression logicalExpression11 = (ILogicalExpression) assignTreat.getExpressions().get(0).getValue();
        if (logicalExpression11.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            return false;
        }
        AbstractFunctionCallExpression functionTreat = (AbstractFunctionCallExpression) logicalExpression11;
        if (!functionTreat.getFunctionIdentifier().equals(BuiltinOperators.TREAT.getFunctionIdentifier())) {
            return false;
        }

        // Find the variable id used as the parameter.
        ILogicalExpression treatArg1 = (ILogicalExpression) functionTreat.getArguments().get(0).getValue();
        if (treatArg1.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
            return false;
        }
        VariableReferenceExpression variableExpression = (VariableReferenceExpression) treatArg1;
        int variableId = variableExpression.getVariableReference().getId();

        // Get type to check against constant.
        ILogicalExpression treatArg2 = (ILogicalExpression) functionTreat.getArguments().get(1).getValue();
        if (treatArg2.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
            return false;
        }
        TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
        getConstantAsPointable((ConstantExpression) treatArg2, tvp);

        IntegerPointable pTypeCode = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
        tvp.getValue(pTypeCode);
        SequenceType sType = dCtx.lookupSequenceType(pTypeCode.getInteger());

        AbstractLogicalOperator op2 = (AbstractLogicalOperator) assignTreat.getInputs().get(0).getValue();
        if (op2.getOperatorTag() != LogicalOperatorTag.ASSIGN) {
            return false;
        }
        AssignOperator assignConstant = (AssignOperator) op2;

        if (variableId == assignConstant.getVariables().get(0).getId()) {
            ILogicalExpression expressionConstant = (ILogicalExpression) assignConstant.getExpressions().get(0)
                    .getValue();
            if (expressionConstant.getExpressionTag() == LogicalExpressionTag.CONSTANT) {
                // Check constant against type supplied.
                TaggedValuePointable tvp2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
                getConstantAsPointable((ConstantExpression) expressionConstant, tvp2);

                SequenceTypeMatcher stm = new SequenceTypeMatcher();
View Full Code Here

Examples of edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression

        if (op.getOperatorTag() != LogicalOperatorTag.INNERJOIN) {
            return false;
        }
        AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op;

        ILogicalExpression expr = join.getCondition().getValue();
        if (expr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
            return false;
        }
        AbstractFunctionCallExpression fexp = (AbstractFunctionCallExpression) expr;
        FunctionIdentifier fi = fexp.getFunctionIdentifier();
        if (!(fi.equals(AlgebricksBuiltinFunctions.AND) || fi.equals(AlgebricksBuiltinFunctions.EQ))) {
            return false;
        }
        boolean modified = false;
        List<Mutable<ILogicalExpression>> functionList = new ArrayList<Mutable<ILogicalExpression>>();
        List<Mutable<ILogicalExpression>> variableList = new ArrayList<Mutable<ILogicalExpression>>();
        functionList.clear();
        ExpressionToolbox.findAllFunctionExpressions(join.getCondition(), AlgebricksBuiltinFunctions.EQ, functionList);
        Collection<LogicalVariable> producedVariables = new ArrayList<LogicalVariable>();
        for (Mutable<ILogicalExpression> searchM : functionList) {
            ILogicalExpression search = searchM.getValue();
            if (search.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
                continue;
            }
            AbstractFunctionCallExpression searchExp = (AbstractFunctionCallExpression) search;
            // Go through all argument for EQ.
            for (Mutable<ILogicalExpression> expressionM : searchExp.getArguments()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.