Skip to main content
A family of functions that extract typed values from VARIANT objects at specified paths. These functions navigate to a specified path in a VARIANT value and return the value as a specific data type. If the value at the path does not exist, the path is invalid, or the value cannot be converted to the requested type, the functions return NULL.

Syntax

Parameters

  • variant_expr: the expression that represents the VARIANT object. This is typically a VARIANT column from an Iceberg table.
  • path: the expression that represents the path to an element in the VARIANT object. The value of this parameter is a string. The path syntax is similar to JSON path:
    • $ represents the root element
    • . is used to access object fields
    • [index] is used to access array elements (0-based indexing)
    • Field names with special characters can be quoted: $."field.name"

Return values

  • get_variant_int: Returns a BIGINT value, or NULL if the value cannot be converted to an integer.
  • get_variant_double: Returns a DOUBLE value, or NULL if the value cannot be converted to a double.
  • get_variant_string: Returns a VARCHAR value, or NULL if the value cannot be converted to a string.
  • get_variant_bool: Returns a BOOLEAN value (1 or 0), or NULL if the value cannot be converted to a boolean.

Examples

Example 1: Extract basic fields from root level

Extract string and integer values from the Bluesky firehose data:

Example 2: Extract nested fields

Extract operation details from nested commit structures:

Example 3: Extract deeply nested content

Extract post text and metadata from deeply nested structures:

Example 4: Extract boolean values

Extract boolean flags from post records:

Example 5: Extract numeric values with calculations

Convert microseconds to seconds and perform timestamp calculations:

Example 6: Use in aggregation queries

Count records by collection type:

Example 7: Count records by operation type

Example 8: Extract and analyze engagement metrics

Extract numeric engagement metrics from posts:

Example 9: Combine multiple variant functions in filtering

Find verified accounts that are actively posting:

Example 10: NULL handling

Returns NULL when paths don’t exist or values can’t be converted:

keyword

GET_VARIANT_INT,GET_VARIANT_DOUBLE,GET_VARIANT_STRING,GET_VARIANT_BOOL,VARIANT