-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathfeatureviewprojection.go
More file actions
41 lines (35 loc) · 1.03 KB
/
featureviewprojection.go
File metadata and controls
41 lines (35 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package model
import (
"github.com/feast-dev/feast/go/protos/feast/core"
)
type FeatureViewProjection struct {
Name string
NameAlias string
Features []*Field
JoinKeyMap map[string]string
}
func (fv *FeatureViewProjection) NameToUse() string {
if len(fv.NameAlias) == 0 {
return fv.Name
}
return fv.NameAlias
}
func NewFeatureViewProjectionFromProto(proto *core.FeatureViewProjection) *FeatureViewProjection {
featureProjection := &FeatureViewProjection{Name: proto.FeatureViewName,
NameAlias: proto.FeatureViewNameAlias,
JoinKeyMap: proto.JoinKeyMap,
}
features := make([]*Field, len(proto.FeatureColumns))
for index, featureSpecV2 := range proto.FeatureColumns {
features[index] = NewFieldFromProto(featureSpecV2)
}
featureProjection.Features = features
return featureProjection
}
func NewFeatureViewProjectionFromDefinition(base *BaseFeatureView) *FeatureViewProjection {
return &FeatureViewProjection{Name: base.Name,
NameAlias: "",
Features: base.Features,
JoinKeyMap: make(map[string]string),
}
}