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> featureIds,
List<Row> rows)
Get online features from Feast.
|
List<Row> |
getOnlineFeatures(List<String> featureIds,
List<Row> rows,
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> featureIds, List<Row> rows)
public List<Row> getOnlineFeatures(List<String> featureIds, List<Row> rows, boolean omitEntitiesInResponse)
Example of retrieving online features for driver feature set, version 1, with features driver_id and driver_name
FeastClient client = FeastClient.create("localhost", 6566);
List<String> requestedFeatureIds = Arrays.asList("driver:1:driver_id", "driver:1:driver_name");
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);
featureIds
- list of feature id to retrieve, feature id follows this format
[feature_set_name]:[version]:[feature_name]rows
- list of Row
to select the entities to retrieve the features foromitEntitiesInResponse
- 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.