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

Examples of com.facebook.presto.sql.planner.plan.TableScanNode


        criteriaBuilder.add(new JoinNode.EquiJoinClause(A, D));
        criteriaBuilder.add(new JoinNode.EquiJoinClause(B, E));
        List<JoinNode.EquiJoinClause> criteria = criteriaBuilder.build();

        Map<Symbol, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C)));
        TableScanNode leftScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.copyOf(leftAssignments.keySet()),
                leftAssignments,
                null,
                Optional.<GeneratedPartitions>absent()
        );

        Map<Symbol, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(D, E, F)));
        TableScanNode rightScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.copyOf(rightAssignments.keySet()),
                rightAssignments,
                null,
View Full Code Here


        criteriaBuilder.add(new JoinNode.EquiJoinClause(A, D));
        criteriaBuilder.add(new JoinNode.EquiJoinClause(B, E));
        List<JoinNode.EquiJoinClause> criteria = criteriaBuilder.build();

        Map<Symbol, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C)));
        TableScanNode leftScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.copyOf(leftAssignments.keySet()),
                leftAssignments,
                null,
                Optional.<GeneratedPartitions>absent()
        );

        Map<Symbol, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(D, E, F)));
        TableScanNode rightScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.copyOf(rightAssignments.keySet()),
                rightAssignments,
                null,
View Full Code Here

                .put(E, newColumnHandle("e"))
                .put(F, newColumnHandle("f"))
                .build();

        Map<Symbol, ColumnHandle> assignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C, D, E, F)));
        baseTableScan = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                null,
View Full Code Here

    public void testTableScan()
            throws Exception
    {
        // Effective predicate is True if there are no generated partitions
        Map<Symbol, ColumnHandle> assignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C, D)));
        PlanNode node = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                null,
                Optional.<GeneratedPartitions>absent());
        Expression effectivePredicate = EffectivePredicateExtractor.extract(node, TYPES);
        Assert.assertEquals(effectivePredicate, BooleanLiteral.TRUE_LITERAL);

        // tupleDomainInput with no matching partitions
        node = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                null,
                Optional.<GeneratedPartitions>of(new GeneratedPartitions(
                        TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of(scanAssignments.get(A), Domain.singleValue(1L))),
                        ImmutableList.<Partition>of())));
        effectivePredicate = EffectivePredicateExtractor.extract(node, TYPES);
        Assert.assertEquals(effectivePredicate, BooleanLiteral.FALSE_LITERAL);

        // tupleDomainInput with non-descriptive partitions
        node = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                null,
                Optional.<GeneratedPartitions>of(new GeneratedPartitions(
                        TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of(scanAssignments.get(A), Domain.singleValue(1L))),
                        ImmutableList.of(new Partition("test", new TestingPartition())))));
        effectivePredicate = EffectivePredicateExtractor.extract(node, TYPES);
        Assert.assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(number(1L), AE)));

        // tupleDomainInput with descriptive partitions
        node = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                null,
                Optional.<GeneratedPartitions>of(new GeneratedPartitions(
                        TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of(scanAssignments.get(A), Domain.singleValue(1L))),
                        ImmutableList.<Partition>of(tupleDomainPartition("test",
                                TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of(
                                        scanAssignments.get(A), Domain.singleValue(1L),
                                        scanAssignments.get(B), Domain.singleValue(2L))))))));
        effectivePredicate = EffectivePredicateExtractor.extract(node, TYPES);
        Assert.assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(number(2L), BE), equals(number(1L), AE)));

        // generic tupleDomainInput with no matching partitions
        node = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                null,
                Optional.<GeneratedPartitions>of(new GeneratedPartitions(
                        TupleDomain.<ColumnHandle>all(),
                        ImmutableList.<Partition>of())));
        effectivePredicate = EffectivePredicateExtractor.extract(node, TYPES);
        Assert.assertEquals(effectivePredicate, BooleanLiteral.FALSE_LITERAL);

        // generic tupleDomainInput with non-descriptive partitions
        node = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                null,
                Optional.<GeneratedPartitions>of(new GeneratedPartitions(
                        TupleDomain.<ColumnHandle>all(),
                        ImmutableList.of(new Partition("test", new TestingPartition())))));
        effectivePredicate = EffectivePredicateExtractor.extract(node, TYPES);
        Assert.assertEquals(effectivePredicate, BooleanLiteral.TRUE_LITERAL);

        // generic tupleDomainInput with descriptive partitions
        node = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                null,
                Optional.<GeneratedPartitions>of(new GeneratedPartitions(
                        TupleDomain.<ColumnHandle>all(),
                        ImmutableList.of(tupleDomainPartition("test",
                                TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of(
                                        scanAssignments.get(A), Domain.singleValue(1L),
                                        scanAssignments.get(B), Domain.singleValue(2L))))))));
        effectivePredicate = EffectivePredicateExtractor.extract(node, TYPES);
        Assert.assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(number(2L), BE), equals(number(1L), AE)));

        // Make sure only output symbols are produced
        node = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.of(A),
                assignments,
                null,
View Full Code Here

        criteriaBuilder.add(new JoinNode.EquiJoinClause(A, D));
        criteriaBuilder.add(new JoinNode.EquiJoinClause(B, E));
        List<JoinNode.EquiJoinClause> criteria = criteriaBuilder.build();

        Map<Symbol, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C)));
        TableScanNode leftScan = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(leftAssignments.keySet()),
                leftAssignments,
                null,
                Optional.<GeneratedPartitions>absent()
        );

        Map<Symbol, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(D, E, F)));
        TableScanNode rightScan = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(rightAssignments.keySet()),
                rightAssignments,
                null,
View Full Code Here

        criteriaBuilder.add(new JoinNode.EquiJoinClause(A, D));
        criteriaBuilder.add(new JoinNode.EquiJoinClause(B, E));
        List<JoinNode.EquiJoinClause> criteria = criteriaBuilder.build();

        Map<Symbol, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C)));
        TableScanNode leftScan = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(leftAssignments.keySet()),
                leftAssignments,
                null,
                Optional.<GeneratedPartitions>absent()
        );

        Map<Symbol, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(D, E, F)));
        TableScanNode rightScan = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(rightAssignments.keySet()),
                rightAssignments,
                null,
View Full Code Here

        criteriaBuilder.add(new JoinNode.EquiJoinClause(A, D));
        criteriaBuilder.add(new JoinNode.EquiJoinClause(B, E));
        List<JoinNode.EquiJoinClause> criteria = criteriaBuilder.build();

        Map<Symbol, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C)));
        TableScanNode leftScan = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(leftAssignments.keySet()),
                leftAssignments,
                null,
                Optional.<GeneratedPartitions>absent()
        );

        Map<Symbol, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(D, E, F)));
        TableScanNode rightScan = new TableScanNode(
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(rightAssignments.keySet()),
                rightAssignments,
                null,
View Full Code Here

                new TaskManagerConfig());

        tableScanNodeId = new PlanNodeId("tableScan");
        testFragment = new PlanFragment(
                new PlanFragmentId("fragment"),
                new TableScanNode(
                        tableScanNodeId,
                        tableHandle,
                        ImmutableList.of(symbol),
                        ImmutableMap.of(symbol, columnHandle),
                        null,
View Full Code Here

        // generate sources
        List<TaskSource> sources = new ArrayList<>();
        long sequenceId = 0;
        for (PlanNode sourceNode : subplan.getFragment().getSources()) {
            TableScanNode tableScan = (TableScanNode) sourceNode;

            SplitSource splitSource = splitManager.getPartitionSplits(tableScan.getTable(), getPartitions(tableScan));

            ImmutableSet.Builder<ScheduledSplit> scheduledSplits = ImmutableSet.builder();
            while (!splitSource.isFinished()) {
                try {
                    for (Split split : splitSource.getNextBatch(1000)) {
                        scheduledSplits.add(new ScheduledSplit(sequenceId++, split));
                    }
                }
                catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                    throw Throwables.propagate(e);
                }
            }

            sources.add(new TaskSource(tableScan.getId(), scheduledSplits.build(), true));
        }

        // create drivers
        List<Driver> drivers = new ArrayList<>();
        Map<PlanNodeId, Driver> driversBySource = new HashMap<>();
View Full Code Here

        // table scan with 3 splits
        Split split = new DualSplit(HostAddress.fromString("127.0.0.1"));
        PlanNodeId tableScanNodeId = new PlanNodeId(planId);
        PlanFragment testFragment = new PlanFragment(
                new PlanFragmentId(planId),
                new TableScanNode(
                        tableScanNodeId,
                        tableHandle,
                        ImmutableList.of(symbol),
                        ImmutableMap.of(symbol, columnHandle),
                        null,
View Full Code Here

TOP

Related Classes of com.facebook.presto.sql.planner.plan.TableScanNode

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.