Documentation
¶
Index ¶
- Variables
- func BuildTransformInputFieldTypes(dataSourceType model.DataSourceType, nativeFieldTypes map[string]string) map[string]model.ContractFieldType
- func ContractFieldFromNative(dataSourceType model.DataSourceType, name, nativeType string) pipepayload.ContractField
- func ContractFieldTypeFromNative(dataSourceType model.DataSourceType, nativeType string) model.ContractFieldType
- func ContractForNamedInput(contract *pipepayload.Contract, inputName string, inputCount int) *pipepayload.Contract
- func InferOutputContractWithInputSchema(sql string, outputKind model.TransformOutputKind, ...) (*pipepayload.Contract, error)
- func ValidateFieldMappingContracts(query string, outputKind model.TransformOutputKind, ...) error
- func ValidateFieldMappingSchema(contract *pipepayload.Contract) error
- func ValidateOutputContract(output *pipepayload.Output, contract *pipepayload.Contract) error
- func ValidateOutputContractStructure(sql string, contract *pipepayload.Contract) error
- func ValidateOutputContractTypesWithInputSchema(sql string, contract *pipepayload.Contract, ...) error
- func ValidateOutputContractTypesWithInputSchemaForOutputKind(sql string, outputKind model.TransformOutputKind, ...) error
- func ValidateTransformInputContracts(sql string, contracts map[string]*pipepayload.Contract) error
- func ValidateTransformInputRelationName(name string) error
- func ValidateTransformOutputFacets(kind model.TransformOutputKind, contract *pipepayload.Contract) error
- func ValidateTransformSQL(sql string) ([]string, error)
- func WriteFieldMapping(mapping FieldMapping) (string, error)
- type FieldMapping
- type Limits
- type MappingField
- type Observer
- type Runtime
- func (r Runtime) Execute(transform Transform, upstreamPayloads map[string]*pipepayload.Payload) (*pipepayload.Output, error)
- func (r Runtime) ExecuteContext(ctx context.Context, transform Transform, ...) (output *pipepayload.Output, err error)
- func (r Runtime) ValidateInputContext(ctx context.Context, input *pipepayload.Payload, ...) error
- func (r Runtime) WithObserver(observer Observer) Runtime
- type Transform
- type Usage
Constants ¶
This section is empty.
Variables ¶
var ( ErrRequired = xerror.TransformSQLRequired() ErrNotSelect = xerror.TransformSQLNotSelect() ErrMultiStatement = xerror.TransformSQLMultiStatement() ErrFeatureNotAllowed = xerror.TransformSQLFeatureNotAllowed() ErrContractInvalid = xerror.TransformContractInvalid() ErrContractType = xerror.TransformContractTypeMismatch() ErrContractMissing = xerror.TransformContractMissingField() ErrTypeInput = xerror.TransformTypeValidationInput() ErrRuntimeProjectionExpressionUnsupported = xerror.TransformRuntimeProjectionExpressionUnsupported() ErrRuntimeProjectionFieldNotFound = xerror.TransformRuntimeProjectionFieldNotFound() ErrRuntimeAggregateExpressionUnsupported = xerror.TransformRuntimeAggregateExpressionUnsupported() ErrRuntimeAggregateColumnReference = xerror.InvalidTransformRuntimeAggregateColumnReferenceRequired() ErrRuntimeWhereExpressionUnsupported = xerror.TransformRuntimeWhereExpressionUnsupported() ErrRuntimeOutputKindUnsupported = xerror.TransformRuntimeOutputKindUnsupported() ErrRuntimeHeadlessCSVNamedAccessUnsupported = xerror.TransformRuntimeHeadlessCSVNamedAccessUnsupported() ErrOutputContractViolation = xerror.TransformOutputContractViolation() ErrInvalidRuntimeLimits = xerror.New(xerror.KindInvalidInput, "PIPELINE_TRANSFORM_LIMITS_INVALID", "transform runtime limits are invalid") ErrWorkBudgetExceeded = xerror.New(xerror.KindInvalidInput, "PIPELINE_TRANSFORM_WORK_BUDGET_EXCEEDED", "transform work budget exceeded") ErrIntermediateRowsExceeded = xerror.New(xerror.KindInvalidInput, "PIPELINE_TRANSFORM_INTERMEDIATE_ROWS_BUDGET_EXCEEDED", "transform intermediate row budget exceeded") ErrIntermediateBytesExceeded = xerror.New(xerror.KindInvalidInput, "PIPELINE_TRANSFORM_INTERMEDIATE_BYTES_BUDGET_EXCEEDED", "transform intermediate byte budget exceeded") ErrOutputRowsExceeded = xerror.New(xerror.KindInvalidInput, "PIPELINE_TRANSFORM_OUTPUT_ROWS_BUDGET_EXCEEDED", "transform output row budget exceeded") ErrOutputBytesExceeded = xerror.New(xerror.KindInvalidInput, "PIPELINE_TRANSFORM_OUTPUT_BYTES_BUDGET_EXCEEDED", "transform output byte budget exceeded") ErrDepthBudgetExceeded = xerror.New(xerror.KindInvalidInput, "PIPELINE_TRANSFORM_DEPTH_BUDGET_EXCEEDED", "transform depth budget exceeded") ErrExecutionBudgetInterrupted = xerror.New(xerror.KindTimeout, "PIPELINE_TRANSFORM_EXECUTION_INTERRUPTED", "transform timeout or cancellation budget exceeded") )
var ErrFieldMappingUnsupported = xerror.New(xerror.KindInvalidInput,
"PIPELINE_FIELD_MAPPING_UNSUPPORTED", "SQL cannot be edited as a field mapping")
var ErrNumericConversion = xerror.New(xerror.KindInvalidInput, "PIPELINE_TRANSFORM_NUMERIC_CONVERSION", "unsupported transform numeric conversion")
ErrNumericConversion rejects unsupported ranges and lossy integer conversions.
Functions ¶
func BuildTransformInputFieldTypes ¶
func BuildTransformInputFieldTypes( dataSourceType model.DataSourceType, nativeFieldTypes map[string]string, ) map[string]model.ContractFieldType
BuildTransformInputFieldTypes normalizes introspected field types for input.
func ContractFieldFromNative ¶
func ContractFieldFromNative(dataSourceType model.DataSourceType, name, nativeType string) pipepayload.ContractField
ContractFieldFromNative retains bounded precision/scale when the provider declares it. Unqualified native types keep their existing compatibility mapping.
func ContractFieldTypeFromNative ¶
func ContractFieldTypeFromNative( dataSourceType model.DataSourceType, nativeType string, ) model.ContractFieldType
ContractFieldTypeFromNative maps datasource-native field type strings from schema introspection into the unified contract field type.
func ContractForNamedInput ¶
func ContractForNamedInput( contract *pipepayload.Contract, inputName string, inputCount int, ) *pipepayload.Contract
ContractForNamedInput selects the local requirement from a combined flat contract.
func InferOutputContractWithInputSchema ¶
func InferOutputContractWithInputSchema( sql string, outputKind model.TransformOutputKind, dataSourceType model.DataSourceType, inputFieldTypes map[string]model.ContractFieldType, ) (*pipepayload.Contract, error)
InferOutputContractWithInputSchema derives a transform output contract from the SELECT projection using the same schema-aware inference as validation.
func ValidateFieldMappingContracts ¶
func ValidateFieldMappingContracts(query string, outputKind model.TransformOutputKind, source, destination *pipepayload.Contract) error
ValidateFieldMappingContracts checks explicit shapes, without resolving catalog references or claiming that cached metadata proves runtime values.
func ValidateFieldMappingSchema ¶
func ValidateFieldMappingSchema(contract *pipepayload.Contract) error
func ValidateOutputContract ¶
func ValidateOutputContract( output *pipepayload.Output, contract *pipepayload.Contract, ) error
ValidateOutputContract checks runtime transform output against the declared contract. It dispatches by output kind so each representation can enforce shape rules consistently, and fails closed on unknown kinds to prevent silent validation gaps. Returns ErrOutputContractViolation (wrapped) on the first detected violation.
func ValidateOutputContractStructure ¶
func ValidateOutputContractStructure(sql string, contract *pipepayload.Contract) error
ValidateOutputContractStructure validates only projection/contract structure. It is intended for load-time checks where datasource schema context is unavailable.
func ValidateOutputContractTypesWithInputSchema ¶
func ValidateOutputContractTypesWithInputSchema( sql string, contract *pipepayload.Contract, dataSourceType model.DataSourceType, inputFieldTypes map[string]model.ContractFieldType, ) error
ValidateOutputContractTypesWithInputSchema validates output contract types using datasource context plus inferred input field types from schema introspection.
inputFieldTypes is a map of source field name -> contract field type for input columns/fields.
func ValidateOutputContractTypesWithInputSchemaForOutputKind ¶
func ValidateOutputContractTypesWithInputSchemaForOutputKind( sql string, outputKind model.TransformOutputKind, contract *pipepayload.Contract, dataSourceType model.DataSourceType, inputFieldTypes map[string]model.ContractFieldType, ) error
ValidateOutputContractTypesWithInputSchemaForOutputKind validates output contract types after applying output_kind-specific serialization semantics.
func ValidateTransformInputContracts ¶
func ValidateTransformInputContracts(sql string, contracts map[string]*pipepayload.Contract) error
ValidateTransformInputContracts compares known structural declarations across UNION ALL inputs. Per-input quality declarations do not become global claims.
func ValidateTransformOutputFacets ¶
func ValidateTransformOutputFacets(kind model.TransformOutputKind, contract *pipepayload.Contract) error
ValidateTransformOutputFacets checks the wire format separately from field types.
func ValidateTransformSQL ¶
ValidateTransformSQL enforces the sql_v1 MVP contract for transform DSL. Returns (warnings, error): warnings are informational hints to surface to the user; they do not block the statement from being accepted.
Validation checks the supported SQL syntax and structure but does not infer or validate field types. Type enforcement is handled separately in ValidateOutputContractTypes once datasource context is available.
func WriteFieldMapping ¶
func WriteFieldMapping(mapping FieldMapping) (string, error)
WriteFieldMapping emits SQL validated by the existing transform parser.
Types ¶
type FieldMapping ¶
type FieldMapping struct {
Input string `json:"input"`
Fields []MappingField `json:"fields"`
}
FieldMapping is an editing view of ordinary SQL, never a persisted transform language.
func ReadFieldMapping ¶
func ReadFieldMapping(query string) (*FieldMapping, error)
ReadFieldMapping refuses SQL whose behavior cannot survive projection editing. Callers must retain the original SQL when this returns an error.
func SuggestFieldMapping ¶
func SuggestFieldMapping(input string, source, destination *pipepayload.Contract) FieldMapping
SuggestFieldMapping proposes exact same-name, compatible-type fields only. Requiredness, nullability and business meaning still require author review.
type Limits ¶
type Limits struct {
MaxWork int64
MaxIntermediateRows int
MaxIntermediateBytes int64
MaxOutputRows int
MaxOutputBytes int64
MaxDepth int
Timeout time.Duration
}
Limits bounds one transform execution. Zero values leave the corresponding core limit disabled so callers can preserve the legacy runtime while deployment configuration supplies positive deny-by-default limits.
type MappingField ¶
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func NewRuntime ¶
NewRuntime creates a transform runtime. The variadic parameter preserves source compatibility with the original no-argument constructor.
func (Runtime) Execute ¶
func (r Runtime) Execute( transform Transform, upstreamPayloads map[string]*pipepayload.Payload, ) (*pipepayload.Output, error)
func (Runtime) ExecuteContext ¶
func (r Runtime) ExecuteContext( ctx context.Context, transform Transform, upstreamPayloads map[string]*pipepayload.Payload, ) (output *pipepayload.Output, err error)
ExecuteContext executes a transform with cumulative per-execution budgets.
func (Runtime) ValidateInputContext ¶
func (r Runtime) ValidateInputContext(ctx context.Context, input *pipepayload.Payload, contract *pipepayload.Contract) error
ValidateInputContext uses the runtime's normalization and validation before execution so orchestration can durably record this boundary before SQL runs.
func (Runtime) WithObserver ¶
WithObserver returns a runtime that reports aggregate usage after execution.
type Transform ¶
type Transform struct {
SQL string
OutputKind model.TransformOutputKind
InputContract *pipepayload.Contract
InputContracts map[string]*pipepayload.Contract
OutputContract *pipepayload.Contract
}