Package io.crate.operation.projectors

Examples of io.crate.operation.projectors.FlatProjectorChain


        collectNode = collectNode.normalize(nodeNormalizer);
        if (collectNode.whereClause().noMatch()) {
            return Futures.immediateFuture(TaskResult.EMPTY_RESULT.rows());
        }

        FlatProjectorChain projectorChain = new FlatProjectorChain(
                collectNode.projections(), projectorVisitor);

        CrateCollector collector;
        try {
            collector = getCollector(collectNode, projectorChain);
        } catch (Exception e) {
            return Futures.immediateFailedFuture(e);
        }
        projectorChain.startProjections();
        try {
            collector.doCollect();
        } catch (CollectionTerminatedException ex) {
            // ignore
        } catch (Exception e) {
            return Futures.immediateFailedFuture(e);
        }
        return projectorChain.result();
    }
View Full Code Here


        // resolve Implementations
        ImplementationSymbolVisitor.Context ctx = implementationVisitor.process(collectNode);
        List<Input<?>> inputs = ctx.topLevelInputs();
        Set<CollectExpression<?>> collectExpressions = ctx.collectExpressions();

        FlatProjectorChain projectorChain = new FlatProjectorChain(collectNode.projections(), projectorVisitor);
        SimpleOneRowCollector collector = new SimpleOneRowCollector(
                inputs, collectExpressions, projectorChain.firstProjector());

        projectorChain.startProjections();
        try {
            collector.doCollect();
        } catch (Exception e) {
            return Futures.immediateFailedFuture(e);
        }
        return projectorChain.result();
    }
View Full Code Here

    public MergeOperation(ClusterService clusterService,
                          Settings settings,
                          TransportActionProvider transportActionProvider,
                          ImplementationSymbolVisitor symbolVisitor, MergeNode mergeNode) {
        projectorChain = new FlatProjectorChain(mergeNode.projections(),
                new ProjectionToProjectorVisitor(
                        clusterService,
                        settings,
                        transportActionProvider,
                        symbolVisitor)
View Full Code Here

        }
        return projectorChain.result();
    }

    private ListenableFuture<Object[][]> handleWithService(CollectService collectService, CollectNode node) {
        FlatProjectorChain projectorChain = new FlatProjectorChain(node.projections(), projectorVisitor);
        CrateCollector collector = collectService.getCollector(node, projectorChain.firstProjector());
        projectorChain.startProjections();
        try {
            collector.doCollect();
        } catch (CollectionTerminatedException ex) {
            // ignore
        } catch (Exception e) {
            return Futures.immediateFailedFuture(e);
        }
        return projectorChain.result();
    }
View Full Code Here

        results = Arrays.<ListenableFuture<QueryResult>>asList(result);
        if (node.ids().size() > 1) {
            MultiGetRequest multiGetRequest = prepareMultiGetRequest(node, fsc);
            transportAction = multiGetAction;
            request = multiGetRequest;
            FlatProjectorChain projectorChain = getFlatProjectorChain(projectionToProjectorVisitor, node);
            listener = new MultiGetResponseListener(result, extractors, projectorChain);
        } else {
            GetRequest getRequest = prepareGetRequest(node, fsc);
            transportAction = getAction;
            request = getRequest;
View Full Code Here

        return multiGetRequest;
    }

    private FlatProjectorChain getFlatProjectorChain(ProjectionToProjectorVisitor projectionToProjectorVisitor,
                                                     ESGetNode node) {
        FlatProjectorChain projectorChain = null;
        if (node.limit() != null || node.offset() > 0 || !node.sortSymbols().isEmpty()) {
            List<Symbol> orderBySymbols = new ArrayList<>(node.sortSymbols().size());
            for (Symbol symbol : node.sortSymbols()) {
                int i = node.outputs().indexOf(symbol);
                if (i < 0 ) {
                    orderBySymbols.add(new InputColumn(node.outputs().size() + orderBySymbols.size()));
                } else {
                    orderBySymbols.add(new InputColumn(i));
                }
            }
            TopNProjection topNProjection = new TopNProjection(
                    com.google.common.base.Objects.firstNonNull(node.limit(), Constants.DEFAULT_SELECT_LIMIT),
                    node.offset(),
                    orderBySymbols,
                    node.reverseFlags(),
                    node.nullsFirst()
            );
            topNProjection.outputs(genInputColumns(node.outputs().size()));
            projectorChain = new FlatProjectorChain(
                    Arrays.<Projection>asList(topNProjection),
                    projectionToProjectorVisitor
            );
        }
        return projectorChain;
View Full Code Here

TOP

Related Classes of io.crate.operation.projectors.FlatProjectorChain

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.