graph

package
v1.2.111 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Boolean = primitive("bool")
View Source
var CENTURY = durationpb.Duration{Seconds: 3153600000}
View Source
var Datetime = primitive("datetime")
View Source
var Empty struct{}

zero size type to define hashset

View Source
var Float = primitive("float")
View Source
var Int = primitive("int")
View Source
var String = primitive("str")
View Source
var TRUE = true

Functions

func Days

func Days(n int64) time.Duration

func FeatureName added in v1.2.109

func FeatureName(f *graphv1.FeatureType) string

func GetDefault

func GetDefault[M ~map[K]V, K comparable, V any](m M, k K, def V) V

func Hours

func Hours(n int64) time.Duration

func Minutes

func Minutes(n int64) time.Duration

func Seconds

func Seconds(n int64) time.Duration

Duration helper functions

func TypeName added in v1.2.110

func TypeName(scalar *graphv1.ScalarFeatureType) string

func Weeks

func Weeks(n int64) time.Duration

func Years added in v1.2.109

func Years(n int64) time.Duration

Types

type Definitions

type Definitions struct {
	FeatureSets []*FeatureSet
}

func (Definitions) ToGraph

func (d Definitions) ToGraph() (*graphv1.Graph, error)

func (Definitions) UpdateGraph added in v1.2.110

func (d Definitions) UpdateGraph(g *graphv1.Graph) error

func (Definitions) WithFeatureSets

func (d Definitions) WithFeatureSets(fs ...FeatureSet) Definitions

type FeatureBuilder

type FeatureBuilder interface {
	AppendFeatures([]*graphv1.FeatureType, string, string) ([]*graphv1.FeatureType, error)
}

type FeatureSet

type FeatureSet struct {
	// metadata fields
	Name               string
	Features           []*graphv1.FeatureType
	IsSingleton        bool
	Tags               []string
	Owner              string
	Doc                string
	EtlOfflineToOnline bool
	MaxStaleness       time.Duration
	// contains filtered or unexported fields
}

func (*FeatureSet) ToProto

func (fs *FeatureSet) ToProto() (*graphv1.FeatureSet, error)

func (FeatureSet) With

func (fs FeatureSet) With(name string, ofType FeatureBuilder) FeatureSet

func (FeatureSet) WithAll added in v1.2.110

func (fs FeatureSet) WithAll(m Features) FeatureSet

func (FeatureSet) WithForeignKey

func (fs FeatureSet) WithForeignKey(name, relation string) FeatureSet

func (FeatureSet) WithPrimary

func (fs FeatureSet) WithPrimary(name string, ofType FeatureBuilder) FeatureSet

type Features added in v1.2.110

type Features map[string]FeatureBuilder

type HasManyFeatureBuilder

type HasManyFeatureBuilder struct {
	ForeignNamespace string
	MaxStaleness     time.Duration
}

func DataFrame

func DataFrame(foreignName string) *HasManyFeatureBuilder

func (*HasManyFeatureBuilder) AppendFeatures added in v1.2.109

func (hm *HasManyFeatureBuilder) AppendFeatures(features []*graphv1.FeatureType, fieldName, namespace string) ([]*graphv1.FeatureType, error)

func (*HasManyFeatureBuilder) WithMaxStaleness added in v1.2.109

func (hm *HasManyFeatureBuilder) WithMaxStaleness(d time.Duration) *HasManyFeatureBuilder

type MaterializationOptions

type MaterializationOptions struct {
	// map window -> bucket duration
	// NOTE: OPPOSITE ORDER AS chalkpy if construction is being done via struct
	BucketDurations       map[time.Duration]time.Duration
	DefaultBucketDuration time.Duration
	// The period for which to use the continuous resolver, instead
	// of relying upon the last backfill. If not provided, and a continuous
	// resolver is provided, this will be set to backfill_lookback_duration.
	ContinuousBufferDuration time.Duration
	// A crontab or duration string to specify the schedule for back filling the
	// materialized aggregate.
	BackfillSchedule string
	// The lower bound of the first bucket. All buckets are aligned to this time.
	BucketStart time.Time

	// technically not part of materialization kwarg, but still useful to expose (for now)
	// The 'k' arg of approx_top_k.
	ApproxTopKArgK int64
	// The resolver to use for back-filling the materialized aggregate.
	// If not provided, the data will be back filled using the resolver
	// that would run for an offline query.
	BackfillResolver string
	// The amount of time before the start of the previous backfill
	// to consider when running the backfill resolver. Set this parameter
	// to the be equal to the latest arriving data in the backfill window.
	BackfillLookbackDuration time.Duration
	// The time at which to start back filling the materialized aggregate.
	// If not provided, the backfill consider the earliest available data returned
	// by the `backfill_resolver`.
	BackfillStartTime time.Time
	// The resolver to use for continuous updates to the materialized aggregate.
	// If not provided, the data will be updated using the resolver that would run
	// for an online query.
	ContinuousResolver string
}

https://docs.chalk.ai/api-docs#windowed.materialization

type ParsedAggregation added in v1.2.109

type ParsedAggregation struct {
	// contains filtered or unexported fields
}

type ScalarFeatureBuilder

type ScalarFeatureBuilder struct {
	// contains filtered or unexported fields
}

func (ScalarFeatureBuilder) AppendFeatures added in v1.2.109

func (f ScalarFeatureBuilder) AppendFeatures(features []*graphv1.FeatureType, fieldName string, namespace string) ([]*graphv1.FeatureType, error)

func (ScalarFeatureBuilder) Expr

func (ofType ScalarFeatureBuilder) Expr(expression expr.Expr) ScalarFeatureBuilder

func (ScalarFeatureBuilder) ToProto

func (f ScalarFeatureBuilder) ToProto(fieldName string, namespace string) *graphv1.FeatureType

func (ScalarFeatureBuilder) WithMaxStaleness added in v1.2.109

type WindowedFeatureBuilder

type WindowedFeatureBuilder struct {
	Default      expr.Expr
	Expression   expr.Expr
	MaxStaleness time.Duration

	Materialization MaterializationOptions
	// contains filtered or unexported fields
}

func Windowed

func Windowed(ofType FeatureBuilder, windows ...time.Duration) *WindowedFeatureBuilder

func (*WindowedFeatureBuilder) AppendFeatures added in v1.2.109

func (w *WindowedFeatureBuilder) AppendFeatures(features []*graphv1.FeatureType, fieldName string, namespace string) ([]*graphv1.FeatureType, error)

func (*WindowedFeatureBuilder) WithBucketDuration

func (w *WindowedFeatureBuilder) WithBucketDuration(duration time.Duration) *WindowedFeatureBuilder

func (*WindowedFeatureBuilder) WithDefault

func (w *WindowedFeatureBuilder) WithDefault(expression expr.Expr) *WindowedFeatureBuilder

func (*WindowedFeatureBuilder) WithDurationForWindows

func (w *WindowedFeatureBuilder) WithDurationForWindows(duration time.Duration, windows ...time.Duration) *WindowedFeatureBuilder

func (*WindowedFeatureBuilder) WithExpr

func (w *WindowedFeatureBuilder) WithExpr(expression expr.Expr) *WindowedFeatureBuilder

func (*WindowedFeatureBuilder) WithMaterialization

NOTE: this will override all previous materialization settings (WithBucketDuration,WithDurationForWindows)

func (*WindowedFeatureBuilder) WithMaxStaleness added in v1.2.109

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL