Do not include transactions with zero unit price in invoice

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215611195
This commit is contained in:
jianglai 2018-10-03 12:57:33 -07:00 committed by Ben McIlwain
parent 4a9b715020
commit e3a35f0aa0
2 changed files with 3 additions and 3 deletions

View file

@ -34,6 +34,7 @@ import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.options.ValueProvider;
import org.apache.beam.sdk.options.ValueProvider.NestedValueProvider;
import org.apache.beam.sdk.transforms.Count;
import org.apache.beam.sdk.transforms.Filter;
import org.apache.beam.sdk.transforms.MapElements;
import org.apache.beam.sdk.transforms.PTransform;
import org.apache.beam.sdk.values.KV;
@ -141,6 +142,7 @@ public class InvoicingPipeline implements Serializable {
"Map to invoicing key",
MapElements.into(TypeDescriptor.of(InvoiceGroupingKey.class))
.via(BillingEvent::getInvoiceGroupingKey))
.apply(Filter.by((InvoiceGroupingKey key) -> key.unitPrice() != 0))
.setCoder(new InvoiceGroupingKeyCoder())
.apply("Count occurrences", Count.perElement())
.apply(