Skip to main content

Narrative-specific functions

These functions are specific to the Narrative platform.

NORMALIZE_EMAIL

Normalizes an email address for consistent matching.
Normalization includes:
  • Lowercase conversion
  • Removal of plus-addressing
  • Provider-specific handling (Gmail dot removal, etc.)

NORMALIZE_PHONE

Normalizes a phone number to a standard format.

HASH

Generates a hash from one or more values.

MD5 / SHA1 / SHA2

Standard cryptographic hash functions.

HMAC_SHA256

HMAC using SHA-256.

ADDRESS_HASHES

Generates hash variants for address matching.

NARRATIVE_ID_ENCODE

Encodes a clear text identifier into a Narrative ID within a specific encoding space. Narrative IDs are per-partner pseudonymous identifiers that enable privacy-safe data collaboration. Syntax:
Parameters: Returns: string - The encoded Narrative ID Examples:
The same identifier encoded with different key_id values produces different Narrative IDs. Always normalize identifiers (lowercase, trim whitespace) before encoding for consistent matching.
Related: Narrative ID Concepts, Using Narrative ID

NARRATIVE_ID_TRANSLATE

Translates a Narrative ID from one partner’s encoding space to another. This enables secure data collaboration by converting identifiers without exposing the underlying clear text values. Syntax:
Parameters: Returns: string - The translated Narrative ID in the target encoding space Examples:
Use case: When sharing data with a partner, translate your Narrative IDs to their encoding space so they can match against their own Narrative IDs. This enables cross-organization matching without exposing underlying identifiers. Related: Narrative ID Concepts, Using Narrative ID

UNIVERSE_SAMPLE

Deterministic sampling based on an identifier.

DETERMINISTIC_RAND

Generates a deterministic random number from a seed.

PARSE_JSON / TRY_PARSE_JSON

Parses a JSON string.

OBJECT_REMOVE_NULLS

Returns a struct with null-valued fields removed. On AWS hosted data planes, the function is accepted for cross-platform query compatibility but operates as a no-op.

TOKENIZE

Tokenizes text using a specified model.

TOKENIZE_SIZE

Returns the token count for text.

EMBED_TEXT_768

Generates a 768-dimensional text embedding.

COSINE_SIMILARITY

Calculates cosine similarity between two vectors.
Scores text relevance against a search query.

UUID_GENERATE

Generates a random UUID.

Aggregate Functions

GROUP BY computations

SELECT

DELTA tables and budget clauses

All Functions

Browse all function categories

NQL Design Philosophy

Why NQL extends standard SQL