Skip to content

Commit

Permalink
Apply spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
zhilingc committed May 18, 2020
1 parent 73806e3 commit aaaf9e6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
public interface ImportOptions extends PipelineOptions, DataflowPipelineOptions, DirectOptions {

@Required
@Description("Default feast project to apply to incoming rows that do not specify project in its feature set reference.")
@Description(
"Default feast project to apply to incoming rows that do not specify project in its feature set reference.")
String getDefaultFeastProject();

void setDefaultFeastProject(String defaultProject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public void processElement(ProcessContext context) {
FeatureRow featureRow = context.element();
String featureSetId = stripVersion(featureRow.getFeatureSet());
featureSetId = applyDefaultProject(featureSetId);
featureRow =
featureRow.toBuilder().setFeatureSet(featureSetId).build();
featureRow = featureRow.toBuilder().setFeatureSet(featureSetId).build();
context.output(featureRow);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void shouldStripVersions() {
.setCoder(ProtoCoder.of(FeatureRow.class))
.apply(
ProcessAndValidateFeatureRows.newBuilder()
.setDefaultProject("myproject")
.setDefaultProject("myproject")
.setFailureTag(FAILURE_TAG)
.setSuccessTag(SUCCESS_TAG)
.setFeatureSetSpecs(featureSetSpecs)
Expand All @@ -173,24 +173,24 @@ public void shouldStripVersions() {
@Test
public void shouldApplyDefaultProject() {
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();
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);
Expand All @@ -204,15 +204,15 @@ public void shouldApplyDefaultProject() {
input.add(randomRow);

PCollectionTuple output =
p.apply(Create.of(input))
.setCoder(ProtoCoder.of(FeatureRow.class))
.apply(
ProcessAndValidateFeatureRows.newBuilder()
.setDefaultProject("myproject")
.setFailureTag(FAILURE_TAG)
.setSuccessTag(SUCCESS_TAG)
.setFeatureSetSpecs(featureSetSpecs)
.build());
p.apply(Create.of(input))
.setCoder(ProtoCoder.of(FeatureRow.class))
.apply(
ProcessAndValidateFeatureRows.newBuilder()
.setDefaultProject("myproject")
.setFailureTag(FAILURE_TAG)
.setSuccessTag(SUCCESS_TAG)
.setFeatureSetSpecs(featureSetSpecs)
.build());

PAssert.that(output.get(SUCCESS_TAG)).containsInAnyOrder(expected);

Expand Down Expand Up @@ -263,7 +263,7 @@ public void shouldExcludeUnregisteredFields() {
.setCoder(ProtoCoder.of(FeatureRow.class))
.apply(
ProcessAndValidateFeatureRows.newBuilder()
.setDefaultProject("myproject")
.setDefaultProject("myproject")
.setFailureTag(FAILURE_TAG)
.setSuccessTag(SUCCESS_TAG)
.setFeatureSetSpecs(featureSets)
Expand Down

0 comments on commit aaaf9e6

Please sign in to comment.