Search in sources :

Example 6 with DisplayDataEvaluator

use of org.apache.beam.sdk.transforms.display.DisplayDataEvaluator in project beam by apache.

the class DatastoreV1Test method testDeleteKeyPrimitiveDisplayData.

@Test
public void testDeleteKeyPrimitiveDisplayData() {
    DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
    PTransform<PCollection<Key>, ?> write = DatastoreIO.v1().deleteKey().withProjectId("myProject");
    Set<DisplayData> displayData = evaluator.displayDataForPrimitiveTransforms(write);
    assertThat("DatastoreIO write should include the project in its primitive display data", displayData, hasItem(hasDisplayItem("projectId")));
    assertThat("DatastoreIO write should include the deleteKeyFn in its primitive display data", displayData, hasItem(hasDisplayItem("deleteKeyFn")));
}
Also used : PCollection(org.apache.beam.sdk.values.PCollection) DisplayDataEvaluator(org.apache.beam.sdk.transforms.display.DisplayDataEvaluator) DisplayData(org.apache.beam.sdk.transforms.display.DisplayData) Test(org.junit.Test)

Example 7 with DisplayDataEvaluator

use of org.apache.beam.sdk.transforms.display.DisplayDataEvaluator in project beam by apache.

the class CombineTest method testCombinePerKeyWithHotKeyFanoutPrimitiveDisplayData.

@Test
@Category(ValidatesRunner.class)
public void testCombinePerKeyWithHotKeyFanoutPrimitiveDisplayData() {
    int hotKeyFanout = 2;
    DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
    CombineTest.UniqueInts combineFn = new CombineTest.UniqueInts();
    PTransform<PCollection<KV<Integer, Integer>>, PCollection<KV<Integer, Set<Integer>>>> combine = Combine.<Integer, Integer, Set<Integer>>perKey(combineFn).withHotKeyFanout(hotKeyFanout);
    Set<DisplayData> displayData = evaluator.displayDataForPrimitiveTransforms(combine, KvCoder.of(VarIntCoder.of(), VarIntCoder.of()));
    assertThat("Combine.perKey.withHotKeyFanout should include the combineFn in its primitive " + "transform", displayData, hasItem(hasDisplayItem("combineFn", combineFn.getClass())));
    assertThat("Combine.perKey.withHotKeyFanout(int) should include the fanout in its primitive " + "transform", displayData, hasItem(hasDisplayItem("fanout", hotKeyFanout)));
}
Also used : PCollection(org.apache.beam.sdk.values.PCollection) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) HashSet(java.util.HashSet) DisplayDataEvaluator(org.apache.beam.sdk.transforms.display.DisplayDataEvaluator) DisplayData(org.apache.beam.sdk.transforms.display.DisplayData) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 8 with DisplayDataEvaluator

use of org.apache.beam.sdk.transforms.display.DisplayDataEvaluator in project beam by apache.

the class CombineTest method testCombinePerKeyPrimitiveDisplayData.

@Test
@Category(ValidatesRunner.class)
public void testCombinePerKeyPrimitiveDisplayData() {
    DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
    CombineTest.UniqueInts combineFn = new CombineTest.UniqueInts();
    PTransform<PCollection<KV<Integer, Integer>>, ? extends POutput> combine = Combine.perKey(combineFn);
    Set<DisplayData> displayData = evaluator.displayDataForPrimitiveTransforms(combine, KvCoder.of(VarIntCoder.of(), VarIntCoder.of()));
    assertThat("Combine.perKey should include the combineFn in its primitive transform", displayData, hasItem(hasDisplayItem("combineFn", combineFn.getClass())));
}
Also used : PCollection(org.apache.beam.sdk.values.PCollection) DisplayDataEvaluator(org.apache.beam.sdk.transforms.display.DisplayDataEvaluator) DisplayData(org.apache.beam.sdk.transforms.display.DisplayData) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 9 with DisplayDataEvaluator

use of org.apache.beam.sdk.transforms.display.DisplayDataEvaluator in project beam by apache.

the class PubsubIOTest method testPrimitiveWriteDisplayData.

@Test
@Category(ValidatesRunner.class)
public void testPrimitiveWriteDisplayData() {
    DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
    PubsubIO.Write<?> write = PubsubIO.writeStrings().to("projects/project/topics/topic");
    Set<DisplayData> displayData = evaluator.displayDataForPrimitiveTransforms(write);
    assertThat("PubsubIO.Write should include the topic in its primitive display data", displayData, hasItem(hasDisplayItem("topic")));
}
Also used : DisplayDataEvaluator(org.apache.beam.sdk.transforms.display.DisplayDataEvaluator) DisplayData(org.apache.beam.sdk.transforms.display.DisplayData) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 10 with DisplayDataEvaluator

use of org.apache.beam.sdk.transforms.display.DisplayDataEvaluator in project beam by apache.

the class PubsubIOTest method testPrimitiveReadDisplayData.

@Test
@Category({ ValidatesRunner.class, UsesUnboundedPCollections.class })
public void testPrimitiveReadDisplayData() {
    DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
    Set<DisplayData> displayData;
    PubsubIO.Read<String> baseRead = PubsubIO.readStrings();
    // Reading from a subscription.
    PubsubIO.Read<String> read = baseRead.fromSubscription("projects/project/subscriptions/subscription");
    displayData = evaluator.displayDataForPrimitiveSourceTransforms(read);
    assertThat("PubsubIO.Read should include the subscription in its primitive display data", displayData, hasItem(hasDisplayItem("subscription")));
    // Reading from a topic.
    read = baseRead.fromTopic("projects/project/topics/topic");
    displayData = evaluator.displayDataForPrimitiveSourceTransforms(read);
    assertThat("PubsubIO.Read should include the topic in its primitive display data", displayData, hasItem(hasDisplayItem("topic")));
}
Also used : DisplayDataEvaluator(org.apache.beam.sdk.transforms.display.DisplayDataEvaluator) DisplayData(org.apache.beam.sdk.transforms.display.DisplayData) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Aggregations

DisplayData (org.apache.beam.sdk.transforms.display.DisplayData)15 DisplayDataEvaluator (org.apache.beam.sdk.transforms.display.DisplayDataEvaluator)15 Test (org.junit.Test)14 Category (org.junit.experimental.categories.Category)7 PCollection (org.apache.beam.sdk.values.PCollection)6 RowFilter (com.google.bigtable.v2.RowFilter)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ByteString (com.google.protobuf.ByteString)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 GenericRecord (org.apache.avro.generic.GenericRecord)1 PipelineOptions (org.apache.beam.sdk.options.PipelineOptions)1 StreamingOptions (org.apache.beam.sdk.options.StreamingOptions)1 PBegin (org.apache.beam.sdk.values.PBegin)1