Examples of DualTableHandle


Examples of com.facebook.presto.connector.dual.DualTableHandle

    @Test
    public void testDualSerialize()
            throws Exception
    {
        DualTableHandle internalHandle = new DualTableHandle("dual_schema");

        assertTrue(objectMapper.canSerialize(DualTableHandle.class));
        String json = objectMapper.writeValueAsString(internalHandle);
        testJsonEquals(json, DUAL_AS_MAP);
    }
View Full Code Here

Examples of com.facebook.presto.connector.dual.DualTableHandle

    {
        String json = objectMapper.writeValueAsString(DUAL_AS_MAP);

        TableHandle tableHandle = objectMapper.readValue(json, TableHandle.class);
        assertEquals(tableHandle.getClass(), DualTableHandle.class);
        DualTableHandle dualHandle = (DualTableHandle) tableHandle;

        assertEquals(dualHandle.getSchemaName(), "dual_schema");
    }
View Full Code Here

Examples of com.facebook.presto.connector.dual.DualTableHandle

                .put(F, new DualColumnHandle("f"))
                .build();

        baseTableScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.of(A, B, C, D, E, F),
                scanAssignments,
                BooleanLiteral.TRUE_LITERAL,
                BooleanLiteral.TRUE_LITERAL
        );
View Full Code Here

Examples of com.facebook.presto.connector.dual.DualTableHandle

    public void testTableScan()
            throws Exception
    {
        PlanNode node = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.of(A, B, C),
                scanAssignments,
                and(greaterThan(BE, number(0)), equals(AE, DE), lessThan(DE, number(10)), lessThan(EE, number(3))),
                BooleanLiteral.TRUE_LITERAL);
View Full Code Here

Examples of com.facebook.presto.connector.dual.DualTableHandle

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

        TableScanNode leftScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.of(A, B, C),
                scanAssignments,
                BooleanLiteral.TRUE_LITERAL,
                BooleanLiteral.TRUE_LITERAL
        );

        TableScanNode rightScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.of(D, E, F),
                scanAssignments,
                BooleanLiteral.TRUE_LITERAL,
                BooleanLiteral.TRUE_LITERAL
        );
View Full Code Here

Examples of com.facebook.presto.connector.dual.DualTableHandle

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

        TableScanNode leftScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.of(A, B, C),
                scanAssignments,
                BooleanLiteral.TRUE_LITERAL,
                BooleanLiteral.TRUE_LITERAL
        );

        TableScanNode rightScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.of(D, E, F),
                scanAssignments,
                BooleanLiteral.TRUE_LITERAL,
                BooleanLiteral.TRUE_LITERAL
        );
View Full Code Here

Examples of com.facebook.presto.connector.dual.DualTableHandle

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

        TableScanNode leftScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.of(A, B, C),
                scanAssignments,
                BooleanLiteral.TRUE_LITERAL,
                BooleanLiteral.TRUE_LITERAL
        );

        TableScanNode rightScan = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.of(D, E, F),
                scanAssignments,
                BooleanLiteral.TRUE_LITERAL,
                BooleanLiteral.TRUE_LITERAL
        );
View Full Code Here

Examples of com.facebook.presto.connector.dual.DualTableHandle

                .build();

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

Examples of com.facebook.presto.connector.dual.DualTableHandle

    {
        // 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(),
                new DualTableHandle("default"),
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                null,
                Optional.<GeneratedPartitions>absent());
        Expression effectivePredicate = EffectivePredicateExtractor.extract(node);
        Assert.assertEquals(effectivePredicate, BooleanLiteral.TRUE_LITERAL);

        // tupleDomainInput with no matching partitions
        node = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                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);
        Assert.assertEquals(effectivePredicate, BooleanLiteral.FALSE_LITERAL);

        // tupleDomainInput with non-descriptive partitions
        node = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                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(new DualPartition()))));
        effectivePredicate = EffectivePredicateExtractor.extract(node);
        Assert.assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(number(1L), AE)));

        // tupleDomainInput with descriptive partitions
        node = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                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(TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of(
                                scanAssignments.get(A), Domain.singleValue(1L),
                                scanAssignments.get(B), Domain.singleValue(2L))))))));
        effectivePredicate = EffectivePredicateExtractor.extract(node);
        Assert.assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(number(2L), BE), equals(number(1L), AE)));

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

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

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

        // Make sure only output symbols are produced
        node = new TableScanNode(
                newId(),
                new DualTableHandle("default"),
                ImmutableList.of(A),
                assignments,
                null,
                Optional.<GeneratedPartitions>of(new GeneratedPartitions(
                        TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of(
View Full Code Here

Examples of com.facebook.presto.connector.dual.DualTableHandle

        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,
                Optional.<GeneratedPartitions>absent()
        );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.