Skip to content

Commit

Permalink
formatting and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
tims committed Jan 27, 2019
1 parent b6e05b1 commit 301d7fc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@

import static com.google.common.base.Preconditions.checkArgument;

import java.util.Random;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.commons.codec.digest.DigestUtils;
import org.joda.time.Duration;
import feast.SerializableCache;
import feast.ingestion.model.Specs;
import feast.ingestion.util.DateUtil;
Expand All @@ -35,7 +31,10 @@
import feast.types.FeatureProto.Feature;
import feast.types.FeatureRowExtendedProto.FeatureRowExtended;
import feast.types.FeatureRowProto.FeatureRow;
import feast.types.GranularityProto.Granularity;
import java.util.Random;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.commons.codec.digest.DigestUtils;
import org.joda.time.Duration;

public class FeatureRowToRedisMutationDoFn extends DoFn<FeatureRowExtended, RedisMutation> {

Expand Down Expand Up @@ -75,7 +74,9 @@ static String getFeatureIdSha1Prefix(String featureId) {
return DigestUtils.sha1Hex(featureId.getBytes()).substring(0, 7);
}

/** Output a redis mutation object for every feature in the feature row. */
/**
* Output a redis mutation object for every feature in the feature row.
*/
@ProcessElement
public void processElement(ProcessContext context) {
FeatureRowExtended rowExtended = context.element();
Expand Down
19 changes: 2 additions & 17 deletions ingestion/src/test/java/feast/ingestion/ImportJobCSVTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,25 +224,10 @@ public void testImportCSV_withSample1() throws IOException {
PCollectionList.of(ErrorsStoreService.get(MockErrorsStore.class).getWrite().getInputs())
.apply("flatten errors input", Flatten.pCollections());

List<FeatureRow> expectedRows =
Lists.newArrayList(
normalize(
FeatureRow.newBuilder()
.setGranularity(Granularity.Enum.NONE)
.setEventTimestamp(Timestamp.getDefaultInstance())
.setEntityKey("1")
.setEntityName("testEntity")
.addFeatures(Features.of("testEntity.none.testInt32", Values.ofInt32(101)))
.addFeatures(Features.of("testEntity.none.testString", Values.ofString("a")))
.build()));

PAssert.that(writtenToServing).satisfies(hasCount(1));
PAssert.that(writtenToWarehouse).satisfies(hasCount(1));
PAssert.that(writtenToErrors).satisfies(hasCount(0));

PAssert.that(writtenToServing.apply("serving toFeatureRows", new ToOrderedFeatureRows()))
.containsInAnyOrder(expectedRows);

PAssert.that(writtenToWarehouse.apply("warehouse toFeatureRows", new ToOrderedFeatureRows()))
.containsInAnyOrder(expectedRows);
testPipeline.run();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Set;
import org.apache.beam.sdk.testing.TestPipeline;
import org.apache.beam.sdk.transforms.Create;
import org.apache.beam.sdk.values.PCollection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package feast.storage.redis;

import feast.ingestion.util.DateUtil;
import feast.storage.RedisProto.RedisBucketKey;
import org.apache.beam.sdk.testing.NeedsRunner;
import org.apache.beam.sdk.testing.TestPipeline;
import org.apache.commons.codec.digest.DigestUtils;
Expand All @@ -25,12 +27,11 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import feast.ingestion.util.DateUtil;
import feast.storage.RedisProto.RedisBucketKey;

public class FeatureRowToRedisMutationDoFnTest {

@Rule public final transient TestPipeline pipeline = TestPipeline.create();
@Rule
public final transient TestPipeline pipeline = TestPipeline.create();

@Test
public void testRedisBucketKeySize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

import static org.junit.Assert.assertEquals;

import feast.options.OptionsParser;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import feast.options.OptionsParser;

public class RedisStoreOptionsTest {

Expand Down

0 comments on commit 301d7fc

Please sign in to comment.