VARIANT cast extends to ARRAY and MAP columns in ABAC column masks
You can now use a single VARIANT function to mask ARRAY and MAP columns in ABAC policies.
O que mudou
Databricks now allows VARIANT-based masking functions to be applied to ARRAY and MAP columns, in addition to STRUCT. This simplifies governance by reducing the number of UDFs needed to mask complex data.
Use cases
Imagine you need to hide sensitive data in tables containing lists or dictionaries of information, and want to reuse the same security logic without writing separate functions for every data type.
- Mask
ARRAYandMAPcolumns using a singleVARIANT-based function. - Reduce the number of user-defined functions (UDFs) and access policies to maintain.
- Rebuild complex data structures while preserving the original schema after masking.
How to use
Create a SQL function that accepts and returns VARIANT, using schema_of_variant() to identify the type and rebuild the value using array() or map().
CREATE OR REPLACE FUNCTION generic_mask(val VARIANT)
RETURNS VARIANT
RETURN CASE
WHEN schema_of_variant(val) = 'ARRAY<STRING>' THEN
to_variant_object(array('redacted'))
WHEN schema_of_variant(val) = 'OBJECT<key1: STRING, key2: STRING>' THEN
to_variant_object(map('key1', 'redacted', 'key2', 'redacted'))
ELSE NULL::VARIANT
END;
What happens in this code:
- The function receives the column automatically cast to
VARIANTformat. - The
schema_of_variant(val)command checks the exact structure of each row at runtime. - The
CASEstatement applies the appropriate redaction logic for each detected schema. - The modified value is wrapped in
to_variant_object()and returned, then cast back to the original column type by Databricks.
Limitations and requirements
- Requires Databricks Runtime 19 or above for
ARRAYandMAPcolumns. - Complex columns containing
CHAR,VARCHAR,GEOMETRY,GEOGRAPHY, orTIMEcannot be masked usingVARIANT. MAPkeys must be strictly of typeSTRING.- This casting works exclusively within Unity Catalog column mask and row filter policies (ABAC), not in general SQL queries.
- unity catalog
- abac
- variant
- governance
- security
VARIANT cast extends to ARRAY and MAP columns in ABAC column masks
Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.
Relacionadas
- DatabricksGA
Repositórios de pacotes em nível de workspace para Databricks Apps
Administradores de workspace podem configurar repositórios padrão de pacotes Python e npm para Databricks Apps.
databricks apps · workspace settings - DatabricksGA
Redimensione partições de stateful streaming sem perder o checkpoint no Databricks
Agora é possível alterar o número de partições de shuffle em queries Structured Streaming e pipelines Lakeflow sem descartar o estado do checkpoint.
structured streaming · lakeflow - DatabricksAtualização
Google Gemini 4 Argon disponível no Unity Gateway do Databricks
O modelo multimodal Google Gemini 4 Argon já pode ser acessado via Foundation Model APIs e Unity Gateway.
unity catalog · foundation model apis