feast-dev / feast

The Open Source Feature Store for Machine Learning
https://feast.dev
Apache License 2.0
5.58k stars 996 forks source link

Java SDK online feature retrieval reports error #768

Closed venkat1m closed 4 years ago

venkat1m commented 4 years ago

I am testing a java program to fetch the online features. I used the basic sample notebook to create the customer_transactions feature set and injest data into redis. The online feature fetch from the notebook works fine.

Expected Behavior

Java SDK to retrieve features from online store was working with 0.4.7 version. The program was executed against the latest docker containers.

Current Behavior

After upgrading to 0.5.0 jar, the API fails with this error stack.

Exception in thread "main" java.lang.IllegalArgumentException: Type 'feast.proto.types.ValueProto.Value' is unsupported in Feast. Please use one of these value types: Integer, Long, Float, Double, String, byte[]. at com.gojek.feast.Row.set(Row.java:84) at com.gojek.feast.FeastClient.lambda$getOnlineFeatures$1(FeastClient.java:157) at java.base/java.util.Map.forEach(Map.java:661) at java.base/java.util.Collections$UnmodifiableMap.forEach(Collections.java:1505) at com.gojek.feast.FeastClient.lambda$getOnlineFeatures$2(FeastClient.java:149) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at com.gojek.feast.FeastClient.getOnlineFeatures(FeastClient.java:161) at com.gojek.feast.FeastClient.getOnlineFeatures(FeastClient.java:90)

Steps to reproduce

Create a java client with the following main()

public static void main(String[] args) {
    //Connect to the feast online serving store
    FeastClient client = FeastClient.create("localhost", 6566);
    //Create the feature references to query
    List<String> featureReferences = Arrays.asList("customer_transactions:daily_transactions", "customer_transactions:total_transactions");
    //Define the query/entity predicate
    List<Row> requestedRows = Arrays.asList(Row.create().set("customer_id", (long)1001));
    //Execute the query and display output
    List<Row> rows = client.getOnlineFeatures(featureReferences, requestedRows, "customer_project");
    rows.forEach(System.out::println);
}

Specifications

Client code has these dependencies.

    <dependency>
        <groupId>dev.feast</groupId>
        <artifactId>feast-sdk</artifactId>
        <version>0.5.0</version>
    </dependency>

    <dependency>
        <groupId>dev.feast</groupId>
        <artifactId>datatypes-java</artifactId>
        <version>0.5.0</version>
    </dependency>

REPOSITORY TAG IMAGE ID CREATED SIZE gcr.io/kf-feast/feast-serving latest 5bdb1e2efe21 2 weeks ago 322MB gcr.io/kf-feast/feast-core latest c76e6e2db005 2 weeks ago 719MB postgres 12-alpine bd3eeea38a5a 2 weeks ago 151MB redis 5-alpine 3661c84ee9d0 5 weeks ago 29.8MB jupyter/minimal-notebook 619e9cc2fc07 bd466ef7da5f 6 weeks ago 2.52GB confluentinc/cp-kafka 5.2.1 af7cf4356c58 14 months ago 569MB confluentinc/cp-zookeeper 5.2.1 d5f580efa9be 14 months ago 569MB

Possible Solution

venkat1m commented 4 years ago

I traced the issue to the Row.set method and the fact the class name for the Value object was changed from feast.types.ValueProto.Value to feast.proto.types.ValueProto.Value. But the 0.5.0 code was still referring to the old class name hence the exception.

I also see that this issue has been addressed in the latest master branch (0.6 snapshot) I can try to workaround by using the code from the master branch or rebuild 0.5.0 branch with the fix.

venkat1m commented 4 years ago

I'll close this issue. I was able to switch 0.6-SNAPSHOT and get it working. For those using the 0.5.0 jar from maven central repo, this is a workaround.