Skip to content

Commit 43028e4

Browse files
Willem Pienaarachals
authored andcommitted
Add Redis Online Read Test
Signed-off-by: Felix Wang <wangfelix98@gmail.com> Signed-off-by: Achal Shah <achals@gmail.com>
1 parent bd17fbf commit 43028e4

11 files changed

Lines changed: 73 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ dmypy.json
186186
sdk/python/docs/html
187187
sdk/python/feast/protos/
188188
sdk/go/protos/
189+
go/protos/
189190

190191
#benchmarks
191192
.benchmarks

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ install-go-ci-dependencies:
124124
go get -u golang.org/x/lint/golint
125125

126126
compile-protos-go:
127-
$(foreach dir,types serving core storage,cd ${ROOT_DIR}/protos; protoc -I/usr/local/include -I. --go_out=plugins=grpc,paths=source_relative:../go/protos feast/$(dir)/*.proto;)
127+
$(foreach dir,types serving core storage,cd ${ROOT_DIR}/protos; protoc -I/usr/local/include -I. --go-grpc_out=paths=source_relative:../go/protos --go_out=paths=source_relative:../go/protos feast/$(dir)/*.proto;)
128128

129129
test-go:
130130
go test ./...

go/feast/redisonlinestore_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package feast
22

33
import (
4+
"github.com/feast-dev/feast/go/protos/feast/serving"
5+
"github.com/feast-dev/feast/go/protos/feast/types"
46
"github.com/stretchr/testify/assert"
57
"testing"
68
)
@@ -85,3 +87,39 @@ func TestNewRedisOnlineStore6(t *testing.T) {
8587
_, err := NewRedisOnlineStore("feature_repo", onlineStoreConfig)
8688
assert.NotNil(t, err)
8789
}
90+
91+
func TestRedisOnlineStoreRead(t *testing.T) {
92+
onlineStoreConfig := map[string]interface{}{
93+
"type": "redis",
94+
"connection_string": "localhost:6379",
95+
}
96+
// TODO (woop): Add setup/teardown
97+
// TODO (woop): Remove hardcoded values
98+
r, err := NewRedisOnlineStore("test_repo", onlineStoreConfig)
99+
100+
keys := []types.EntityKey{
101+
{
102+
JoinKeys: []string{"driver_id", "driver_id"},
103+
EntityValues: []*types.Value{
104+
{
105+
Val: &types.Value_Int64Val{Int64Val: 1001},
106+
},
107+
{
108+
Val: &types.Value_Int64Val{Int64Val: 1004},
109+
},
110+
},
111+
},
112+
}
113+
refs := []serving.FeatureReferenceV2{
114+
{
115+
FeatureViewName: "driver_hourly_stats",
116+
FeatureName: "acc_rate",
117+
},
118+
{
119+
FeatureViewName: "driver_hourly_stats",
120+
FeatureName: "acc_rate",
121+
},
122+
}
123+
r.OnlineRead(keys, refs)
124+
assert.NotNil(t, err)
125+
}
33.9 KB
Binary file not shown.

go/test_repo/data/online_store.db

16 KB
Binary file not shown.

go/test_repo/data/registry.db

447 Bytes
Binary file not shown.

go/test_repo/example.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This is an example feature definition file
2+
3+
from google.protobuf.duration_pb2 import Duration
4+
5+
from feast import Entity, Feature, FeatureView, FileSource, ValueType
6+
7+
driver_hourly_stats = FileSource(
8+
path="/Users/willem/Projects/feast/go/test_repo/data/driver_stats.parquet",
9+
event_timestamp_column="event_timestamp",
10+
created_timestamp_column="created",
11+
)
12+
13+
driver = Entity(name="driver_id", value_type=ValueType.INT64, description="driver id",)
14+
15+
driver_hourly_stats_view = FeatureView(
16+
name="driver_hourly_stats",
17+
entities=["driver_id"],
18+
ttl=Duration(seconds=86400 * 1),
19+
features=[
20+
Feature(name="conv_rate", dtype=ValueType.FLOAT),
21+
Feature(name="acc_rate", dtype=ValueType.FLOAT),
22+
Feature(name="avg_daily_trips", dtype=ValueType.INT64),
23+
],
24+
online=True,
25+
batch_source=driver_hourly_stats,
26+
tags={},
27+
)

go/test_repo/feature_store.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
project: test_repo
2+
registry: data/registry.db
3+
provider: local
4+
online_store:
5+
type: redis
6+
connection_string: "localhost:6379"
15.3 MB
Binary file not shown.
15.4 MB
Binary file not shown.

0 commit comments

Comments
 (0)