Package edu.uci.ics.hyracks.algebricks.core.algebra.expressions

Examples of edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression


        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();
View Full Code Here


        // 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;
View Full Code Here

                    getProducedVariablesInDescendantsAndSelf(branch.getValue(), producedVariables);
                    variableList.clear();
                    ExpressionToolbox.findVariableExpressions(expressionM, variableList);
                    boolean found = true;
                    for (Mutable<ILogicalExpression> searchVariableM : variableList) {
                        VariableReferenceExpression vre = (VariableReferenceExpression) searchVariableM.getValue();
                        if (!producedVariables.contains(vre.getVariableReference())) {
                            found = false;
                        }
                    }
                    if (found) {
                        // push down
                        LogicalVariable assignVariable = context.newVar();
                        AssignOperator aOp = new AssignOperator(assignVariable, new MutableObject<ILogicalExpression>(expressionM.getValue()));
                        aOp.getInputs().add(new MutableObject<ILogicalOperator>(branch.getValue()));
                        branch.setValue(aOp);
                        aOp.recomputeSchema();
                       
                        expressionM.setValue(new VariableReferenceExpression(assignVariable));
                        modified = true;
                    }
                }
            }
        }
View Full Code Here

        // Find the variable id used as the parameter.
        ILogicalExpression logicalExpression2 = (ILogicalExpression) functionCall.getArguments().get(0).getValue();
        if (logicalExpression2.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
            return 0;
        }
        VariableReferenceExpression variableExpression = (VariableReferenceExpression) logicalExpression2;
        return variableExpression.getVariableReference().getId();
    }
View Full Code Here

                // Propagate the property.
                Function func = (Function) functionCall.getFunctionInfo();
                documentOrder = func.getDocumentOrderPropagationPolicy().propagate(argProperties);
                break;
            case VARIABLE:
                VariableReferenceExpression variableReference = (VariableReferenceExpression) expr;
                int argVariableId = variableReference.getVariableReference().getId();
                documentOrder = variableMap.get(argVariableId);
                break;
            case CONSTANT:
            default:
                documentOrder = DocumentOrder.YES;
View Full Code Here

                // Propagate the property.
                Function func = (Function) functionCall.getFunctionInfo();
                uniqueNodes = func.getUniqueNodesPropagationPolicy().propagate(argProperties);
                break;
            case VARIABLE:
                VariableReferenceExpression variableReference = (VariableReferenceExpression) expr;
                int argVariableId = variableReference.getVariableReference().getId();
                uniqueNodes = variableMap.get(argVariableId);
                break;
            case CONSTANT:
            default:
                uniqueNodes = UniqueNodes.YES;
View Full Code Here

                            .getValue();
                    if (orderLogicalExpression.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
                        throw new RuntimeException("Operator (" + op.getOperatorTag()
                                + ") has received unexpected input in rewrite rule.");
                    }
                    VariableReferenceExpression variableExpression = (VariableReferenceExpression) orderLogicalExpression;
                    variableId = variableExpression.getVariableReference().getId();

                    // Remove document order from variable used in order operator.
                    documentOrderVariables.put(variableId, DocumentOrder.NO);
                }
                break;
View Full Code Here

                }
                VXQueryConstantValue cv = (VXQueryConstantValue) ((ConstantExpression) expr).getValue();
                return new ConstantEvaluatorFactory(cv.getValue());

            case VARIABLE:
                VariableReferenceExpression vrExpr = (VariableReferenceExpression) expr;
                int tupleFieldIndex = inputSchemas[0].findVariable(vrExpr.getVariableReference());
                return new TupleFieldEvaluatorFactory(tupleFieldIndex);

            case FUNCTION_CALL:
                ScalarFunctionCallExpression fcExpr = (ScalarFunctionCallExpression) expr;
                Function fn = (Function) fcExpr.getFunctionInfo();
View Full Code Here

        Mutable<ILogicalExpression> finalFunctionCallM = ExpressionToolbox
                .findLastFunctionExpression(mutableLogicalExpression);
        finalFunctionCall = (AbstractFunctionCallExpression) finalFunctionCallM.getValue();

        // Variable details.
        VariableReferenceExpression variableReference = (VariableReferenceExpression) mutableVariableExpresion
                .getValue();
        int variableId = variableReference.getVariableReference().getId();

        // Search for variable see if it is a aggregate sequence.
        AbstractLogicalOperator opSearch = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
        opSearch = findSequenceAggregateOperator(opSearch, variableId);
        if (opSearch == null) {
View Full Code Here

    private static ILogicalExpression vre(LogicalVariable var) {
        if (var == null) {
            throw new NullPointerException();
        }
        return new VariableReferenceExpression(var);
    }
View Full Code Here

TOP

Related Classes of edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression

Copyright © 2018 www.massapicom. 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.