fieldaccept

package
v1.0.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package fieldaccept is the ONE accepted-field-types table: for each built-in operator slot that reads a field's value, the field types it accepts and the coded refusal it raises for any other type.

Both sides read it. The runtime constructors in internal/processing (window application, the features, the regression build, the tier-1 test constructors, the numeric aggregators' registry wrapper) refuse with Refusal / Check, and predict (internal/descriptor) reports the very same *errors.CodedError at the same slot, so the two agree on code, message, details and count by construction. The manifest's accepts_types for a tabled slot is TypeNames (or, where noted, a subset of it), so the declaration cannot drift from the rule either.

Every row refuses with a code that says what it means: PULSE_FIELD_TYPE_UNSUPPORTED for "this slot does not read that type", PULSE_TEST_FIELD_NOT_NUMERIC / _FIELD2_ for a tier-1 test's field. A few constructors (the set_* refusals of the aggregator / attribute / grouper / filterer families) keep their own message, which names only the operators the instance offers, but raise the row's code; predict reports that code once per slot from here, and the root acceptance gate holds each row equal to its constructor over every field type.

The decimal rule runs before any row: a decimal128 field on a built-in aggregator with no decimal arm (outside DecimalAggregators) is PULSE_AGG_NOT_MEANINGFUL_FOR_DECIMAL.

It is a leaf: it imports only the public errors / encoding / types packages, never internal/processing or internal/service, so internal/descriptor may import it without breaking TestPredictNoExecutionImports.

Only built-in operators are tabled. An extension operator declares its accepted types through its registration's capability (accepts_types) and is never looked up here: Lookup misses for it, and every helper answers "no rule" (accept).

A vector field (vec_f32 / vec_f64) is never refused here: every slot that reads one value refuses a vector with PULSE_VECTOR_FIELD_NOT_SCALAR through the field-reference walk, first, and a second type refusal would only repeat it. TypeNames never lists a vector type for a tabled slot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accepts

func Accepts(op string, slot Slot, ft encoding.FieldType) bool

Accepts reports whether op's slot accepts ft: the decimal rule first (a decimal128 field on a built-in aggregator with no decimal arm), then the slot's row. An untabled slot and a vector type (the field-reference walk's refusal) answer true.

func Check

func Check(op string, slot Slot, field string, schema *encoding.Schema) *errors.CodedError

Check is Refusal for a field named in a request: nil when the schema has no such field (an unknown name is the field-reference walk's refusal; a derived column carries no schema type) or the slot accepts it.

func DecimalAggregators

func DecimalAggregators() []string

DecimalAggregators returns the built-in aggregators with a decimal128 implementation, sorted.

func HasDecimalArm

func HasDecimalArm(op string) bool

HasDecimalArm reports whether the built-in aggregator op has a decimal128 implementation.

func Operators

func Operators() []string

Operators returns every tabled operator name, sorted.

func OperatorsRaising

func OperatorsRaising(code errors.Code) []string

OperatorsRaising returns every tabled operator with a slot whose refusal carries code, sorted — the owner list of that code.

func Refusal

func Refusal(op string, slot Slot, field string, ft encoding.FieldType) *errors.CodedError

Refusal is the coded refusal for a field named field, of type ft, in op's slot — nil when the slot accepts it (Accepts). Message, code and details are the same on every side that raises it.

func TypeNames

func TypeNames(op string, slot Slot) []string

TypeNames returns the names of every registered field type op's slot accepts, sorted byte-wise (the manifest's accepts_types order); nil for an untabled slot. Vector types are never listed. The slice is shared (capacity clipped, so an append copies): callers must not modify it in place.

Types

type Rule

type Rule struct {
	// Accepts reports whether the slot accepts a field of type ft.
	Accepts func(ft encoding.FieldType) bool
	// Code is the refusal's code for any other (non-vector) type.
	Code errors.Code
}

Rule is one tabled slot: the accepted types and the refusal code.

func Lookup

func Lookup(op string, slot Slot) (Rule, bool)

Lookup returns the rule for op's slot; false when the slot is not tabled (an extension operator, or a slot whose types are judged elsewhere).

type Slot

type Slot string

Slot names the request position a field is judged in.

const (
	// SlotField is the operator's primary `field`.
	SlotField Slot = "field"
	// SlotField2 is a paired / bivariate test's `field2`.
	SlotField2 Slot = "field2"
	// SlotTarget is a regression's `target`.
	SlotTarget Slot = "target"
	// SlotPredictor is one entry of a regression's `predictors`.
	SlotPredictor Slot = "predictor"
	// SlotSplitBy is a test's `split_by` grouping column.
	SlotSplitBy Slot = "split_by"
	// SlotSubject is TEST_ANOVA_RM's `subject_field`.
	SlotSubject Slot = "subject_field"
	// SlotRows / SlotCols are a contingency test's `rows` / `cols`.
	SlotRows Slot = "rows"
	SlotCols Slot = "cols"
	// SlotStratify is FEAT_TRAIN_TEST_SPLIT's `params.stratify`.
	SlotStratify Slot = "stratify"
	// SlotPrediction is a model-error aggregator's
	// `params.prediction_field`.
	SlotPrediction Slot = "prediction_field"
	// SlotNumerator / SlotDenominator are AGG_RATIO's
	// `params.numerator_field` / `params.denominator_field`.
	SlotNumerator   Slot = "numerator_field"
	SlotDenominator Slot = "denominator_field"
)

Jump to

Keyboard shortcuts

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