graph

package
v1.2.96 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Days

func Days(n int64) time.Duration

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 MaybeStr

func MaybeStr(s string) *string

func Minutes

func Minutes(n int64) time.Duration

func Primitive

func Primitive(name string) *graphv1.FeatureRichTypeInfo

func Seconds

func Seconds(n int64) time.Duration

Duration helper functions

func Weeks

func Weeks(n int64) time.Duration

Types

type Definitions

type Definitions struct {
	FeatureSets []*FeatureSet
}

func (Definitions) ToGraph

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

func (Definitions) WithFeatureSets

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

type FeatureBuilder

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

func DataFrame

func DataFrame(foreignName string) FeatureBuilder

type FeatureSet

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

func (*FeatureSet) ToProto

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

func (FeatureSet) With

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

func (FeatureSet) WithForeignKey

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

func (FeatureSet) WithPrimary

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

type HasManyFeatureBuilder

type HasManyFeatureBuilder struct {
	ForeignNamespace string
}

func (*HasManyFeatureBuilder) ToProtos

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

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)
	GroupBy []*graphv1.FeatureReference
	// The 'k' arg of approx_top_k.
	ApproxTopKArgK int64
	Filters        []expr.Expr
	// 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 ScalarFeatureBuilder

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

func Datetime

func Datetime() *ScalarFeatureBuilder

func Float

func Float() *ScalarFeatureBuilder

func Int

func Int() *ScalarFeatureBuilder

func String

func String() *ScalarFeatureBuilder

func (ScalarFeatureBuilder) Expr

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

func (ScalarFeatureBuilder) ToProto

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

func (ScalarFeatureBuilder) ToProtos

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

type WindowedFeatureBuilder

type WindowedFeatureBuilder struct {
	Default         expr.Expr
	Expression      expr.Expr
	Materialization MaterializationOptions
	// contains filtered or unexported fields
}

func Windowed

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

func (*WindowedFeatureBuilder) ToProtos

func (w *WindowedFeatureBuilder) ToProtos(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

Jump to

Keyboard shortcuts

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