Skip to content

Commit

Permalink
fix: Fix few format issues.
Browse files Browse the repository at this point in the history
Signed-off-by: Shuchu Han <shuchu.han@gmail.com>
  • Loading branch information
shuchu committed Nov 29, 2024
1 parent 63dcefa commit 8e4893c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -547,29 +547,36 @@ install-go-proto-dependencies:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0

install-go-ci-dependencies:
#install-go-ci-dependencies:
# go install golang.org/x/tools/cmd/goimports
# python -m pip install "pybindgen==0.22.1" "grpcio-tools>=1.56.2,<2" "mypy-protobuf>=3.1"

build-go: compile-protos-go
build-go:
compile-protos-go
go build -o feast ./go/main.go

install-feast-ci-locally:
pip install -e ".[ci]"

test-go: compile-protos-go compile-protos-python install-feast-ci-locally
test-go:
compile-protos-go
compile-protos-python
install-feast-ci-locally
CGO_ENABLED=1 go test -coverprofile=coverage.out ./... && go tool cover -html=coverage.out -o coverage.html

format-go:
gofmt -s -w go/

lint-go: compile-protos-go
lint-go:
compile-protos-go
go vet ./go/internal/feast

build-go-docker-dev:
docker buildx build --build-arg VERSION=dev \
-t feastdev/feature-server-go:dev \
-f go/infra/docker/feature-server/Dockerfile --load .

compile-protos-go: install-go-proto-dependencies install-protoc-dependencies
compile-protos-go:
install-go-proto-dependencies
install-protoc-dependencies
python setup.py build_go_protos
4 changes: 2 additions & 2 deletions go/internal/feast/onlinestore/redisonlinestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (r *RedisOnlineStore) buildFeatureViewIndices(featureViewNames []string, fe
return featureViewIndices, indicesFeatureView, index
}

func (r *RedisOnlineStore) buildHsetKeys(featureViewNames []string, featureNames []string, indicesFeatureView map[int]string, index int) ([]string, []string) {
func (r *RedisOnlineStore) buildRedisHashSetKeys(featureViewNames []string, featureNames []string, indicesFeatureView map[int]string, index int) ([]string, []string) {
featureCount := len(featureNames)
var hsetKeys = make([]string, index)
h := murmur3.New32()
Expand Down Expand Up @@ -217,7 +217,7 @@ func (r *RedisOnlineStore) OnlineRead(ctx context.Context, entityKeys []*types.E

featureCount := len(featureNames)
featureViewIndices, indicesFeatureView, index := r.buildFeatureViewIndices(featureViewNames, featureNames)
hsetKeys, featureNamesWithTimeStamps := r.buildHsetKeys(featureViewNames, featureNames, indicesFeatureView, index)
hsetKeys, featureNamesWithTimeStamps := r.buildRedisHashSetKeys(featureViewNames, featureNames, indicesFeatureView, index)
redisKeys, redisKeyToEntityIndex, err := r.buildRedisKeys(entityKeys)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions go/internal/feast/onlinestore/redisonlinestore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ func TestBuildHsetKeys(t *testing.T) {
r := &RedisOnlineStore{}

t.Run("test with empty featureViewNames and featureNames", func(t *testing.T) {
hsetKeys, featureNames := r.buildHsetKeys([]string{}, []string{}, map[int]string{}, 0)
hsetKeys, featureNames := r.buildRedisHashSetKeys([]string{}, []string{}, map[int]string{}, 0)
assert.Equal(t, 0, len(hsetKeys))
assert.Equal(t, 0, len(featureNames))
})

t.Run("test with non-empty featureViewNames and featureNames", func(t *testing.T) {
hsetKeys, featureNames := r.buildHsetKeys([]string{"view1", "view2"}, []string{"feature1", "feature2"}, map[int]string{2: "view1", 3: "view2"}, 4)
hsetKeys, featureNames := r.buildRedisHashSetKeys([]string{"view1", "view2"}, []string{"feature1", "feature2"}, map[int]string{2: "view1", 3: "view2"}, 4)
assert.Equal(t, 4, len(hsetKeys))
assert.Equal(t, 4, len(featureNames))
assert.Equal(t, "_ts:view1", hsetKeys[2])
Expand All @@ -126,7 +126,7 @@ func TestBuildHsetKeys(t *testing.T) {
})

t.Run("test with more featureViewNames than featureNames", func(t *testing.T) {
hsetKeys, featureNames := r.buildHsetKeys([]string{"view1", "view2", "view3"}, []string{"feature1", "feature2", "feature3"}, map[int]string{3: "view1", 4: "view2", 5: "view3"}, 6)
hsetKeys, featureNames := r.buildRedisHashSetKeys([]string{"view1", "view2", "view3"}, []string{"feature1", "feature2", "feature3"}, map[int]string{3: "view1", 4: "view2", 5: "view3"}, 6)
assert.Equal(t, 6, len(hsetKeys))
assert.Equal(t, 6, len(featureNames))
assert.Equal(t, "_ts:view1", hsetKeys[3])
Expand Down
1 change: 0 additions & 1 deletion go/internal/feast/onlinestore/sqliteonlinestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func NewSqliteOnlineStore(project string, repoConfig *registry.RepoConfig, onlin
return nil, fmt.Errorf("cannot find convert sqlite path to string %s", db_path)
} else {
store.path = fmt.Sprintf("%s/%s", repoConfig.RepoPath, dbPathStr)

db, err := initializeConnection(store.path)
if err != nil {
return nil, err
Expand Down

0 comments on commit 8e4893c

Please sign in to comment.