Package com.facebook.presto.sql.planner.plan.TableWriterNode

Examples of com.facebook.presto.sql.planner.plan.TableWriterNode.WriterTarget


        @Override
        public SubPlanBuilder visitTableCommit(TableCommitNode node, Void context)
        {
            SubPlanBuilder current = node.getSource().accept(this, context);
            checkState(current.getRoot() instanceof TableWriterNode, "table commit node must be preceeded by table writer node");
            WriterTarget target = ((TableWriterNode) current.getRoot()).getTarget();

            if (current.getDistribution() != PlanDistribution.COORDINATOR_ONLY && !createSingleNodePlan) {
                current.setRoot(new SinkNode(idAllocator.getNextId(), current.getRoot(), current.getRoot().getOutputSymbols()));

                // create a new non-partitioned fragment to run on the coordinator
View Full Code Here


        }
    }

    private RecordSink getRecordSink(TableWriterNode node)
    {
        WriterTarget target = node.getTarget();
        if (target instanceof CreateHandle) {
            return recordSinkManager.getRecordSink(((CreateHandle) target).getHandle());
        }
        if (target instanceof InsertHandle) {
            return recordSinkManager.getRecordSink(((InsertHandle) target).getHandle());
        }
        throw new AssertionError("Unhandled target type: " + target.getClass().getName());
    }
View Full Code Here

        throw new AssertionError("Unhandled target type: " + target.getClass().getName());
    }

    private TableCommitter createTableCommitter(TableCommitNode node)
    {
        final WriterTarget target = node.getTarget();
        return new TableCommitter()
        {
            @Override
            public void commitTable(Collection<String> fragments)
            {
                if (target instanceof CreateHandle) {
                    metadata.commitCreateTable(((CreateHandle) target).getHandle(), fragments);
                }
                else if (target instanceof InsertHandle) {
                    metadata.commitInsert(((InsertHandle) target).getHandle(), fragments);
                }
                else {
                    throw new AssertionError("Unhandled target type: " + target.getClass().getName());
                }
            }
        };
    }
View Full Code Here

        public SubPlanBuilder visitTableWriter(TableWriterNode node, Void context)
        {
            // TODO: begin create table or insert in pre-execution step, not here
            // Part of the plan should be an Optional<StateChangeListener<QueryState>> and this
            // callback can create the table and abort the table creation if the query fails.
            WriterTarget target = createWriterTarget(node.getTarget());

            SubPlanBuilder current = node.getSource().accept(this, context);
            current.setRoot(new TableWriterNode(node.getId(), current.getRoot(), target, node.getColumns(), node.getColumnNames(), node.getOutputSymbols(), node.getSampleWeightSymbol()));
            return current;
        }
View Full Code Here

        public SubPlanBuilder visitTableWriter(TableWriterNode node, Void context)
        {
            // TODO: begin create table or insert in pre-execution step, not here
            // Part of the plan should be an Optional<StateChangeListener<QueryState>> and this
            // callback can create the table and abort the table creation if the query fails.
            WriterTarget target = createWriterTarget(node.getTarget());

            SubPlanBuilder current = node.getSource().accept(this, context);
            current.setRoot(new TableWriterNode(node.getId(), current.getRoot(), target, node.getColumns(), node.getColumnNames(), node.getOutputSymbols(), node.getSampleWeightSymbol()));
            return current;
        }
View Full Code Here

        @Override
        public SubPlanBuilder visitTableCommit(TableCommitNode node, Void context)
        {
            SubPlanBuilder current = node.getSource().accept(this, context);
            checkState(current.getRoot() instanceof TableWriterNode, "table commit node must be preceeded by table writer node");
            WriterTarget target = ((TableWriterNode) current.getRoot()).getTarget();

            if (current.getDistribution() != PlanDistribution.COORDINATOR_ONLY && !createSingleNodePlan) {
                current.setRoot(new SinkNode(idAllocator.getNextId(), current.getRoot(), current.getRoot().getOutputSymbols()));

                // create a new non-partitioned fragment to run on the coordinator
View Full Code Here

        }
    }

    private RecordSink getRecordSink(TableWriterNode node)
    {
        WriterTarget target = node.getTarget();
        if (target instanceof CreateHandle) {
            return recordSinkManager.getRecordSink(((CreateHandle) target).getHandle());
        }
        if (target instanceof InsertHandle) {
            return recordSinkManager.getRecordSink(((InsertHandle) target).getHandle());
        }
        throw new AssertionError("Unhandled target type: " + target.getClass().getName());
    }
View Full Code Here

        return builder.build();
    }

    private static TableCommitter createTableCommitter(final TableCommitNode node, final Metadata metadata)
    {
        final WriterTarget target = node.getTarget();
        return new TableCommitter()
        {
            @Override
            public void commitTable(Collection<String> fragments)
            {
                if (target instanceof CreateHandle) {
                    metadata.commitCreateTable(((CreateHandle) target).getHandle(), fragments);
                }
                else if (target instanceof InsertHandle) {
                    metadata.commitInsert(((InsertHandle) target).getHandle(), fragments);
                }
                else {
                    throw new AssertionError("Unhandled target type: " + target.getClass().getName());
                }
            }
        };
    }
View Full Code Here

        public SubPlanBuilder visitTableWriter(TableWriterNode node, Void context)
        {
            // TODO: begin create table or insert in pre-execution step, not here
            // Part of the plan should be an Optional<StateChangeListener<QueryState>> and this
            // callback can create the table and abort the table creation if the query fails.
            WriterTarget target = createWriterTarget(node.getTarget());

            SubPlanBuilder current = node.getSource().accept(this, context);
            current.setRoot(new TableWriterNode(node.getId(), current.getRoot(), target, node.getColumns(), node.getColumnNames(), node.getOutputSymbols(), node.getSampleWeightSymbol()));
            return current;
        }
View Full Code Here

        @Override
        public SubPlanBuilder visitTableCommit(TableCommitNode node, Void context)
        {
            SubPlanBuilder current = node.getSource().accept(this, context);
            checkState(current.getRoot() instanceof TableWriterNode, "table commit node must be preceeded by table writer node");
            WriterTarget target = ((TableWriterNode) current.getRoot()).getTarget();

            if (current.getDistribution() != PlanDistribution.COORDINATOR_ONLY && !createSingleNodePlan) {
                current.setRoot(new SinkNode(idAllocator.getNextId(), current.getRoot(), current.getRoot().getOutputSymbols()));

                // create a new non-partitioned fragment to run on the coordinator
View Full Code Here

TOP

Related Classes of com.facebook.presto.sql.planner.plan.TableWriterNode.WriterTarget

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.