Example usage for org.apache.commons.lang3.mutable Mutable getValue

List of usage examples for org.apache.commons.lang3.mutable Mutable getValue

Introduction

In this page you can find the example usage for org.apache.commons.lang3.mutable Mutable getValue.

Prototype

T getValue();

Source Link

Document

Gets the value of this mutable.

Usage

From source file:edu.uci.ics.hyracks.algebricks.rewriter.rules.SetAlgebricksPhysicalOperatorsRule.java

@SuppressWarnings("unchecked")
private static void computeDefaultPhysicalOp(AbstractLogicalOperator op, boolean topLevelOp,
        IOptimizationContext context) throws AlgebricksException {
    PhysicalOptimizationConfig physicalOptimizationConfig = context.getPhysicalOptimizationConfig();
    if (op.getPhysicalOperator() == null) {
        switch (op.getOperatorTag()) {
        case AGGREGATE: {
            op.setPhysicalOperator(new AggregatePOperator());
            break;
        }/* w  w  w.  j  a v a2 s .c o m*/
        case ASSIGN: {
            op.setPhysicalOperator(new AssignPOperator());
            break;
        }
        case DISTINCT: {
            DistinctOperator distinct = (DistinctOperator) op;
            distinct.setPhysicalOperator(new PreSortedDistinctByPOperator(distinct.getDistinctByVarList()));
            break;
        }
        case EMPTYTUPLESOURCE: {
            op.setPhysicalOperator(new EmptyTupleSourcePOperator());
            break;
        }
        case EXCHANGE: {
            if (op.getPhysicalOperator() == null) {
                throw new AlgebricksException("Implementation for EXCHANGE operator was not set.");
            }
            // implem. choice for exchange should be set by a parent op.
            break;
        }
        case GROUP: {
            GroupByOperator gby = (GroupByOperator) op;

            if (gby.getNestedPlans().size() == 1) {
                ILogicalPlan p0 = gby.getNestedPlans().get(0);
                if (p0.getRoots().size() == 1) {
                    if (gby.getAnnotations().get(OperatorAnnotations.USE_HASH_GROUP_BY) == Boolean.TRUE || gby
                            .getAnnotations().get(OperatorAnnotations.USE_EXTERNAL_GROUP_BY) == Boolean.TRUE) {
                        if (!topLevelOp) {
                            throw new NotImplementedException(
                                    "External hash group-by for nested grouping is not implemented.");
                        }

                        boolean hasIntermediateAgg = generateMergeAggregationExpressions(gby, context);
                        if (hasIntermediateAgg) {
                            ExternalGroupByPOperator externalGby = new ExternalGroupByPOperator(
                                    gby.getGroupByList(),
                                    physicalOptimizationConfig.getMaxFramesExternalGroupBy(),
                                    physicalOptimizationConfig.getExternalGroupByTableSize());
                            op.setPhysicalOperator(externalGby);
                            break;
                        }
                    }
                }
            }

            List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> gbyList = gby.getGroupByList();
            List<LogicalVariable> columnList = new ArrayList<LogicalVariable>(gbyList.size());
            for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : gbyList) {
                ILogicalExpression expr = p.second.getValue();
                if (expr.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
                    VariableReferenceExpression varRef = (VariableReferenceExpression) expr;
                    columnList.add(varRef.getVariableReference());
                }
            }
            if (topLevelOp) {
                op.setPhysicalOperator(new PreclusteredGroupByPOperator(columnList));
            } else {
                op.setPhysicalOperator(new MicroPreclusteredGroupByPOperator(columnList));
            }
            break;
        }
        case INNERJOIN: {
            JoinUtils.setJoinAlgorithmAndExchangeAlgo((InnerJoinOperator) op, context);
            break;
        }
        case LEFTOUTERJOIN: {
            JoinUtils.setJoinAlgorithmAndExchangeAlgo((LeftOuterJoinOperator) op, context);
            break;
        }
        case LIMIT: {
            op.setPhysicalOperator(new StreamLimitPOperator());
            break;
        }
        case NESTEDTUPLESOURCE: {
            op.setPhysicalOperator(new NestedTupleSourcePOperator());
            break;
        }
        case ORDER: {
            OrderOperator oo = (OrderOperator) op;
            for (Pair<IOrder, Mutable<ILogicalExpression>> p : oo.getOrderExpressions()) {
                ILogicalExpression e = p.second.getValue();
                if (e.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
                    throw new AlgebricksException("Order expression " + e + " has not been normalized.");
                }
            }
            if (topLevelOp) {
                op.setPhysicalOperator(
                        new StableSortPOperator(physicalOptimizationConfig.getMaxFramesExternalSort()));
            } else {
                op.setPhysicalOperator(new InMemoryStableSortPOperator());
            }
            break;
        }
        case PROJECT: {
            op.setPhysicalOperator(new StreamProjectPOperator());
            break;
        }
        case RUNNINGAGGREGATE: {
            op.setPhysicalOperator(new RunningAggregatePOperator());
            break;
        }
        case REPLICATE: {
            op.setPhysicalOperator(new ReplicatePOperator());
            break;
        }
        case SCRIPT: {
            op.setPhysicalOperator(new StringStreamingScriptPOperator());
            break;
        }
        case SELECT: {
            op.setPhysicalOperator(new StreamSelectPOperator());
            break;
        }
        case SUBPLAN: {
            op.setPhysicalOperator(new SubplanPOperator());
            break;
        }
        case UNIONALL: {
            op.setPhysicalOperator(new UnionAllPOperator());
            break;
        }

        case UNNEST: {
            op.setPhysicalOperator(new UnnestPOperator());
            break;
        }
        case DATASOURCESCAN: {
            DataSourceScanOperator scan = (DataSourceScanOperator) op;
            IDataSource dataSource = scan.getDataSource();
            DataSourceScanPOperator dss = new DataSourceScanPOperator(dataSource);
            IMetadataProvider mp = context.getMetadataProvider();
            if (mp.scannerOperatorIsLeaf(dataSource)) {
                dss.disableJobGenBelowMe();
            }
            op.setPhysicalOperator(dss);
            break;
        }
        case WRITE: {
            op.setPhysicalOperator(new SinkWritePOperator());
            break;
        }
        case DISTRIBUTE_RESULT: {
            op.setPhysicalOperator(new DistributeResultPOperator());
            break;
        }
        case WRITE_RESULT: {
            WriteResultOperator opLoad = (WriteResultOperator) op;
            LogicalVariable payload;
            List<LogicalVariable> keys = new ArrayList<LogicalVariable>();
            List<LogicalVariable> additionalFilteringKeys = null;
            payload = getKeysAndLoad(opLoad.getPayloadExpression(), opLoad.getKeyExpressions(), keys);
            if (opLoad.getAdditionalFilteringExpressions() != null) {
                additionalFilteringKeys = new ArrayList<LogicalVariable>();
                getKeys(opLoad.getAdditionalFilteringExpressions(), additionalFilteringKeys);
            }
            op.setPhysicalOperator(
                    new WriteResultPOperator(opLoad.getDataSource(), payload, keys, additionalFilteringKeys));
            break;
        }
        case INSERT_DELETE: {
            InsertDeleteOperator opLoad = (InsertDeleteOperator) op;
            LogicalVariable payload;
            List<LogicalVariable> keys = new ArrayList<LogicalVariable>();
            List<LogicalVariable> additionalFilteringKeys = null;
            payload = getKeysAndLoad(opLoad.getPayloadExpression(), opLoad.getPrimaryKeyExpressions(), keys);
            if (opLoad.getAdditionalFilteringExpressions() != null) {
                additionalFilteringKeys = new ArrayList<LogicalVariable>();
                getKeys(opLoad.getAdditionalFilteringExpressions(), additionalFilteringKeys);
            }
            if (opLoad.isBulkload()) {
                op.setPhysicalOperator(
                        new BulkloadPOperator(payload, keys, additionalFilteringKeys, opLoad.getDataSource()));
            } else {
                op.setPhysicalOperator(new InsertDeletePOperator(payload, keys, additionalFilteringKeys,
                        opLoad.getDataSource()));
            }
            break;
        }
        case INDEX_INSERT_DELETE: {
            IndexInsertDeleteOperator opInsDel = (IndexInsertDeleteOperator) op;
            List<LogicalVariable> primaryKeys = new ArrayList<LogicalVariable>();
            List<LogicalVariable> secondaryKeys = new ArrayList<LogicalVariable>();
            List<LogicalVariable> additionalFilteringKeys = null;
            getKeys(opInsDel.getPrimaryKeyExpressions(), primaryKeys);
            getKeys(opInsDel.getSecondaryKeyExpressions(), secondaryKeys);
            if (opInsDel.getAdditionalFilteringExpressions() != null) {
                additionalFilteringKeys = new ArrayList<LogicalVariable>();
                getKeys(opInsDel.getAdditionalFilteringExpressions(), additionalFilteringKeys);
            }
            if (opInsDel.isBulkload()) {
                op.setPhysicalOperator(
                        new IndexBulkloadPOperator(primaryKeys, secondaryKeys, additionalFilteringKeys,
                                opInsDel.getFilterExpression(), opInsDel.getDataSourceIndex()));
            } else {
                op.setPhysicalOperator(
                        new IndexInsertDeletePOperator(primaryKeys, secondaryKeys, additionalFilteringKeys,
                                opInsDel.getFilterExpression(), opInsDel.getDataSourceIndex()));
            }

            break;

        }
        case TOKENIZE: {
            TokenizeOperator opTokenize = (TokenizeOperator) op;
            List<LogicalVariable> primaryKeys = new ArrayList<LogicalVariable>();
            List<LogicalVariable> secondaryKeys = new ArrayList<LogicalVariable>();
            getKeys(opTokenize.getPrimaryKeyExpressions(), primaryKeys);
            getKeys(opTokenize.getSecondaryKeyExpressions(), secondaryKeys);
            // Tokenize Operator only operates with a bulk load on a data set with an index
            if (opTokenize.isBulkload()) {
                op.setPhysicalOperator(
                        new TokenizePOperator(primaryKeys, secondaryKeys, opTokenize.getDataSourceIndex()));
            }
            break;
        }
        case SINK: {
            op.setPhysicalOperator(new SinkPOperator());
            break;
        }
        }
    }
    if (op.hasNestedPlans()) {
        AbstractOperatorWithNestedPlans nested = (AbstractOperatorWithNestedPlans) op;
        for (ILogicalPlan p : nested.getNestedPlans()) {
            setPhysicalOperators(p, false, context);
        }
    }
    for (Mutable<ILogicalOperator> opRef : op.getInputs()) {
        computeDefaultPhysicalOp((AbstractLogicalOperator) opRef.getValue(), topLevelOp, context);
    }
}

From source file:edu.uci.ics.asterix.optimizer.rules.am.AccessMethodUtils.java

public static ScalarFunctionCallExpression findLOJIsNullFuncInGroupBy(GroupByOperator lojGroupbyOp)
        throws AlgebricksException {
    //find IS_NULL function of which argument has the nullPlaceholder variable in the nested plan of groupby.
    ALogicalPlanImpl subPlan = (ALogicalPlanImpl) lojGroupbyOp.getNestedPlans().get(0);
    Mutable<ILogicalOperator> subPlanRootOpRef = subPlan.getRoots().get(0);
    AbstractLogicalOperator subPlanRootOp = (AbstractLogicalOperator) subPlanRootOpRef.getValue();
    boolean foundSelectNonNull = false;
    ScalarFunctionCallExpression isNullFuncExpr = null;
    AbstractLogicalOperator inputOp = subPlanRootOp;
    while (inputOp != null) {
        if (inputOp.getOperatorTag() == LogicalOperatorTag.SELECT) {
            SelectOperator selectOp = (SelectOperator) inputOp;
            if (selectOp.getCondition().getValue().getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
                if (((AbstractFunctionCallExpression) selectOp.getCondition().getValue())
                        .getFunctionIdentifier().equals(AlgebricksBuiltinFunctions.NOT)) {
                    ScalarFunctionCallExpression notFuncExpr = (ScalarFunctionCallExpression) selectOp
                            .getCondition().getValue();
                    if (notFuncExpr.getArguments().get(0).getValue()
                            .getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
                        if (((AbstractFunctionCallExpression) notFuncExpr.getArguments().get(0).getValue())
                                .getFunctionIdentifier().equals(AlgebricksBuiltinFunctions.IS_NULL)) {
                            isNullFuncExpr = (ScalarFunctionCallExpression) notFuncExpr.getArguments().get(0)
                                    .getValue();
                            if (isNullFuncExpr.getArguments().get(0).getValue()
                                    .getExpressionTag() == LogicalExpressionTag.VARIABLE) {
                                foundSelectNonNull = true;
                                break;
                            }/*ww  w.j av a 2 s .c o  m*/
                        }
                    }
                }
            }
        }
        inputOp = inputOp.getInputs().size() > 0
                ? (AbstractLogicalOperator) inputOp.getInputs().get(0).getValue()
                : null;
    }

    if (!foundSelectNonNull) {
        throw new AlgebricksException(
                "Could not find the non-null select operator in GroupByOperator for LEFTOUTERJOIN plan optimization.");
    }
    return isNullFuncExpr;
}

From source file:com.ibm.jaggr.core.test.TestUtils.java

public static IAggregator createMockAggregator(Ref<IConfig> configRef, File workingDirectory,
        List<InitParam> initParams, Class<?> aggregatorProxyClass, IHttpTransport transport) throws Exception {

    final IAggregator mockAggregator = EasyMock.createNiceMock(IAggregator.class);
    IOptions options = new OptionsImpl(false, null);
    options.setOption(IOptions.DELETE_DELAY, "0");
    if (initParams == null) {
        initParams = new LinkedList<InitParam>();
    }//from   w  w w  . jav  a 2 s . com
    final InitParams aggInitParams = new InitParams(initParams);
    boolean createConfig = (configRef == null);
    if (workingDirectory == null) {
        workingDirectory = new File(System.getProperty("java.io.tmpdir"));
    }
    final Ref<ICacheManager> cacheMgrRef = new Ref<ICacheManager>(null);
    final Ref<IHttpTransport> transportRef = new Ref<IHttpTransport>(
            transport == null ? new TestDojoHttpTransport() : transport);
    final Ref<IExecutors> executorsRef = new Ref<IExecutors>(new ExecutorsImpl(new SynchronousExecutor(), null,
            new SynchronousScheduledExecutor(), new SynchronousScheduledExecutor()));
    final File workdir = workingDirectory;

    EasyMock.expect(mockAggregator.getWorkingDirectory()).andReturn(workingDirectory).anyTimes();
    EasyMock.expect(mockAggregator.getName()).andReturn("test").anyTimes();
    EasyMock.expect(mockAggregator.getOptions()).andReturn(options).anyTimes();
    EasyMock.expect(mockAggregator.getExecutors()).andAnswer(new IAnswer<IExecutors>() {
        public IExecutors answer() throws Throwable {
            return executorsRef.get();
        }
    }).anyTimes();
    if (createConfig) {
        configRef = new Ref<IConfig>(null);
        // ConfigImpl constructor calls IAggregator.newResource()
        EasyMock.expect(mockAggregator.newResource((URI) EasyMock.anyObject()))
                .andAnswer(new IAnswer<IResource>() {
                    public IResource answer() throws Throwable {
                        return mockAggregatorNewResource((URI) EasyMock.getCurrentArguments()[0], workdir);
                    }
                }).anyTimes();
    }
    EasyMock.expect(mockAggregator.substituteProps((String) EasyMock.anyObject()))
            .andAnswer(new IAnswer<String>() {
                public String answer() throws Throwable {
                    return (String) EasyMock.getCurrentArguments()[0];
                }
            }).anyTimes();
    EasyMock.expect(mockAggregator.substituteProps((String) EasyMock.anyObject(),
            (IAggregator.SubstitutionTransformer) EasyMock.anyObject())).andAnswer(new IAnswer<String>() {
                public String answer() throws Throwable {
                    return (String) EasyMock.getCurrentArguments()[0];
                }
            }).anyTimes();
    EasyMock.expect(mockAggregator.newLayerCache()).andAnswer(new IAnswer<ILayerCache>() {
        public ILayerCache answer() throws Throwable {
            return new LayerCacheImpl(mockAggregator);
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.newModuleCache()).andAnswer(new IAnswer<IModuleCache>() {
        public IModuleCache answer() throws Throwable {
            return new ModuleCacheImpl();
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.newGzipCache()).andAnswer(new IAnswer<IGzipCache>() {
        public IGzipCache answer() throws Throwable {
            return new GzipCacheImpl();
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.getInitParams()).andAnswer(new IAnswer<InitParams>() {
        public InitParams answer() throws Throwable {
            return aggInitParams;
        }
    }).anyTimes();
    EasyMock.replay(mockAggregator);
    IAggregator mockAggregatorProxy = mockAggregator;
    if (aggregatorProxyClass != null) {
        mockAggregatorProxy = (IAggregator) aggregatorProxyClass
                .getConstructor(new Class[] { IAggregator.class }).newInstance(mockAggregator);
    }
    TestCacheManager cacheMgr = new TestCacheManager(mockAggregatorProxy, 1);
    cacheMgrRef.set(cacheMgr);
    //((IOptionsListener)cacheMgrRef.get()).optionsUpdated(options, 1);
    if (createConfig) {
        configRef.set(new ConfigImpl(mockAggregatorProxy, workingDirectory.toURI(), "{}"));
    }
    EasyMock.reset(mockAggregator);
    EasyMock.expect(mockAggregator.getWorkingDirectory()).andReturn(workingDirectory).anyTimes();
    EasyMock.expect(mockAggregator.getOptions()).andReturn(options).anyTimes();
    EasyMock.expect(mockAggregator.getName()).andReturn("test").anyTimes();
    EasyMock.expect(mockAggregator.getTransport()).andAnswer(new IAnswer<IHttpTransport>() {
        public IHttpTransport answer() throws Throwable {
            return transportRef.get();
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.newResource((URI) EasyMock.anyObject())).andAnswer(new IAnswer<IResource>() {
        public IResource answer() throws Throwable {
            return mockAggregatorNewResource((URI) EasyMock.getCurrentArguments()[0], workdir);
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.getResourceFactory(EasyMock.isA(Mutable.class)))
            .andAnswer(new IAnswer<IResourceFactory>() {
                public IResourceFactory answer() throws Throwable {
                    Mutable<URI> uriRef = (Mutable<URI>) EasyMock.getCurrentArguments()[0];
                    URI uri = uriRef.getValue();
                    if (!uri.isAbsolute() && uri.getPath().startsWith("/"))
                        return null;
                    return ("file".equals(uri.getScheme())) ? new FileResourceFactory() : null;
                }
            }).anyTimes();
    EasyMock.expect(
            mockAggregator.getModuleBuilder((String) EasyMock.anyObject(), (IResource) EasyMock.anyObject()))
            .andAnswer(new IAnswer<IModuleBuilder>() {
                public IModuleBuilder answer() throws Throwable {
                    String mid = (String) EasyMock.getCurrentArguments()[0];
                    return mid.contains(".") ? new TextModuleBuilder() : new JavaScriptModuleBuilder();
                }
            }).anyTimes();
    final Ref<IConfig> cfgRef = configRef;
    EasyMock.expect(mockAggregator.getConfig()).andAnswer(new IAnswer<IConfig>() {
        public IConfig answer() throws Throwable {
            return cfgRef.get();
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.getCacheManager()).andAnswer(new IAnswer<ICacheManager>() {
        public ICacheManager answer() throws Throwable {
            return cacheMgrRef.get();
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.newModule((String) EasyMock.anyObject(), (URI) EasyMock.anyObject()))
            .andAnswer(new IAnswer<IModule>() {
                public IModule answer() throws Throwable {
                    String mid = (String) EasyMock.getCurrentArguments()[0];
                    URI uri = (URI) EasyMock.getCurrentArguments()[1];
                    return new ModuleImpl(mid, uri);
                }
            }).anyTimes();
    EasyMock.expect(mockAggregator.getExecutors()).andAnswer(new IAnswer<IExecutors>() {
        public IExecutors answer() throws Throwable {
            return executorsRef.get();
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.newLayerCache()).andAnswer(new IAnswer<ILayerCache>() {
        public ILayerCache answer() throws Throwable {
            return new LayerCacheImpl(mockAggregator);
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.newModuleCache()).andAnswer(new IAnswer<IModuleCache>() {
        public IModuleCache answer() throws Throwable {
            return new ModuleCacheImpl();
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.newGzipCache()).andAnswer(new IAnswer<IGzipCache>() {
        public IGzipCache answer() throws Throwable {
            return new GzipCacheImpl();
        }
    }).anyTimes();
    EasyMock.expect(mockAggregator.substituteProps((String) EasyMock.anyObject()))
            .andAnswer(new IAnswer<String>() {
                public String answer() throws Throwable {
                    return (String) EasyMock.getCurrentArguments()[0];
                }
            }).anyTimes();
    EasyMock.expect(mockAggregator.substituteProps((String) EasyMock.anyObject(),
            (IAggregator.SubstitutionTransformer) EasyMock.anyObject())).andAnswer(new IAnswer<String>() {
                public String answer() throws Throwable {
                    return (String) EasyMock.getCurrentArguments()[0];
                }
            }).anyTimes();
    EasyMock.expect(mockAggregator.getInitParams()).andAnswer(new IAnswer<InitParams>() {
        public InitParams answer() throws Throwable {
            return aggInitParams;
        }
    }).anyTimes();
    EasyMock.expect(
            mockAggregator.buildAsync(EasyMock.isA(Callable.class), EasyMock.isA(HttpServletRequest.class)))
            .andAnswer((IAnswer) new IAnswer<Future<?>>() {
                @Override
                public Future<?> answer() throws Throwable {
                    Callable<?> builder = (Callable<?>) EasyMock.getCurrentArguments()[0];
                    return executorsRef.get().getBuildExecutor().submit(builder);
                }

            }).anyTimes();

    return mockAggregator;
}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.typing.PropagateOperatorInputsTypeEnvironment.java

private Object getVarTypeFullList(LogicalVariable var, List<LogicalVariable> nonNullVariableList,
        List<List<LogicalVariable>> correlatedNullableVariableLists) throws AlgebricksException {
    Object t = varTypeMap.get(var);
    if (t != null) {
        return t;
    }//from   w  ww  .  j a  v  a2  s . c om
    for (Mutable<ILogicalOperator> r : op.getInputs()) {
        ILogicalOperator c = r.getValue();
        IVariableTypeEnvironment env = ctx.getOutputTypeEnvironment(c);
        Object t2 = env.getVarType(var, nonNullVariableList, correlatedNullableVariableLists);
        if (t2 != null) {
            return t2;
        }
    }
    return null;
}

From source file:edu.uci.ics.hyracks.algebricks.rewriter.rules.EliminateGroupByEmptyKeyRule.java

private Mutable<ILogicalOperator> getNestedTupleSourceReference(
        Mutable<ILogicalOperator> nestedTopOperatorRef) {
    Mutable<ILogicalOperator> currentOpRef = nestedTopOperatorRef;
    while (currentOpRef.getValue().getInputs() != null && currentOpRef.getValue().getInputs().size() > 0) {
        currentOpRef = currentOpRef.getValue().getInputs().get(0);
    }// w  ww  .  j  a  v  a  2s  .  c o  m
    return currentOpRef;
}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractOperatorWithNestedPlans.java

@Override
public void recomputeSchema() {
    schema = new ArrayList<LogicalVariable>();
    schema.addAll(inputs.get(0).getValue().getSchema());
    for (ILogicalPlan p : nestedPlans) {
        for (Mutable<ILogicalOperator> r : p.getRoots()) {
            schema.addAll(r.getValue().getSchema());
        }//from ww  w .j  a va 2s.  c  o  m
    }
}

From source file:edu.uci.ics.hyracks.algebricks.rewriter.rules.InferTypesRule.java

@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    ILogicalOperator op = opRef.getValue();
    if (context.getOutputTypeEnvironment(op) != null) {
        return false;
    }//from   w w  w.  jav a  2  s .  c  om
    context.computeAndSetTypeEnvironmentForOperator(op);
    return true;
}

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.NestedTupleSourceOperator.java

@Override
public void recomputeSchema() {
    schema = new ArrayList<LogicalVariable>();
    ILogicalOperator topOp = dataSourceReference.getValue();
    for (Mutable<ILogicalOperator> i : topOp.getInputs()) {
        schema.addAll(i.getValue().getSchema());
    }//from w w w  .ja  va  2 s . com
}

From source file:edu.uci.ics.asterix.optimizer.rules.IntroduceEnforcedListTypeRule.java

private boolean rewriteExpressions(List<Mutable<ILogicalExpression>> expressions, IVariableTypeEnvironment env)
        throws AlgebricksException {
    boolean changed = false;
    for (Mutable<ILogicalExpression> exprRef : expressions) {
        ILogicalExpression expr = exprRef.getValue();
        if (expr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
            AbstractFunctionCallExpression argFuncExpr = (AbstractFunctionCallExpression) expr;
            IAType exprType = (IAType) env.getType(argFuncExpr);
            if (StaticTypeCastUtil.rewriteListExpr(argFuncExpr, exprType, exprType, env)) {
                TypeComputerUtilities.resetRequiredAndInputTypes(argFuncExpr);
                changed = true;// w w  w  .  j a va 2s  .  c  o  m
            }
        }
    }
    return changed;
}

From source file:edu.uci.ics.hyracks.algebricks.rewriter.rules.IsolateHyracksOperatorsRule.java

private void disableJobGenRec(ILogicalOperator operator) {
    AbstractLogicalOperator op = (AbstractLogicalOperator) operator;
    op.disableJobGen();/*from   ww  w  .j  a v a  2s  .c o m*/
    for (Mutable<ILogicalOperator> i : op.getInputs()) {
        disableJobGenRec(i.getValue());
    }
}