diff --git a/Makefile b/Makefile index 48850ffea2..19f2d933ae 100644 --- a/Makefile +++ b/Makefile @@ -547,23 +547,28 @@ 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: @@ -571,5 +576,7 @@ build-go-docker-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 \ No newline at end of file diff --git a/go/internal/feast/onlinestore/redisonlinestore.go b/go/internal/feast/onlinestore/redisonlinestore.go index 7ad3d915bb..df47deceec 100644 --- a/go/internal/feast/onlinestore/redisonlinestore.go +++ b/go/internal/feast/onlinestore/redisonlinestore.go @@ -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() @@ -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 diff --git a/go/internal/feast/onlinestore/redisonlinestore_test.go b/go/internal/feast/onlinestore/redisonlinestore_test.go index 258ab122ab..34adee191e 100644 --- a/go/internal/feast/onlinestore/redisonlinestore_test.go +++ b/go/internal/feast/onlinestore/redisonlinestore_test.go @@ -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]) @@ -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]) diff --git a/go/internal/feast/onlinestore/sqliteonlinestore.go b/go/internal/feast/onlinestore/sqliteonlinestore.go index 6c37258e74..1f407ad39c 100644 --- a/go/internal/feast/onlinestore/sqliteonlinestore.go +++ b/go/internal/feast/onlinestore/sqliteonlinestore.go @@ -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