@Test public void shouldStripVersions() { FeatureSetSpec fs1 = FeatureSetSpec.newBuilder() .setName("feature_set") .setProject("myproject") .addEntities( EntitySpec.newBuilder() .setName("entity_id_primary") .setValueType(Enum.INT32) .build()) .addEntities( EntitySpec.newBuilder() .setName("entity_id_secondary") .setValueType(Enum.STRING) .build()) .addFeatures( FeatureSpec.newBuilder().setName("feature_1").setValueType(Enum.STRING).build()) .addFeatures( FeatureSpec.newBuilder().setName("feature_2").setValueType(Enum.INT64).build()) .build(); Map<String, FeatureSetSpec> featureSetSpecs = new HashMap<>(); featureSetSpecs.put("myproject/feature_set", fs1); List<FeatureRow> input = new ArrayList<>(); List<FeatureRow> expected = new ArrayList<>(); FeatureRow randomRow = TestUtil.createRandomFeatureRow(fs1); expected.add(randomRow); randomRow = randomRow.toBuilder().setFeatureSet("myproject/feature_set:1").build(); input.add(randomRow); PCollectionView<Map<String, Iterable<FeatureSetSpec>>> specsView = p.apply("StaticSpecs", Create.of(featureSetSpecs)).apply(View.asMultimap()); PCollectionTuple output = p.apply(Create.of(input)) .setCoder(ProtoCoder.of(FeatureRow.class)) .apply( ProcessAndValidateFeatureRows.newBuilder() .setDefaultProject("myproject") .setFailureTag(FAILURE_TAG) .setSuccessTag(SUCCESS_TAG) .setFeatureSetSpecs(specsView) .build()); PAssert.that(output.get(SUCCESS_TAG)).containsInAnyOrder(expected); p.run(); }
public static Builder newBuilder() { return new AutoValue_ProcessAndValidateFeatureRows.Builder(); }
ProcessAndValidateFeatureRows extends PTransform<PCollection<FeatureRow>, PCollectionTuple> { public static Builder newBuilder() { return new AutoValue_ProcessAndValidateFeatureRows.Builder(); } }
ProcessAndValidateFeatureRows extends PTransform<PCollection<FeatureRow>, PCollectionTuple> { public static Builder newBuilder() { return new AutoValue_ProcessAndValidateFeatureRows.Builder(); }  }
ProcessAndValidateFeatureRows extends PTransform<PCollection<FeatureRow>, PCollectionTuple> { public static Builder newBuilder() { return new AutoValue_ProcessAndValidateFeatureRows.Builder(); }  abstract PCollectionView<Map<String, Iterable<FeatureSetProto.FeatureSetSpec>>> getFeatureSetSpecs(); abstract String getDefaultProject(); abstract TupleTag<FeatureRow> getSuccessTag(); abstract TupleTag<FailedElement> getFailureTag(); static Builder newBuilder(); @Override PCollectionTuple expand(PCollection<FeatureRow> input); }
ProcessAndValidateFeatureRows extends PTransform<PCollection<FeatureRow>, PCollectionTuple> { public static Builder newBuilder() { return new AutoValue_ProcessAndValidateFeatureRows.Builder(); }  abstract PCollectionView<Map<String, Iterable<FeatureSetProto.FeatureSetSpec>>> getFeatureSetSpecs(); abstract String getDefaultProject(); abstract TupleTag<FeatureRow> getSuccessTag(); abstract TupleTag<FailedElement> getFailureTag(); static Builder newBuilder(); @Override PCollectionTuple expand(PCollection<FeatureRow> input);  }