Skip to main content
The Variant type allows a single column to hold values of different data types, enabling flexible handling of semi-structured data without defining a rigid schema upfront. StreamNative Ursa supports the Variant type for both Apache Iceberg (V3) and Delta Lake tables.
Important: Variant type support is disabled by default. Contact the StreamNative Support Team to enable the feature flag before using Variant types.

Enabling Variant Support

Variant support is gated by a small set of broker properties. The required combination depends on the target table format.

Iceberg

Set the following properties on the compaction service custom config:
Downstream query engine compatibility: When allowIcebergV3 is enabled, the downstream query engine reading the table must also support Iceberg V3. Older Spark / Trino / Athena versions that only support Iceberg V2 will fail to read tables that use Variant or other V3-only features. Verify your engine’s Iceberg support level before enabling.

Delta Lake

Delta Lake’s Variant type is not gated by an Iceberg version flag. Only the master switch and schema evolution are required:

Supported Data Types

  • Primitives: string, int, long, float, double, boolean, bytes
  • Complex types: map, list / array, set
  • Nested POJOs and entire POJOs

Configure Variant in Pulsar

Avro Schema

Use the @AvroSchema annotation with logicalType: "variant":

JSON Schema

Use @JsonPropertyDescription with the Variant annotation:

ProtobufNative Schema

Define a custom field option named logical_type:

Configure Variant in Ursa (Kafka Protocol)

Avro Schema — POJO Annotation

Same @AvroSchema annotations as Pulsar. Produce data using ReflectionAvroSerializer (do not use KafkaAvroSerializer).

Avro Schema — Inline Definition

Define logicalType: "variant" directly in the Avro schema:

JSON Schema

Same @JsonPropertyDescription("logicalType: variant") annotations as Pulsar.

Protobuf Schema

Protobuf is supported via the same logical_type custom field option as Pulsar’s ProtobufNative schema. Define the option once in your .proto file and tag each Variant field:

Performance Optimization

Use variant-metadata-fields to specify fields that should be extracted as top-level columns. This accelerates query performance by enabling predicate pushdown on those fields:

Schema Evolution Rules for Variant

For more information about the Dead Letter Table (DLT), see Schema Evolution — Dead Letter Table.