public RowExpression extract(PlanNode node)
    {
        return node.accept(new Visitor(domainTranslator, functionAndTypeManager), null);
    }
@Test
    public void testTableScan()
    {
        // Effective predicate is True if there is no effective predicate
        Map<VariableReferenceExpression, ColumnHandle> assignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(AV, BV, CV, DV)));
        PlanNode node = new TableScanNode(
                Optional.empty(),
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                TupleDomain.all(),
                TupleDomain.all());
        RowExpression effectivePredicate = effectivePredicateExtractor.extract(node);
        assertEquals(effectivePredicate, TRUE_CONSTANT);

        node = new TableScanNode(
                Optional.empty(),
                newId(),
                DUAL_TABLE_HANDLE_WITH_LAYOUT,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                TupleDomain.none(),
                TupleDomain.all());
        effectivePredicate = effectivePredicateExtractor.extract(node);
        assertEquals(effectivePredicate, FALSE_CONSTANT);

        node = new TableScanNode(
                Optional.empty(),
                newId(),
                DUAL_TABLE_HANDLE_WITH_LAYOUT,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                TupleDomain.withColumnDomains(ImmutableMap.of(scanAssignments.get(AV), Domain.singleValue(BIGINT, 1L))),
                TupleDomain.all());
        effectivePredicate = effectivePredicateExtractor.extract(node);
        assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(bigintLiteral(1L), AV)));

        node = new TableScanNode(
                Optional.empty(),
                newId(),
                DUAL_TABLE_HANDLE_WITH_LAYOUT,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                TupleDomain.withColumnDomains(ImmutableMap.of(
                        scanAssignments.get(AV), Domain.singleValue(BIGINT, 1L),
                        scanAssignments.get(BV), Domain.singleValue(BIGINT, 2L))),
                TupleDomain.all());
        effectivePredicate = effectivePredicateExtractor.extract(node);
        assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(bigintLiteral(2L), BV), equals(bigintLiteral(1L), AV)));

        node = new TableScanNode(
                Optional.empty(),
                newId(),
                DUAL_TABLE_HANDLE,
                ImmutableList.copyOf(assignments.keySet()),
                assignments,
                TupleDomain.all(),
                TupleDomain.all());
        effectivePredicate = effectivePredicateExtractor.extract(node);
        assertEquals(effectivePredicate, TRUE_CONSTANT);
    }