use of com.facebook.presto.expressions.DynamicFilters.DynamicFilterPlaceholder in project presto by prestodb.
the class TestLocalDynamicFilter method testMultiplePartitionsAndColumns.
@Test
public void testMultiplePartitionsAndColumns() throws ExecutionException, InterruptedException {
LocalDynamicFilter filter = new LocalDynamicFilter(ImmutableMultimap.of("123", new DynamicFilterPlaceholder("123", new VariableReferenceExpression(Optional.empty(), "a", INTEGER), EQUAL), "456", new DynamicFilterPlaceholder("456", new VariableReferenceExpression(Optional.empty(), "b", BIGINT), EQUAL)), ImmutableMap.of("123", 0, "456", 1), 2);
assertEquals(filter.getBuildChannels(), ImmutableMap.of("123", 0, "456", 1));
Consumer<TupleDomain<String>> consumer = filter.getTupleDomainConsumer();
ListenableFuture<TupleDomain<VariableReferenceExpression>> result = filter.getResultFuture();
assertFalse(result.isDone());
consumer.accept(TupleDomain.withColumnDomains(ImmutableMap.of("123", Domain.singleValue(INTEGER, 10L), "456", Domain.singleValue(BIGINT, 100L))));
assertFalse(result.isDone());
consumer.accept(TupleDomain.withColumnDomains(ImmutableMap.of("123", Domain.singleValue(INTEGER, 20L), "456", Domain.singleValue(BIGINT, 200L))));
assertEquals(result.get(), TupleDomain.withColumnDomains(ImmutableMap.of(new VariableReferenceExpression(Optional.empty(), "a", INTEGER), Domain.multipleValues(INTEGER, ImmutableList.of(10L, 20L)), new VariableReferenceExpression(Optional.empty(), "b", BIGINT), Domain.multipleValues(BIGINT, ImmutableList.of(100L, 200L)))));
}
use of com.facebook.presto.expressions.DynamicFilters.DynamicFilterPlaceholder in project presto by prestodb.
the class TestLocalDynamicFilter method testMultipleColumns.
@Test
public void testMultipleColumns() throws ExecutionException, InterruptedException {
LocalDynamicFilter filter = new LocalDynamicFilter(ImmutableMultimap.of("123", new DynamicFilterPlaceholder("123", new VariableReferenceExpression(Optional.empty(), "a", INTEGER), EQUAL), "456", new DynamicFilterPlaceholder("456", new VariableReferenceExpression(Optional.empty(), "b", INTEGER), EQUAL)), ImmutableMap.of("123", 0, "456", 1), 1);
assertEquals(filter.getBuildChannels(), ImmutableMap.of("123", 0, "456", 1));
Consumer<TupleDomain<String>> consumer = filter.getTupleDomainConsumer();
ListenableFuture<TupleDomain<VariableReferenceExpression>> result = filter.getResultFuture();
assertFalse(result.isDone());
consumer.accept(TupleDomain.withColumnDomains(ImmutableMap.of("123", Domain.singleValue(INTEGER, 10L), "456", Domain.singleValue(INTEGER, 20L))));
assertEquals(result.get(), TupleDomain.withColumnDomains(ImmutableMap.of(new VariableReferenceExpression(Optional.empty(), "a", INTEGER), Domain.singleValue(INTEGER, 10L), new VariableReferenceExpression(Optional.empty(), "b", INTEGER), Domain.singleValue(INTEGER, 20L))));
}
use of com.facebook.presto.expressions.DynamicFilters.DynamicFilterPlaceholder in project presto by prestodb.
the class TestLocalDynamicFilter method testMultiplePartitions.
@Test
public void testMultiplePartitions() throws ExecutionException, InterruptedException {
LocalDynamicFilter filter = new LocalDynamicFilter(ImmutableMultimap.of("123", new DynamicFilterPlaceholder("123", new VariableReferenceExpression(Optional.empty(), "a", INTEGER), EQUAL)), ImmutableMap.of("123", 0), 2);
assertEquals(filter.getBuildChannels(), ImmutableMap.of("123", 0));
Consumer<TupleDomain<String>> consumer = filter.getTupleDomainConsumer();
ListenableFuture<TupleDomain<VariableReferenceExpression>> result = filter.getResultFuture();
assertFalse(result.isDone());
consumer.accept(TupleDomain.withColumnDomains(ImmutableMap.of("123", Domain.singleValue(INTEGER, 10L))));
assertFalse(result.isDone());
consumer.accept(TupleDomain.withColumnDomains(ImmutableMap.of("123", Domain.singleValue(INTEGER, 20L))));
assertEquals(result.get(), TupleDomain.withColumnDomains(ImmutableMap.of(new VariableReferenceExpression(Optional.empty(), "a", INTEGER), Domain.multipleValues(INTEGER, ImmutableList.of(10L, 20L)))));
}
use of com.facebook.presto.expressions.DynamicFilters.DynamicFilterPlaceholder in project presto by prestodb.
the class TestLocalDynamicFilter method testMultipleProbeVariables.
@Test
public void testMultipleProbeVariables() throws ExecutionException, InterruptedException {
LocalDynamicFilter filter = new LocalDynamicFilter(ImmutableMultimap.of("123", new DynamicFilterPlaceholder("123", new VariableReferenceExpression(Optional.empty(), "a1", INTEGER), EQUAL), "123", new DynamicFilterPlaceholder("123", new VariableReferenceExpression(Optional.empty(), "a2", INTEGER), EQUAL)), ImmutableMap.of("123", 0), 1);
assertEquals(filter.getBuildChannels(), ImmutableMap.of("123", 0));
Consumer<TupleDomain<String>> consumer = filter.getTupleDomainConsumer();
ListenableFuture<TupleDomain<VariableReferenceExpression>> result = filter.getResultFuture();
assertFalse(result.isDone());
consumer.accept(TupleDomain.withColumnDomains(ImmutableMap.of("123", Domain.singleValue(INTEGER, 7L))));
assertEquals(result.get(), TupleDomain.withColumnDomains(ImmutableMap.of(new VariableReferenceExpression(Optional.empty(), "a1", INTEGER), Domain.singleValue(INTEGER, 7L), new VariableReferenceExpression(Optional.empty(), "a2", INTEGER), Domain.singleValue(INTEGER, 7L))));
}
use of com.facebook.presto.expressions.DynamicFilters.DynamicFilterPlaceholder in project presto by prestodb.
the class TestLocalDynamicFilter method testNone.
@Test
public void testNone() throws ExecutionException, InterruptedException {
LocalDynamicFilter filter = new LocalDynamicFilter(ImmutableMultimap.of("123", new DynamicFilterPlaceholder("123", new VariableReferenceExpression(Optional.empty(), "a", INTEGER), EQUAL)), ImmutableMap.of("123", 0), 1);
assertEquals(filter.getBuildChannels(), ImmutableMap.of("123", 0));
Consumer<TupleDomain<String>> consumer = filter.getTupleDomainConsumer();
ListenableFuture<TupleDomain<VariableReferenceExpression>> result = filter.getResultFuture();
assertFalse(result.isDone());
consumer.accept(TupleDomain.withColumnDomains(ImmutableMap.of("123", Domain.none(INTEGER))));
assertEquals(result.get(), TupleDomain.withColumnDomains(ImmutableMap.of(new VariableReferenceExpression(Optional.empty(), "a", INTEGER), Domain.none(INTEGER))));
}
Aggregations