Search in sources :

Example 1 with Filter

use of org.apache.beam.sdk.extensions.euphoria.core.client.operator.Filter in project beam by apache.

the class SplitTest method testBuild_ImplicitName.

@Test
public void testBuild_ImplicitName() {
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final Split.Output<String> split = Split.of(dataset).using((UnaryPredicate<String>) what -> true).output();
    final Filter positive = (Filter) TestUtils.getProducer(split.positive());
    assertTrue(positive.getName().isPresent());
    assertEquals(Split.DEFAULT_NAME + Split.POSITIVE_FILTER_SUFFIX, positive.getName().get());
    final Filter negative = (Filter) TestUtils.getProducer(split.negative());
    assertTrue(negative.getName().isPresent());
    assertEquals(Split.DEFAULT_NAME + Split.NEGATIVE_FILTER_SUFFIX, negative.getName().get());
}
Also used : Filter(org.apache.beam.sdk.extensions.euphoria.core.client.operator.Filter) UnaryPredicate(org.apache.beam.sdk.extensions.euphoria.core.client.functional.UnaryPredicate) Test(org.junit.Test)

Example 2 with Filter

use of org.apache.beam.sdk.extensions.euphoria.core.client.operator.Filter in project beam by apache.

the class SplitTest method testBuild.

@Test
public void testBuild() {
    final String opName = "split";
    final PCollection<String> dataset = TestUtils.createMockDataset(TypeDescriptors.strings());
    final Split.Output<String> split = Split.named(opName).of(dataset).using((UnaryPredicate<String>) what -> true).output();
    final Filter positive = (Filter) TestUtils.getProducer(split.positive());
    assertNotNull(positive.getPredicate());
    final Filter negative = (Filter) TestUtils.getProducer(split.negative());
    assertNotNull(negative.getPredicate());
}
Also used : Filter(org.apache.beam.sdk.extensions.euphoria.core.client.operator.Filter) UnaryPredicate(org.apache.beam.sdk.extensions.euphoria.core.client.functional.UnaryPredicate) Test(org.junit.Test)

Aggregations

UnaryPredicate (org.apache.beam.sdk.extensions.euphoria.core.client.functional.UnaryPredicate)2 Filter (org.apache.beam.sdk.extensions.euphoria.core.client.operator.Filter)2 Test (org.junit.Test)2