Skip to content

Commit e024cb3

Browse files
Ly Caoachals
authored andcommitted
first go server clean version, keep python functions. Next commit will diverge from python function calls for more optimized calls
Signed-off-by: Felix Wang <wangfelix98@gmail.com> Signed-off-by: Achal Shah <achals@gmail.com>
1 parent 74e39b6 commit e024cb3

20 files changed

Lines changed: 776 additions & 696 deletions

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ test-python-universal-local:
7878
test-python-universal:
7979
FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration --universal sdk/python/tests
8080

81+
test-python-universal-go-server:
82+
FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration --universal --noodfv sdk/python/tests
83+
8184
format-python:
8285
# Sort
8386
cd ${ROOT_DIR}/sdk/python; python -m isort feast/ tests/

go/feast/basefeatureview.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ import (
88

99
type BaseFeatureView struct {
1010
name string
11-
features []*core.FeatureSpecV2
11+
features []*Feature
1212
projection *FeatureViewProjection
1313
}
1414

15-
func NewBaseFeatureView(name string, features []*core.FeatureSpecV2) *BaseFeatureView {
16-
base := &BaseFeatureView{name: name, features: features}
15+
func NewBaseFeatureView(name string, featureProtos []*core.FeatureSpecV2) *BaseFeatureView {
16+
base := &BaseFeatureView{name: name}
17+
features := make([]*Feature, len(featureProtos))
18+
for index, featureSpecV2 := range featureProtos {
19+
features[index] = NewFeatureFromProto(featureSpecV2)
20+
}
21+
base.features = features
1722
base.projection = NewFeatureViewProjectionFromDefinition(base)
1823
return base
1924
}
@@ -26,12 +31,12 @@ func (fv *BaseFeatureView) withProjection(projection *FeatureViewProjection) (*B
2631
}
2732
features := make(map[string]bool)
2833
for _, feature := range fv.features {
29-
features[feature.Name] = true
34+
features[feature.name] = true
3035
}
3136
for _, feature := range projection.features {
32-
if _, ok := features[feature.Name]; !ok {
37+
if _, ok := features[feature.name]; !ok {
3338
return nil, errors.New(fmt.Sprintf("The projection for %s cannot be applied because it contains %s which the " +
34-
"FeatureView doesn't have.", projection.name, feature.Name))
39+
"FeatureView doesn't have.", projection.name, feature.name))
3540
}
3641
}
3742
return &BaseFeatureView{name: fv.name, features: fv.features, projection: projection}, nil

go/feast/connector.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
)
1111

1212
func getOnlineStore(config *RepoConfig) (OnlineStore, error) {
13-
fmt.Println(config == nil)
1413
onlineStoreType, ok := getOnlineStoreType(config.OnlineStore)
1514
if !ok {
1615
return nil, errors.New(fmt.Sprintf("could not get online store type from online store config: %+v", config.OnlineStore))

go/feast/feature.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package feast
2+
3+
import (
4+
"github.com/feast-dev/feast/go/protos/feast/types"
5+
"github.com/feast-dev/feast/go/protos/feast/core"
6+
)
7+
8+
type Feature struct {
9+
name string
10+
dtype types.ValueType_Enum
11+
}
12+
13+
func NewFeatureFromProto(proto *core.FeatureSpecV2) *Feature {
14+
return &Feature { name: proto.Name,
15+
dtype: proto.ValueType,
16+
}
17+
}

0 commit comments

Comments
 (0)