use of com.facebook.presto.spi.plan.TableScanNode in project presto by prestodb.
the class TestEffectivePredicateExtractor method testInnerJoinWithFalseFilter.
@Test
public void testInnerJoinWithFalseFilter() {
Map<VariableReferenceExpression, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(AV, BV, CV)));
TableScanNode leftScan = tableScanNode(leftAssignments);
Map<VariableReferenceExpression, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(DV, EV, FV)));
TableScanNode rightScan = tableScanNode(rightAssignments);
PlanNode node = new JoinNode(Optional.empty(), newId(), JoinNode.Type.INNER, leftScan, rightScan, ImmutableList.of(new JoinNode.EquiJoinClause(AV, DV)), ImmutableList.<VariableReferenceExpression>builder().addAll(leftScan.getOutputVariables()).addAll(rightScan.getOutputVariables()).build(), Optional.of(FALSE_CONSTANT), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of());
RowExpression effectivePredicate = effectivePredicateExtractor.extract(node);
assertEquals(effectivePredicate, FALSE_CONSTANT);
}
use of com.facebook.presto.spi.plan.TableScanNode in project presto by prestodb.
the class TestEffectivePredicateExtractor method testLeftJoinWithFalseInner.
@Test
public void testLeftJoinWithFalseInner() {
List<JoinNode.EquiJoinClause> criteria = ImmutableList.of(new JoinNode.EquiJoinClause(AV, DV));
Map<VariableReferenceExpression, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(AV, BV, CV)));
TableScanNode leftScan = tableScanNode(leftAssignments);
Map<VariableReferenceExpression, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(DV, EV, FV)));
TableScanNode rightScan = tableScanNode(rightAssignments);
FilterNode left = filter(leftScan, and(lessThan(BV, AV), lessThan(CV, bigintLiteral(10)), equals(GV, bigintLiteral(10))));
FilterNode right = filter(rightScan, FALSE_CONSTANT);
PlanNode node = new JoinNode(Optional.empty(), newId(), JoinNode.Type.LEFT, left, right, criteria, ImmutableList.<VariableReferenceExpression>builder().addAll(left.getOutputVariables()).addAll(right.getOutputVariables()).build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of());
RowExpression effectivePredicate = effectivePredicateExtractor.extract(node);
// False literal on the right side should be ignored
assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(lessThan(BV, AV), lessThan(CV, bigintLiteral(10)), or(equals(AV, DV), isNull(DV))));
}
use of com.facebook.presto.spi.plan.TableScanNode in project presto by prestodb.
the class TestEffectivePredicateExtractor method testRightJoinWithFalseInner.
@Test
public void testRightJoinWithFalseInner() {
List<JoinNode.EquiJoinClause> criteria = ImmutableList.of(new JoinNode.EquiJoinClause(AV, DV));
Map<VariableReferenceExpression, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(AV, BV, CV)));
TableScanNode leftScan = tableScanNode(leftAssignments);
Map<VariableReferenceExpression, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(DV, EV, FV)));
TableScanNode rightScan = tableScanNode(rightAssignments);
FilterNode left = filter(leftScan, FALSE_CONSTANT);
FilterNode right = filter(rightScan, and(equals(DV, EV), lessThan(FV, bigintLiteral(100))));
PlanNode node = new JoinNode(Optional.empty(), newId(), JoinNode.Type.RIGHT, left, right, criteria, ImmutableList.<VariableReferenceExpression>builder().addAll(left.getOutputVariables()).addAll(right.getOutputVariables()).build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of());
RowExpression effectivePredicate = effectivePredicateExtractor.extract(node);
// False literal on the left side should be ignored
assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(DV, EV), lessThan(FV, bigintLiteral(100)), or(equals(AV, DV), isNull(AV))));
}
use of com.facebook.presto.spi.plan.TableScanNode in project presto by prestodb.
the class TestHiveLogicalPlanner method assertNoAggregatedColumns.
private void assertNoAggregatedColumns(Plan plan, String tableName) {
TableScanNode tableScan = searchFrom(plan.getRoot()).where(node -> isTableScanNode(node, tableName)).findOnlyElement();
for (ColumnHandle columnHandle : tableScan.getAssignments().values()) {
assertTrue(columnHandle instanceof HiveColumnHandle);
HiveColumnHandle hiveColumnHandle = (HiveColumnHandle) columnHandle;
assertFalse(hiveColumnHandle.getColumnType() == HiveColumnHandle.ColumnType.AGGREGATED);
assertFalse(hiveColumnHandle.getPartialAggregation().isPresent());
}
}
use of com.facebook.presto.spi.plan.TableScanNode in project presto by prestodb.
the class TestHiveLogicalPlanner method assertNoBucketFilter.
private void assertNoBucketFilter(Plan plan, String tableName, int readBucketCount) {
TableScanNode tableScan = searchFrom(plan.getRoot()).where(node -> isTableScanNode(node, tableName)).findOnlyElement();
assertTrue(tableScan.getTable().getLayout().isPresent());
HiveTableLayoutHandle layoutHandle = (HiveTableLayoutHandle) tableScan.getTable().getLayout().get();
assertEquals(layoutHandle.getBucketHandle().get().getReadBucketCount(), readBucketCount);
assertFalse(layoutHandle.getBucketFilter().isPresent());
}
Aggregations