VARIANT()

All functions > CORE > VARIANT()

Returns a reference to a variant of the given feature with the given replacements in its dependencies.

Signatures

Returns: A variant feature with substituted dependencies

VARIANT(base: FEATURE, origin: ARRAY<FEATURE>, replacement: ARRAY<FEATURE>) → FEATURE
sql
ParameterTypeRequiredDescription
baseFEATUREYesThe base feature to create a variant of
originARRAY<FEATURE>YesArray of features to be replaced
replacementARRAY<FEATURE>YesArray of replacement features

Notes

  • Creates a variant of a feature with dependency substitution
  • Replaces specified origin features with replacement features
  • Useful for A/B testing and feature experimentation
  • Origin and replacement arrays must have matching length
  • Enables creating alternate versions of features
  • Part of the FeatureMesh core system

Examples

Minimal REPLACING substitution (2-variants-base.slt)

FeatureQL
WITH
    EXPR := INPUT(BIGINT),
    POWER := INPUT(BIGINT),
    POW(EXPR, POWER) AS OPERATION,
SELECT
    RESULT1 := VARIANT(OPERATION REPLACING EXPR, POWER WITH 2, 2),
;
Result
RESULT1 BIGINT
4

Two independent VARIANTs of the same base expression

FeatureQL
WITH
    EXPR := INPUT(BIGINT),
    POWER := INPUT(BIGINT),
    POW(EXPR, POWER) AS OPERATION,
SELECT
    RESULT1 := VARIANT(OPERATION REPLACING EXPR, POWER WITH 1, 2),
    RESULT2 := VARIANT(OPERATION REPLACING EXPR, POWER WITH 3, 4),
;
Result
RESULT1 BIGINTRESULT2 BIGINT
181

Last update at: 2026/05/26 17:22:09