public class FeastClient extends Object implements AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
close() |
static FeastClient |
create(String host,
int port)
Create a client to access Feast
|
ServingAPIProto.GetFeastServingInfoResponse |
getFeastServingInfo() |
List<Row> |
getOnlineFeatures(List<String> features,
List<Row> rows,
String defaultProject)
Get online features from Feast.
|
List<Row> |
getOnlineFeatures(List<String> featureRefStrings,
List<Row> rows,
String defaultProject,
boolean omitEntitiesInResponse)
Get online features from Feast.
|
public static FeastClient create(String host, int port)
host
- hostname or ip address of Feast serving GRPC serverport
- port number of Feast serving GRPC serverFeastClient
public ServingAPIProto.GetFeastServingInfoResponse getFeastServingInfo()
public List<Row> getOnlineFeatures(List<String> features, List<Row> rows, String defaultProject)
features
- list of string feature references to retrieve, feature reference follows this
format [project]/[name]:[version]rows
- list of Row
to select the entities to retrieve the features fordefaultProject
- String
Default project to find features in if not provided in
feature reference.Row
containing featurespublic List<Row> getOnlineFeatures(List<String> featureRefStrings, List<Row> rows, String defaultProject, boolean omitEntitiesInResponse)
Example of retrieving online features for the driver project, with features driver_id and driver_name, both version 1
FeastClient client = FeastClient.create("localhost", 6566);
List<String> requestedFeatureIds = Arrays.asList("driver/driver_id:1", "driver/driver_name:1");
List<Row> requestedRows =
Arrays.asList(Row.create().set("driver_id", 123), Row.create().set("driver_id", 456));
List<Row> retrievedFeatures = client.getOnlineFeatures(requestedFeatureIds, requestedRows);
retrievedFeatures.forEach(System.out::println);
featureRefStrings
- list of feature refs to retrieve, feature refs follow this format
[project]/[name]:[version]rows
- list of Row
to select the entities to retrieve the features fordefaultProject
- String
Default project to find features in if not provided in
feature reference.omitEntitiesInResponse
- if true, the returned Row
will not contain field and
value for the entityRow
containing featurespublic void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2020 Gojek. All rights reserved.